<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/kernel/auditfilter.c, branch v2.6.28</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.28</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v2.6.28'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2008-11-15T20:26:44Z</updated>
<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>Re: [PATCH] the loginuid field should be output in all AUDIT_CONFIG_CHANGE audit messages</title>
<updated>2008-08-01T16:15:03Z</updated>
<author>
<name>zhangxiliang</name>
<email>zhangxiliang@cn.fujitsu.com</email>
</author>
<published>2008-08-01T01:47:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=036bbf76ad9f83781590623111b80ba0b82930ac'/>
<id>urn:sha1:036bbf76ad9f83781590623111b80ba0b82930ac</id>
<content type='text'>
&gt; shouldn't these be using the "audit_get_loginuid(current)"  and if we
&gt; are going to output loginuid we also should be outputting sessionid

Thanks for your detailed explanation.
I have made a new patch for outputing "loginuid" and "sessionid" by audit_get_loginuid(current) and audit_get_sessionid(current).
If there are some deficiencies, please give me your indication.

Signed-off-by: Zhang Xiliang &lt;zhangxiliang@cn.fujitsu.com&gt;
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>[PATCH] remove useless argument type in audit_filter_user()</title>
<updated>2008-06-25T03:36:35Z</updated>
<author>
<name>Peng Haitao</name>
<email>penght@cn.fujitsu.com</email>
</author>
<published>2008-05-20T01:13:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d8de72473effd674a3c1fe9621821f406f5587c9'/>
<id>urn:sha1:d8de72473effd674a3c1fe9621821f406f5587c9</id>
<content type='text'>
The second argument "type" is not used in audit_filter_user(), so I think that type can be removed. If I'm wrong, please tell me.

Signed-off-by: Peng Haitao &lt;penght@cn.fujitsu.com&gt;
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>[PATCH] audit: fix kernel-doc parameter notation</title>
<updated>2008-06-25T03:36:28Z</updated>
<author>
<name>Randy Dunlap</name>
<email>randy.dunlap@oracle.com</email>
</author>
<published>2008-05-19T22:09:21Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=9f0aecdd1cd6aacee9aa8f08031f4f2e09e454dc'/>
<id>urn:sha1:9f0aecdd1cd6aacee9aa8f08031f4f2e09e454dc</id>
<content type='text'>
Fix auditfilter kernel-doc misssing parameter description:

Warning(lin2626-rc3//kernel/auditfilter.c:1551): No description found for parameter 'sessionid'

Signed-off-by: Randy Dunlap &lt;randy.dunlap@oracle.com&gt;
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>Merge branch 'audit.b50' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/audit-current</title>
<updated>2008-04-29T18:41:22Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2008-04-29T18:41:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=9781db7b345b5dfe93787aaaf310c861db7c1ede'/>
<id>urn:sha1:9781db7b345b5dfe93787aaaf310c861db7c1ede</id>
<content type='text'>
* 'audit.b50' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/audit-current:
  [PATCH] new predicate - AUDIT_FILETYPE
  [patch 2/2] Use find_task_by_vpid in audit code
  [patch 1/2] audit: let userspace fully control TTY input auditing
  [PATCH 2/2] audit: fix sparse shadowed variable warnings
  [PATCH 1/2] audit: move extern declarations to audit.h
  Audit: MAINTAINERS update
  Audit: increase the maximum length of the key field
  Audit: standardize string audit interfaces
  Audit: stop deadlock from signals under load
  Audit: save audit_backlog_limit audit messages in case auditd comes back
  Audit: collect sessionid in netlink messages
  Audit: end printk with newline
</content>
</entry>
<entry>
<title>Remove duplicated unlikely() in IS_ERR()</title>
<updated>2008-04-29T15:06:25Z</updated>
<author>
<name>Hirofumi Nakagawa</name>
<email>hnakagawa@miraclelinux.com</email>
</author>
<published>2008-04-29T08:03:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=801678c5a3b4c79236970bcca27c733f5559e0d1'/>
<id>urn:sha1:801678c5a3b4c79236970bcca27c733f5559e0d1</id>
<content type='text'>
Some drivers have duplicated unlikely() macros.  IS_ERR() already has
unlikely() in itself.

This patch cleans up such pointless code.

Signed-off-by: Hirofumi Nakagawa &lt;hnakagawa@miraclelinux.com&gt;
Acked-by: David S. Miller &lt;davem@davemloft.net&gt;
Acked-by: Jeff Garzik &lt;jeff@garzik.org&gt;
Cc: Paul Clements &lt;paul.clements@steeleye.com&gt;
Cc: Richard Purdie &lt;rpurdie@rpsys.net&gt;
Cc: Alessandro Zummo &lt;a.zummo@towertech.it&gt;
Cc: David Brownell &lt;david-b@pacbell.net&gt;
Cc: James Bottomley &lt;James.Bottomley@HansenPartnership.com&gt;
Cc: Michael Halcrow &lt;mhalcrow@us.ibm.com&gt;
Cc: Anton Altaparmakov &lt;aia21@cantab.net&gt;
Cc: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Cc: Carsten Otte &lt;cotte@de.ibm.com&gt;
Cc: Patrick McHardy &lt;kaber@trash.net&gt;
Cc: Paul Mundt &lt;lethal@linux-sh.org&gt;
Cc: Jaroslav Kysela &lt;perex@perex.cz&gt;
Cc: Takashi Iwai &lt;tiwai@suse.de&gt;
Acked-by: Mike Frysinger &lt;vapier@gentoo.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>[PATCH] new predicate - AUDIT_FILETYPE</title>
<updated>2008-04-28T10:28:37Z</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2008-04-28T08:15:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=8b67dca9420474623709e00d72a066068a502b20'/>
<id>urn:sha1:8b67dca9420474623709e00d72a066068a502b20</id>
<content type='text'>
Argument is S_IF... | &lt;index&gt;, where index is normally 0 or 1.
Triggers if chosen element of ctx-&gt;names[] is present and the
mode of object in question matches the upper bits of argument.
I.e. for things like "is the argument of that chmod a directory",
etc.

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>[PATCH 2/2] audit: fix sparse shadowed variable warnings</title>
<updated>2008-04-28T10:28:17Z</updated>
<author>
<name>Harvey Harrison</name>
<email>harvey.harrison@gmail.com</email>
</author>
<published>2008-04-27T09:39:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7719e437fac119e57b17588bab3a8e39ff9d22eb'/>
<id>urn:sha1:7719e437fac119e57b17588bab3a8e39ff9d22eb</id>
<content type='text'>
Use msglen as the identifier.
kernel/audit.c:724:10: warning: symbol 'len' shadows an earlier one
kernel/audit.c:575:8: originally declared here

Don't use ino_f to check the inode field at the end of the functions.
kernel/auditfilter.c:429:22: warning: symbol 'f' shadows an earlier one
kernel/auditfilter.c:420:21: originally declared here
kernel/auditfilter.c:542:22: warning: symbol 'f' shadows an earlier one
kernel/auditfilter.c:529:21: originally declared here

i always used as a counter for a for loop and initialized to zero before
use.  Eliminate the inner i variables.
kernel/auditsc.c:1295:8: warning: symbol 'i' shadows an earlier one
kernel/auditsc.c:1152:6: originally declared here
kernel/auditsc.c:1320:7: warning: symbol 'i' shadows an earlier one
kernel/auditsc.c:1152:6: originally declared here

Signed-off-by: Harvey Harrison &lt;harvey.harrison@gmail.com&gt;
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>[PATCH 1/2] audit: move extern declarations to audit.h</title>
<updated>2008-04-28T10:28:04Z</updated>
<author>
<name>Harvey Harrison</name>
<email>harvey.harrison@gmail.com</email>
</author>
<published>2008-04-27T09:39:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=c782f242f0602edf848355d41e3676753c2280c8'/>
<id>urn:sha1:c782f242f0602edf848355d41e3676753c2280c8</id>
<content type='text'>
Leave audit_sig_{uid|pid|sid} protected by #ifdef CONFIG_AUDITSYSCALL.

Noticed by sparse:
kernel/audit.c:73:6: warning: symbol 'audit_ever_enabled' was not declared. Should it be static?
kernel/audit.c:100:8: warning: symbol 'audit_sig_uid' was not declared. Should it be static?
kernel/audit.c:101:8: warning: symbol 'audit_sig_pid' was not declared. Should it be static?
kernel/audit.c:102:6: warning: symbol 'audit_sig_sid' was not declared. Should it be static?
kernel/audit.c:117:23: warning: symbol 'audit_ih' was not declared. Should it be static?
kernel/auditfilter.c:78:18: warning: symbol 'audit_filter_list' was not declared. Should it be static?

Signed-off-by: Harvey Harrison &lt;harvey.harrison@gmail.com&gt;
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>Audit: collect sessionid in netlink messages</title>
<updated>2008-04-28T10:18:03Z</updated>
<author>
<name>Eric Paris</name>
<email>eparis@redhat.com</email>
</author>
<published>2008-04-18T14:09:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=2532386f480eefbdd67b48be55fb4fb3e5a6081c'/>
<id>urn:sha1:2532386f480eefbdd67b48be55fb4fb3e5a6081c</id>
<content type='text'>
Previously I added sessionid output to all audit messages where it was
available but we still didn't know the sessionid of the sender of
netlink messages.  This patch adds that information to netlink messages
so we can audit who sent netlink messages.

Signed-off-by: Eric Paris &lt;eparis@redhat.com&gt;
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
</feed>
