<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/kernel/auditfilter.c, branch v2.6.30</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.30</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v2.6.30'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2009-05-06T23:36:09Z</updated>
<entry>
<title>inotify: use GFP_NOFS in kernel_event() to work around a lockdep false-positive</title>
<updated>2009-05-06T23:36:09Z</updated>
<author>
<name>Wu Fengguang</name>
<email>fengguang.wu@intel.com</email>
</author>
<published>2009-05-06T23:02:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=381a80e6df396eaabef2c00f85974a4579ac1c70'/>
<id>urn:sha1:381a80e6df396eaabef2c00f85974a4579ac1c70</id>
<content type='text'>
There is what we believe to be a false positive reported by lockdep.

inotify_inode_queue_event() =&gt; take inotify_mutex =&gt; kernel_event() =&gt;
kmalloc() =&gt; SLOB =&gt; alloc_pages_node() =&gt; page reclaim =&gt; slab reclaim =&gt;
dcache reclaim =&gt; inotify_inode_is_dead =&gt; take inotify_mutex =&gt; deadlock

The plan is to fix this via lockdep annotation, but that is proving to be
quite involved.

The patch flips the allocation over to GFP_NFS to shut the warning up, for
the 2.6.30 release.

Hopefully we will fix this for real in 2.6.31.  I'll queue a patch in -mm
to switch it back to GFP_KERNEL so we don't forget.

  =================================
  [ INFO: inconsistent lock state ]
  2.6.30-rc2-next-20090417 #203
  ---------------------------------
  inconsistent {RECLAIM_FS-ON-W} -&gt; {IN-RECLAIM_FS-W} usage.
  kswapd0/380 [HC0[0]:SC0[0]:HE1:SE1] takes:
   (&amp;inode-&gt;inotify_mutex){+.+.?.}, at: [&lt;ffffffff8112f1b5&gt;] inotify_inode_is_dead+0x35/0xb0
  {RECLAIM_FS-ON-W} state was registered at:
    [&lt;ffffffff81079188&gt;] mark_held_locks+0x68/0x90
    [&lt;ffffffff810792a5&gt;] lockdep_trace_alloc+0xf5/0x100
    [&lt;ffffffff810f5261&gt;] __kmalloc_node+0x31/0x1e0
    [&lt;ffffffff81130652&gt;] kernel_event+0xe2/0x190
    [&lt;ffffffff81130826&gt;] inotify_dev_queue_event+0x126/0x230
    [&lt;ffffffff8112f096&gt;] inotify_inode_queue_event+0xc6/0x110
    [&lt;ffffffff8110444d&gt;] vfs_create+0xcd/0x140
    [&lt;ffffffff8110825d&gt;] do_filp_open+0x88d/0xa20
    [&lt;ffffffff810f6b68&gt;] do_sys_open+0x98/0x140
    [&lt;ffffffff810f6c50&gt;] sys_open+0x20/0x30
    [&lt;ffffffff8100c272&gt;] system_call_fastpath+0x16/0x1b
    [&lt;ffffffffffffffff&gt;] 0xffffffffffffffff
  irq event stamp: 690455
  hardirqs last  enabled at (690455): [&lt;ffffffff81564fe4&gt;] _spin_unlock_irqrestore+0x44/0x80
  hardirqs last disabled at (690454): [&lt;ffffffff81565372&gt;] _spin_lock_irqsave+0x32/0xa0
  softirqs last  enabled at (690178): [&lt;ffffffff81052282&gt;] __do_softirq+0x202/0x220
  softirqs last disabled at (690157): [&lt;ffffffff8100d50c&gt;] call_softirq+0x1c/0x50

  other info that might help us debug this:
  2 locks held by kswapd0/380:
   #0:  (shrinker_rwsem){++++..}, at: [&lt;ffffffff810d0bd7&gt;] shrink_slab+0x37/0x180
   #1:  (&amp;type-&gt;s_umount_key#17){++++..}, at: [&lt;ffffffff8110cfbf&gt;] shrink_dcache_memory+0x11f/0x1e0

  stack backtrace:
  Pid: 380, comm: kswapd0 Not tainted 2.6.30-rc2-next-20090417 #203
  Call Trace:
   [&lt;ffffffff810789ef&gt;] print_usage_bug+0x19f/0x200
   [&lt;ffffffff81018bff&gt;] ? save_stack_trace+0x2f/0x50
   [&lt;ffffffff81078f0b&gt;] mark_lock+0x4bb/0x6d0
   [&lt;ffffffff810799e0&gt;] ? check_usage_forwards+0x0/0xc0
   [&lt;ffffffff8107b142&gt;] __lock_acquire+0xc62/0x1ae0
   [&lt;ffffffff810f478c&gt;] ? slob_free+0x10c/0x370
   [&lt;ffffffff8107c0a1&gt;] lock_acquire+0xe1/0x120
   [&lt;ffffffff8112f1b5&gt;] ? inotify_inode_is_dead+0x35/0xb0
   [&lt;ffffffff81562d43&gt;] mutex_lock_nested+0x63/0x420
   [&lt;ffffffff8112f1b5&gt;] ? inotify_inode_is_dead+0x35/0xb0
   [&lt;ffffffff8112f1b5&gt;] ? inotify_inode_is_dead+0x35/0xb0
   [&lt;ffffffff81012fe9&gt;] ? sched_clock+0x9/0x10
   [&lt;ffffffff81077165&gt;] ? lock_release_holdtime+0x35/0x1c0
   [&lt;ffffffff8112f1b5&gt;] inotify_inode_is_dead+0x35/0xb0
   [&lt;ffffffff8110c9dc&gt;] dentry_iput+0xbc/0xe0
   [&lt;ffffffff8110cb23&gt;] d_kill+0x33/0x60
   [&lt;ffffffff8110ce23&gt;] __shrink_dcache_sb+0x2d3/0x350
   [&lt;ffffffff8110cffa&gt;] shrink_dcache_memory+0x15a/0x1e0
   [&lt;ffffffff810d0cc5&gt;] shrink_slab+0x125/0x180
   [&lt;ffffffff810d1540&gt;] kswapd+0x560/0x7a0
   [&lt;ffffffff810ce160&gt;] ? isolate_pages_global+0x0/0x2c0
   [&lt;ffffffff81065a30&gt;] ? autoremove_wake_function+0x0/0x40
   [&lt;ffffffff8107953d&gt;] ? trace_hardirqs_on+0xd/0x10
   [&lt;ffffffff810d0fe0&gt;] ? kswapd+0x0/0x7a0
   [&lt;ffffffff8106555b&gt;] kthread+0x5b/0xa0
   [&lt;ffffffff8100d40a&gt;] child_rip+0xa/0x20
   [&lt;ffffffff8100cdd0&gt;] ? restore_args+0x0/0x30
   [&lt;ffffffff81065500&gt;] ? kthread+0x0/0xa0
   [&lt;ffffffff8100d400&gt;] ? child_rip+0x0/0x20

[eparis@redhat.com: fix audit too]
Cc: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Cc: Matt Mackall &lt;mpm@selenic.com&gt;
Cc: Christoph Lameter &lt;clameter@sgi.com&gt;
Signed-off-by: Wu Fengguang &lt;fengguang.wu@intel.com&gt;
Signed-off-by: Eric Paris &lt;eparis@redhat.com&gt;
Cc: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&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>make the e-&gt;rule.xxx shorter in kernel auditfilter.c</title>
<updated>2009-04-05T17:40:33Z</updated>
<author>
<name>Zhenwen Xu</name>
<email>helight.xu@gmail.com</email>
</author>
<published>2009-03-12T14:16:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=c28bb7da74ab74a2860d652493aaff7de104d79e'/>
<id>urn:sha1:c28bb7da74ab74a2860d652493aaff7de104d79e</id>
<content type='text'>
make the e-&gt;rule.xxx shorter in kernel/auditfilter.c
--
---------------------------------
Zhenwen Xu - Open and Free
Home Page:	http://zhwen.org
My Studio:	http://dim4.cn

&gt;From 99692dc640b278f1cb1a15646ce42f22e89c0f77 Mon Sep 17 00:00:00 2001
From: Zhenwen Xu &lt;Helight.Xu@gmail.com&gt;
Date: Thu, 12 Mar 2009 22:04:59 +0800
Subject: [PATCH] make the e-&gt;rule.xxx shorter in kernel/auditfilter.c

Signed-off-by: Zhenwen Xu &lt;Helight.Xu@gmail.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>clean up audit_rule_{add,del} a bit</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:50:28Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=36c4f1b18c8a7d0adb4085e7f531860b837bb6b0'/>
<id>urn:sha1:36c4f1b18c8a7d0adb4085e7f531860b837bb6b0</id>
<content type='text'>
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>fixing audit rule ordering mess, part 1</title>
<updated>2009-01-04T20:14:41Z</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2008-12-15T04:45:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=0590b9335a1c72a3f0defcc6231287f7817e07c8'/>
<id>urn:sha1:0590b9335a1c72a3f0defcc6231287f7817e07c8</id>
<content type='text'>
Problem: ordering between the rules on exit chain is currently lost;
all watch and inode rules are listed after everything else _and_
exit,never on one kind doesn't stop exit,always on another from
being matched.

Solution: assign priorities to rules, keep track of the current
highest-priority matching rule and its result (always/never).

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>audit_update_lsm_rules() misses the audit_inode_hash[] ones</title>
<updated>2009-01-04T20:14:41Z</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2008-12-14T17:04:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=1a9d0797b8977d413435277bf9661efbbd584693'/>
<id>urn:sha1:1a9d0797b8977d413435277bf9661efbbd584693</id>
<content type='text'>
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>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>
</feed>
