From: "Paul E. McKenney" <paulmck@us.ibm.com>
To: Rik Faith <faith@redhat.com>
Cc: Andrew Morton <akpm@osdl.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Light-weight Auditing Framework
Date: Fri, 12 Mar 2004 10:50:33 -0800 [thread overview]
Message-ID: <20040312185033.GA2507@us.ibm.com> (raw)
In-Reply-To: <16464.30442.852919.24605@neuro.alephnull.com>
On Thu, Mar 11, 2004 at 09:25:46AM -0500, Rik Faith wrote:
> Below is a patch against 2.6.4 that provides a low-overhead system-call
> auditing framework for Linux that is usable by LSM components (e.g.,
> SELinux). This is an update of the patch discussed in this thread:
> http://marc.theaimsgroup.com/?t=107815888100001&r=1&w=2
[ . . . ]
Great application of RCU -- audit rules should not change
often, but could be referenced quite frequently!
A couple of comments:
o I don't see any rcu_read_lock() or rcu_read_unlock() calls.
These are needed on the read side in order to (1) let the
people reading the code know the extent of the read-side
critical section and (2) disable preemption in CONFIG_PREEMPT
kernels. Without the former, someone will end up putting
a blocking primitive in the wrong place. Without the latter,
the kernel will do the dirty work all by itself. Either way,
you get breakage.
For example, I suspect that audit_filter_task() needs to
read as follows:
static enum audit_state audit_filter_task(struct task_struct *tsk)
{
struct audit_entry *e;
enum audit_state state;
rcu_read_lock();
list_for_each_entry_rcu(e, &audit_tsklist, list) {
if (audit_filter_rules(tsk, &e->rule, NULL, &state)) {
rcu_read_unlock();
return state;
}
}
rcu_read_unlock();
return AUDIT_BUILD_CONTEXT;
}
Alternatively, you could put the rcu_read_lock() and
rcu_read_unlock() around the single call to audit_filter_task()
from audit_alloc().
All of the list_for_each_.*_rcu() macros need to be enclosed
by rcu_read_lock() and rcu_read_unlock() calls.
o Presumably something surrounding netlink_kernel_create()
ensures that only one instance of audit_del_rule() will
be executing at a given time. If not, some locking is
needed.
Once this locking is present, the list_for_each_entry_rcu()
in audit_del_rule() should be changed to list_for_each_entry(),
as it cannot race with deletion, since it -is- deletion.
The list_del_rcu() is correct, and should remain.
If you are using some sort of implicit locking, then please
inject a clue...
o The audit_add_rule() function also needs something to prevent
races with other audit_add_rule() and audit_del_rule()
instances. Again, this might be happening somehow in
the netlink_kernel_create() mechanism, but I don't
immediately see it. Then again, I do not claim to fully
understand how the netlink_kernel_create() mechanism
functions.
Again, looks like a promising application of RCU!
Thanx, Paul
next prev parent reply other threads:[~2004-03-13 1:57 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-03-11 14:25 [PATCH] Light-weight Auditing Framework Rik Faith
2004-03-11 14:49 ` Stephen Smalley
2004-03-11 19:21 ` Andrew Morton
2004-03-12 5:21 ` Rik Faith
2004-03-12 15:18 ` Rik Faith
2004-03-12 6:02 ` James Morris
2004-03-12 18:50 ` Paul E. McKenney [this message]
2004-03-17 9:14 ` Rik Faith
2004-03-18 0:45 ` Paul E. McKenney
2004-03-23 20:55 ` Rik Faith
2004-03-24 13:44 ` Rik Faith
2004-03-25 3:01 ` Paul E. McKenney
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=20040312185033.GA2507@us.ibm.com \
--to=paulmck@us.ibm.com \
--cc=akpm@osdl.org \
--cc=faith@redhat.com \
--cc=linux-kernel@vger.kernel.org \
/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