<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/kernel/user.c, branch v2.6.37</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.37</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v2.6.37'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2010-12-29T19:31:38Z</updated>
<entry>
<title>fix freeing user_struct in user cache</title>
<updated>2010-12-29T19:31:38Z</updated>
<author>
<name>Hillf Danton</name>
<email>dhillf@gmail.com</email>
</author>
<published>2010-12-29T13:55:28Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=4ef9e11d6867f88951e30db910fa015300e31871'/>
<id>urn:sha1:4ef9e11d6867f88951e30db910fa015300e31871</id>
<content type='text'>
When racing on adding into user cache, the new allocated from mm slab
is freed without putting user namespace.

Since the user namespace is already operated by getting, putting has
to be issued.

Signed-off-by: Hillf Danton &lt;dhillf@gmail.com&gt;
Acked-by: Serge Hallyn &lt;serge@hallyn.com&gt;
Cc: stable@kernel.org
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>kernel/user.c: add lock release annotation on free_user()</title>
<updated>2010-10-26T23:52:15Z</updated>
<author>
<name>Namhyung Kim</name>
<email>namhyung@gmail.com</email>
</author>
<published>2010-10-26T21:22:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=571428be550fbe37160596995e96ad398873fcbd'/>
<id>urn:sha1:571428be550fbe37160596995e96ad398873fcbd</id>
<content type='text'>
free_user() releases uidhash_lock but was missing annotation.  Add it.
This removes following sparse warnings:

 include/linux/spinlock.h:339:9: warning: context imbalance in 'free_user' - unexpected unlock
 kernel/user.c:120:6: warning: context imbalance in 'free_uid' - wrong count at exit

Signed-off-by: Namhyung Kim &lt;namhyung@gmail.com&gt;
Cc: Ingo Molnar &lt;mingo@elte.hu&gt;
Cc: Dhaval Giani &lt;dhaval.giani@gmail.com&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>sched: Remove a stale comment</title>
<updated>2010-05-10T06:48:39Z</updated>
<author>
<name>Li Zefan</name>
<email>lizf@cn.fujitsu.com</email>
</author>
<published>2010-05-10T03:24:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=af507ae8a0512a83728b17d8f8c5fa1561669f50'/>
<id>urn:sha1:af507ae8a0512a83728b17d8f8c5fa1561669f50</id>
<content type='text'>
This comment should have been removed together with uids_mutex
when removing user sched.

Signed-off-by: Li Zefan &lt;lizf@cn.fujitsu.com&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Dhaval Giani &lt;dhaval.giani@gmail.com&gt;
LKML-Reference: &lt;4BE77C6B.5010402@cn.fujitsu.com&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>sched: Remove remaining USER_SCHED code</title>
<updated>2010-04-02T18:12:00Z</updated>
<author>
<name>Li Zefan</name>
<email>lizf@cn.fujitsu.com</email>
</author>
<published>2010-03-24T05:17:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=32bd7eb5a7f4596c8440dd9440322fe9e686634d'/>
<id>urn:sha1:32bd7eb5a7f4596c8440dd9440322fe9e686634d</id>
<content type='text'>
This is left over from commit 7c9414385e ("sched: Remove USER_SCHED"")

Signed-off-by: Li Zefan &lt;lizf@cn.fujitsu.com&gt;
Acked-by: Dhaval Giani &lt;dhaval.giani@gmail.com&gt;
Signed-off-by: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Cc: David Howells &lt;dhowells@redhat.com&gt;
LKML-Reference: &lt;4BA9A05F.7010407@cn.fujitsu.com&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>sched: Remove some dead code</title>
<updated>2010-03-16T10:05:44Z</updated>
<author>
<name>Dan Carpenter</name>
<email>error27@gmail.com</email>
</author>
<published>2010-03-15T08:21:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=6427462bfa50f50dc6c088c07037264fcc73eca1'/>
<id>urn:sha1:6427462bfa50f50dc6c088c07037264fcc73eca1</id>
<content type='text'>
This was left over from "7c9414385e sched: Remove USER_SCHED"

Signed-off-by: Dan Carpenter &lt;error27@gmail.com&gt;
Acked-by: Dhaval Giani &lt;dhaval.giani@gmail.com&gt;
Cc: Kay Sievers &lt;kay.sievers@vrfy.org&gt;
Cc: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
LKML-Reference: &lt;20100315082148.GD18181@bicker&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>sched: Remove USER_SCHED</title>
<updated>2010-01-21T12:40:18Z</updated>
<author>
<name>Dhaval Giani</name>
<email>dhaval.giani@gmail.com</email>
</author>
<published>2010-01-20T12:26:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7c9414385ebfdd87cc542d4e7e3bb0dbb2d3ce25'/>
<id>urn:sha1:7c9414385ebfdd87cc542d4e7e3bb0dbb2d3ce25</id>
<content type='text'>
Remove the USER_SCHED feature. It has been scheduled to be removed in
2.6.34 as per http://marc.info/?l=linux-kernel&amp;m=125728479022976&amp;w=2

Signed-off-by: Dhaval Giani &lt;dhaval.giani@gmail.com&gt;
Signed-off-by: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
LKML-Reference: &lt;1263990378.24844.3.camel@localhost&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>uids: Prevent tear down race</title>
<updated>2009-11-02T15:02:39Z</updated>
<author>
<name>Thomas Gleixner</name>
<email>tglx@linutronix.de</email>
</author>
<published>2009-11-02T12:01:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b00bc0b237055b4c45816325ee14f0bd83e6f590'/>
<id>urn:sha1:b00bc0b237055b4c45816325ee14f0bd83e6f590</id>
<content type='text'>
Ingo triggered the following warning:

WARNING: at lib/debugobjects.c:255 debug_print_object+0x42/0x50()
Hardware name: System Product Name
ODEBUG: init active object type: timer_list
Modules linked in:
Pid: 2619, comm: dmesg Tainted: G        W  2.6.32-rc5-tip+ #5298
Call Trace:
 [&lt;81035443&gt;] warn_slowpath_common+0x6a/0x81
 [&lt;8120e483&gt;] ? debug_print_object+0x42/0x50
 [&lt;81035498&gt;] warn_slowpath_fmt+0x29/0x2c
 [&lt;8120e483&gt;] debug_print_object+0x42/0x50
 [&lt;8120ec2a&gt;] __debug_object_init+0x279/0x2d7
 [&lt;8120ecb3&gt;] debug_object_init+0x13/0x18
 [&lt;810409d2&gt;] init_timer_key+0x17/0x6f
 [&lt;81041526&gt;] free_uid+0x50/0x6c
 [&lt;8104ed2d&gt;] put_cred_rcu+0x61/0x72
 [&lt;81067fac&gt;] rcu_do_batch+0x70/0x121

debugobjects warns about an enqueued timer being initialized. If
CONFIG_USER_SCHED=y the user management code uses delayed work to
remove the user from the hash table and tear down the sysfs objects.

free_uid is called from RCU and initializes/schedules delayed work if
the usage count of the user_struct is 0. The init/schedule happens
outside of the uidhash_lock protected region which allows a concurrent
caller of find_user() to reference the about to be destroyed
user_struct w/o preventing the work from being scheduled. If the next
free_uid call happens before the work timer expired then the active
timer is initialized and the work scheduled again.

The race was introduced in commit 5cb350ba (sched: group scheduling,
sysfs tunables) and made more prominent by commit 3959214f (sched:
delayed cleanup of user_struct)

Move the init/schedule_delayed_work inside of the uidhash_lock
protected region to prevent the race.

Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Acked-by: Dhaval Giani &lt;dhaval@linux.vnet.ibm.com&gt;
Cc: Paul E. McKenney &lt;paulmck@us.ibm.com&gt;
Cc: Kay Sievers &lt;kay.sievers@vrfy.org&gt;
Cc: stable@kernel.org
</content>
</entry>
<entry>
<title>sched: delayed cleanup of user_struct</title>
<updated>2009-06-16T04:30:23Z</updated>
<author>
<name>Kay Sievers</name>
<email>kay.sievers@vrfy.org</email>
</author>
<published>2009-03-24T14:43:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=3959214f971417f4162926ac52ad4cd042958caa'/>
<id>urn:sha1:3959214f971417f4162926ac52ad4cd042958caa</id>
<content type='text'>
During bootup performance tracing we see repeated occurrences of
/sys/kernel/uid/* events for the same uid, leading to a,
in this case, rather pointless userspace processing for the
same uid over and over.

This is usually caused by tools which change their uid to "nobody",
to run without privileges to read data supplied by untrusted users.

This change delays the execution of the (already existing) scheduled
work, to cleanup the uid after one second, so the allocated and announced
uid can possibly be re-used by another process.

This is the current behavior, where almost every invocation of a
binary, which changes the uid, creates two events:
  $ read START &lt; /sys/kernel/uevent_seqnum; \
  for i in `seq 100`; do su --shell=/bin/true bin; done; \
  read END &lt; /sys/kernel/uevent_seqnum; \
  echo $(($END - $START))
  178

With the delayed cleanup, we get only two events, and userspace finishes
a bit faster too:
  $ read START &lt; /sys/kernel/uevent_seqnum; \
  for i in `seq 100`; do su --shell=/bin/true bin; done; \
  read END &lt; /sys/kernel/uevent_seqnum; \
  echo $(($END - $START))
  1

Acked-by: Dhaval Giani &lt;dhaval@linux.vnet.ibm.com&gt;
Signed-off-by: Kay Sievers &lt;kay.sievers@vrfy.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
</entry>
<entry>
<title>Merge branch 'master' into next</title>
<updated>2009-03-23T23:52:46Z</updated>
<author>
<name>James Morris</name>
<email>jmorris@namei.org</email>
</author>
<published>2009-03-23T23:52:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=703a3cd72817e99201cef84a8a7aecc60b2b3581'/>
<id>urn:sha1:703a3cd72817e99201cef84a8a7aecc60b2b3581</id>
<content type='text'>
</content>
</entry>
<entry>
<title>kernel/user.c: fix a memory leak when freeing up non-init usernamespaces users</title>
<updated>2009-03-10T22:55:11Z</updated>
<author>
<name>Dhaval Giani</name>
<email>dhaval@linux.vnet.ibm.com</email>
</author>
<published>2009-03-10T19:55:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=be50b8342dead8cacf57d4839240106b225d31f5'/>
<id>urn:sha1:be50b8342dead8cacf57d4839240106b225d31f5</id>
<content type='text'>
We were returning early in the sysfs directory cleanup function if the
user belonged to a non init usernamespace.  Due to this a lot of the
cleanup was not done and we were left with a leak.  Fix the leak.

Reported-by: Serge Hallyn &lt;serue@linux.vnet.ibm.com&gt;
Signed-off-by: Dhaval Giani &lt;dhaval@linux.vnet.ibm.com&gt;
Acked-by: Serge Hallyn &lt;serue@us.ibm.com&gt;
Tested-by: Serge Hallyn &lt;serue@us.ibm.com&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>
</feed>
