From: Amy Griffis <amy.griffis@hp.com>
To: Alexander Viro <aviro@redhat.com>
Cc: linux-audit@redhat.com
Subject: Re: [PATCH lazy audit
Date: Thu, 3 Aug 2006 14:56:13 -0400 [thread overview]
Message-ID: <20060803185613.GA6038@dill.zko.hp.com> (raw)
In-Reply-To: <200608011522.k71FMcuq007786@devserv.devel.redhat.com>
Alexander Viro wrote: [Tue Aug 01 2006, 11:22:38AM EDT]
> Killing audit overhead in case when no rules are loaded. More detailed
> log (this is a composite of patch series from audit git tree, see audit.b23..
> lspp.b23 in there for individual changesets):
>
> [PATCH] introduce audit rules counter
> [PATCH] mark context of syscall entered with no rules as dummy
> [PATCH] don't bother with aux entires for dummy context
> [PATCH] take filling ->pid, etc. out of audit_get_context()
> move that stuff downstream and into the only branch where it'll be
> used.
>
> diff --git a/fs/namei.c b/fs/namei.c
> index 0ab26cb..55a1312 100644
> --- a/fs/namei.c
> +++ b/fs/namei.c
> @@ -159,7 +159,7 @@ char * getname(const char __user * filen
> #ifdef CONFIG_AUDITSYSCALL
> void putname(const char *name)
> {
> - if (unlikely(current->audit_context))
> + if (unlikely(!audit_dummy_context()))
> audit_putname(name);
> else
> __putname(name);
> @@ -1125,7 +1125,7 @@ static int fastcall do_path_lookup(int d
> retval = link_path_walk(name, nd);
> out:
> if (likely(retval == 0)) {
> - if (unlikely(current->audit_context && nd && nd->dentry &&
> + if (unlikely(!audit_dummy_context() && nd && nd->dentry &&
> nd->dentry->d_inode))
> audit_inode(name, nd->dentry->d_inode);
> }
Why the double call to audit_dummy_context()? If false, we repeat the
call immediately in audit_inode(). I guess we were previously
checking current->audit_context twice, but I don't see any reason for
it.
> diff --git a/include/linux/audit.h b/include/linux/audit.h
> index bf196c0..d26060e 100644
> --- a/include/linux/audit.h
> +++ b/include/linux/audit.h
> @@ -329,23 +329,28 @@ extern void __audit_inode(const char *na
> extern void __audit_inode_child(const char *dname, const struct inode *inode,
> const struct inode *parent);
> extern void __audit_inode_update(const struct inode *inode);
> +static inline int audit_dummy_context(void)
> +{
> + void *p = current->audit_context;
> + return !p || *(int *)p;
> +}
> static inline void audit_getname(const char *name)
> {
> - if (unlikely(current->audit_context))
> + if (unlikely(!audit_dummy_context()))
> __audit_getname(name);
> }
> static inline void audit_inode(const char *name, const struct inode *inode) {
> - if (unlikely(current->audit_context))
> + if (unlikely(!audit_dummy_context()))
> __audit_inode(name, inode);
> }
> static inline void audit_inode_child(const char *dname,
> const struct inode *inode,
> const struct inode *parent) {
> - if (unlikely(current->audit_context))
> + if (unlikely(!audit_dummy_context()))
> __audit_inode_child(dname, inode, parent);
> }
> static inline void audit_inode_update(const struct inode *inode) {
> - if (unlikely(current->audit_context))
> + if (unlikely(!audit_dummy_context()))
> __audit_inode_update(inode);
> }
>
[...]
prev parent reply other threads:[~2006-08-03 18:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-01 15:22 [PATCH lazy audit Alexander Viro
2006-08-01 15:45 ` James Antill
2006-08-01 16:04 ` Alexander Viro
2006-08-03 18:56 ` Amy Griffis [this message]
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=20060803185613.GA6038@dill.zko.hp.com \
--to=amy.griffis@hp.com \
--cc=aviro@redhat.com \
--cc=linux-audit@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