From: Richard Guy Briggs <rgb@redhat.com>
To: Steve Grubb <sgrubb@redhat.com>
Cc: Eric Paris <eparis@redhat.com>,
linux-audit@redhat.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] audit: add arch field to seccomp event log
Date: Tue, 18 Feb 2014 22:15:19 -0500 [thread overview]
Message-ID: <20140219031519.GM16640@madcap2.tricolour.ca> (raw)
In-Reply-To: <1455468.M1LNEKA0EJ@x2>
On 14/02/18, Steve Grubb wrote:
> On Tuesday, February 18, 2014 03:50:44 PM Richard Guy Briggs wrote:
> > > missing '=' but this isn't what audit_get_context() does... it's
> > > crappy naming... I'd think a combo of audit_dummy_context() and
> > > current->audit_context would be most appropriate.
> >
> > Ok. I think I finally understand audit_dummy_context(). Thanks for the
> > hint. However, it appears it is not useful in this sitation, since if
> > there is an audit_context, even a dummy context, it appears arch is
> > filled in.
> >
> > diff --git a/kernel/auditsc.c b/kernel/auditsc.c
> > @@ -2406,12 +2406,18 @@ void audit_core_dumps(long signr)
> > void __audit_seccomp(unsigned long syscall, long signr, int code)
> > {
> > struct audit_buffer *ab;
> > + struct audit_context *context = current->audit_context;
> >
> > ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_SECCOMP);
> > if (unlikely(!ab))
> > return;
> > audit_log_task(ab);
> > audit_log_format(ab, " sig=%ld", signr);
> > + audit_log_format(ab, " arch=");
> > + if (context)
> > + audit_log_format(ab, "%x", context->arch);
> > + else
> > + audit_log_format(ab, "(null)");
> > audit_log_format(ab, " syscall=%ld", syscall);
> > audit_log_format(ab, " compat=%d", is_compat_task());
> > audit_log_format(ab, " ip=0x%lx", KSTK_EIP(current));
>
> Is there anything that could be passed by the caller that might identify the
> syscall ABI when this call was blocked? '(null)' still makes syscall number
> uninterpretable.
This is the way it is done in the existing record that prints a syscall
record in audit_log_exit().
It is set by the arch-dependent assembler linkage for
__audit_syscall_entry() or set by the arch-dependent ptrace code that
calls audit_syscall_entry(). In some arches there are a couple of
choices.
To pass this in to __audit_seccomp() as an arg, I'd have to add that arg
to:
__audit_seccomp()
audit_seccomp()
__secure_computing()
secure_computing()
As you've pointed out in IRC, there is a syscall_get_arch(current, regs)
that could be used to get the arch when an audit context is not yet created.
I was just looking for something like that... I am noticing that all
arches call a variant of syscall_trace_enter() which first calls
secure_computing() [which eventually calls __audit_seccomp()] *before*
calling audit_syscall_entry() [which eventually sets context->arch]. So
I'm not sure how task->audit_context->arch got set... Perhaps
__audit_syscall_entry() should just call syscall_get_arch() instead of
lugging it through the stack like it presently does.
Is this going to give the same information? (I guess I should be able
to answer that question...)
> -Steve
- RGB
--
Richard Guy Briggs <rbriggs@redhat.com>
Senior Software Engineer, Kernel Security, AMER ENG Base Operating Systems, Red Hat
Remote, Ottawa, Canada
Voice: +1.647.777.2635, Internal: (81) 32635, Alt: +1.613.693.0684x3545
next prev parent reply other threads:[~2014-02-19 3:15 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-14 20:23 [PATCH] audit: add arch field to seccomp event log Richard Guy Briggs
2014-02-14 20:49 ` Eric Paris
2014-02-14 20:50 ` Richard Guy Briggs
2014-02-14 20:52 ` Richard Guy Briggs
2014-02-14 21:12 ` Eric Paris
2014-02-18 20:50 ` Richard Guy Briggs
2014-02-18 20:55 ` Eric Paris
2014-02-18 21:01 ` Steve Grubb
2014-02-19 3:15 ` Richard Guy Briggs [this message]
2014-02-19 19:37 ` Richard Guy Briggs
2014-02-21 23:32 ` Richard Guy Briggs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140219031519.GM16640@madcap2.tricolour.ca \
--to=rgb@redhat.com \
--cc=eparis@redhat.com \
--cc=linux-audit@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sgrubb@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox