<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/kernel/audit_tree.c, branch v2.6.32</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v2.6.32</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v2.6.32'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2009-06-24T04:02:38Z</updated>
<entry>
<title>Fix rule eviction order for AUDIT_DIR</title>
<updated>2009-06-24T04:02:38Z</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2009-06-24T04:02:38Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=916d75761c971b6e630a26bd4ba472e90ac9a4b9'/>
<id>urn:sha1:916d75761c971b6e630a26bd4ba472e90ac9a4b9</id>
<content type='text'>
If syscall removes the root of subtree being watched, we
definitely do not want the rules refering that subtree
to be destroyed without the syscall in question having
a chance to match them.

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>Audit: clean up all op= output to include string quoting</title>
<updated>2009-06-24T04:00:52Z</updated>
<author>
<name>Eric Paris</name>
<email>eparis@redhat.com</email>
</author>
<published>2009-06-11T18:31:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=9d9609851003ebed15957f0f2ce18492739ee124'/>
<id>urn:sha1:9d9609851003ebed15957f0f2ce18492739ee124</id>
<content type='text'>
A number of places in the audit system we send an op= followed by a string
that includes spaces.  Somehow this works but it's just wrong.  This patch
moves all of those that I could find to be quoted.

Example:

Change From: type=CONFIG_CHANGE msg=audit(1244666690.117:31): auid=0 ses=1
subj=unconfined_u:unconfined_r:auditctl_t:s0-s0:c0.c1023 op=remove rule
key="number2" list=4 res=0

Change To: type=CONFIG_CHANGE msg=audit(1244666690.117:31): auid=0 ses=1
subj=unconfined_u:unconfined_r:auditctl_t:s0-s0:c0.c1023 op="remove rule"
key="number2" list=4 res=0

Signed-off-by: Eric Paris &lt;eparis@redhat.com&gt;
</content>
</entry>
<entry>
<title>Switch collect_mounts() to struct path</title>
<updated>2009-06-12T01:36:01Z</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2009-04-18T07:28:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=589ff870ed60a9ebdd5ec99ec3f5afe1282fe151'/>
<id>urn:sha1:589ff870ed60a9ebdd5ec99ec3f5afe1282fe151</id>
<content type='text'>
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>No need for crossing to mountpoint in audit_tag_tree()</title>
<updated>2009-04-21T03:01:15Z</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2009-04-18T07:25:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=24b6f16ecf37f918a1934d590e9e71c100d6388f'/>
<id>urn:sha1:24b6f16ecf37f918a1934d590e9e71c100d6388f</id>
<content type='text'>
is_under() will DTRT anyway.  And yes, is_subdir() behaviour
is intentional.

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>audit: incorrect ref counting in audit tree tag_chunk</title>
<updated>2009-04-05T17:48:26Z</updated>
<author>
<name>Eric Paris</name>
<email>eparis@redhat.com</email>
</author>
<published>2009-01-13T22:32:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=318b6d3d7ddbcad3d6867e630711b8a705d873d7'/>
<id>urn:sha1:318b6d3d7ddbcad3d6867e630711b8a705d873d7</id>
<content type='text'>
tag_chunk has bad exit paths in which the inotify ref counting is wrong.
At the top of the function we found &amp;old_watch using  inotify_find_watch().
inotify_find_watch takes a reference to the watch.  This is never dropped
on an error path.

Signed-off-by: Eric Paris &lt;eparis@redhat.com&gt;
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>audit: validate comparison operations, store them in sane form</title>
<updated>2009-01-04T20:14:42Z</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2008-12-16T10:59:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=5af75d8d58d0f9f7b7c0515b35786b22892d5f12'/>
<id>urn:sha1:5af75d8d58d0f9f7b7c0515b35786b22892d5f12</id>
<content type='text'>
Don't store the field-&gt;op in the messy (and very inconvenient for e.g.
audit_comparator()) form; translate to dense set of values and do full
validation of userland-submitted value while we are at it.

-&gt;audit_init_rule() and -&gt;audit_match_rule() get new values now; in-tree
instances updated.

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>audit rules ordering, part 2</title>
<updated>2009-01-04T20:14:42Z</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2008-12-15T06:17:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e45aa212ea81d39b38ba158df344dc3a500153e5'/>
<id>urn:sha1:e45aa212ea81d39b38ba158df344dc3a500153e5</id>
<content type='text'>
Fix the actual rule listing; add per-type lists _not_ used for matching,
with all exit,... sitting on one such list.  Simplifies "do something
for all rules" logics, while we are at it...

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>Fix inotify watch removal/umount races</title>
<updated>2008-11-15T20:26:44Z</updated>
<author>
<name>Al Viro</name>
<email>viro@ZenIV.linux.org.uk</email>
</author>
<published>2008-11-15T01:15:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=8f7b0ba1c853919b85b54774775f567f30006107'/>
<id>urn:sha1:8f7b0ba1c853919b85b54774775f567f30006107</id>
<content type='text'>
Inotify watch removals suck violently.

To kick the watch out we need (in this order) inode-&gt;inotify_mutex and
ih-&gt;mutex.  That's fine if we have a hold on inode; however, for all
other cases we need to make damn sure we don't race with umount.  We can
*NOT* just grab a reference to a watch - inotify_unmount_inodes() will
happily sail past it and we'll end with reference to inode potentially
outliving its superblock.

Ideally we just want to grab an active reference to superblock if we
can; that will make sure we won't go into inotify_umount_inodes() until
we are done.  Cleanup is just deactivate_super().

However, that leaves a messy case - what if we *are* racing with
umount() and active references to superblock can't be acquired anymore?
We can bump -&gt;s_count, grab -&gt;s_umount, which will almost certainly wait
until the superblock is shut down and the watch in question is pining
for fjords.  That's fine, but there is a problem - we might have hit the
window between -&gt;s_active getting to 0 / -&gt;s_count - below S_BIAS (i.e.
the moment when superblock is past the point of no return and is heading
for shutdown) and the moment when deactivate_super() acquires
-&gt;s_umount.

We could just do drop_super() yield() and retry, but that's rather
antisocial and this stuff is luser-triggerable.  OTOH, having grabbed
-&gt;s_umount and having found that we'd got there first (i.e.  that
-&gt;s_root is non-NULL) we know that we won't race with
inotify_umount_inodes().

So we could grab a reference to watch and do the rest as above, just
with drop_super() instead of deactivate_super(), right? Wrong.  We had
to drop ih-&gt;mutex before we could grab -&gt;s_umount.  So the watch
could've been gone already.

That still can be dealt with - we need to save watch-&gt;wd, do idr_find()
and compare its result with our pointer.  If they match, we either have
the damn thing still alive or we'd lost not one but two races at once,
the watch had been killed and a new one got created with the same -&gt;wd
at the same address.  That couldn't have happened in inotify_destroy(),
but inotify_rm_wd() could run into that.  Still, "new one got created"
is not a problem - we have every right to kill it or leave it alone,
whatever's more convenient.

So we can use idr_find(...) == watch &amp;&amp; watch-&gt;inode-&gt;i_sb == sb as
"grab it and kill it" check.  If it's been our original watch, we are
fine, if it's a newcomer - nevermind, just pretend that we'd won the
race and kill the fscker anyway; we are safe since we know that its
superblock won't be going away.

And yes, this is far beyond mere "not very pretty"; so's the entire
concept of inotify to start with.

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Acked-by: Greg KH &lt;greg@kroah.com&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>[PATCH] get rid of nameidata in audit_tree</title>
<updated>2008-10-23T09:12:53Z</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2008-08-02T05:06:21Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=98bc993f99e51467057ef699e47fec020f24d233'/>
<id>urn:sha1:98bc993f99e51467057ef699e47fec020f24d233</id>
<content type='text'>
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>[PATCH] list_for_each_rcu must die: audit</title>
<updated>2008-05-17T07:30:23Z</updated>
<author>
<name>Paul E. McKenney</name>
<email>paulmck@linux.vnet.ibm.com</email>
</author>
<published>2008-05-15T00:10:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=6793a051fb9311f0f1ab7eafc5a9e69b8a1bd8d4'/>
<id>urn:sha1:6793a051fb9311f0f1ab7eafc5a9e69b8a1bd8d4</id>
<content type='text'>
All uses of list_for_each_rcu() can be profitably replaced by the
easier-to-use list_for_each_entry_rcu().  This patch makes this change
for the Audit system, in preparation for removing the list_for_each_rcu()
API entirely.  This time with well-formed SOB.

Signed-off-by: Paul E. McKenney &lt;paulmck@linux.vnet.ibm.com&gt;
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
</feed>
