<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/kernel/cgroup.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-12-23T23:58:21Z</updated>
<entry>
<title>cgroups: avoid accessing uninitialized data in failure path</title>
<updated>2008-12-23T23:58:21Z</updated>
<author>
<name>Li Zefan</name>
<email>lizf@cn.fujitsu.com</email>
</author>
<published>2008-12-23T21:57:14Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=20ca9b3f4c6dfa0af8dd5b18a64df17eb994b54d'/>
<id>urn:sha1:20ca9b3f4c6dfa0af8dd5b18a64df17eb994b54d</id>
<content type='text'>
If cgroup_get_rootdir() failed, free_cg_links() will be called in the
failure path, but tmp_cg_links hasn't been initialized at that time.

I introduced this bug in the 2.6.27 merge window.

Signed-off-by: Li Zefan &lt;lizf@cn.fujitsu.com&gt;
Acked-by: Serge Hallyn &lt;serue@us.ibm.com&gt;
Cc: Paul Menage &lt;menage@google.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>cgroups: suppress bogus warning messages</title>
<updated>2008-12-23T23:58:21Z</updated>
<author>
<name>Sharyathi Nagesh</name>
<email>sharyath@in.ibm.com</email>
</author>
<published>2008-12-23T21:57:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e368d3a836797ddf193b1ec18c97407a791d2451'/>
<id>urn:sha1:e368d3a836797ddf193b1ec18c97407a791d2451</id>
<content type='text'>
Remove spurious warning messages that are thrown onto the console during
cgroup operations.

Signed-off-by: Alexey Dobriyan &lt;adobriyan@gmail.com&gt;
Signed-off-by: Sharyathi Nagesh &lt;sharyathi@in.ibm.com&gt;
Acked-by: Serge E. Hallyn &lt;serge@hallyn.com&gt;
Cc: Paul Menage &lt;menage@google.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>cgroups: fix a race between rmdir and remount</title>
<updated>2008-12-16T00:27:07Z</updated>
<author>
<name>Paul Menage</name>
<email>menage@google.com</email>
</author>
<published>2008-12-15T21:54:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=307257cf475aac25db30b669987f13d90c934e3a'/>
<id>urn:sha1:307257cf475aac25db30b669987f13d90c934e3a</id>
<content type='text'>
When a cgroup is removed, it's unlinked from its parent's children list,
but not actually freed until the last dentry on it is released (at which
point cgrp-&gt;root-&gt;number_of_cgroups is decremented).

Currently rebind_subsystems checks for the top cgroup's child list being
empty in order to rebind subsystems into or out of a hierarchy - this can
result in the set of subsystems bound to a hierarchy being
removed-but-not-freed cgroup.

The simplest fix for this is to forbid remounts that change the set of
subsystems on a hierarchy that has removed-but-not-freed cgroups.  This
bug can be reproduced via:

mkdir /mnt/cg
mount -t cgroup -o ns,freezer cgroup /mnt/cg
mkdir /mnt/cg/foo
sleep 1h &lt; /mnt/cg/foo &amp;
rmdir /mnt/cg/foo
mount -t cgroup -o remount,ns,devices,freezer cgroup /mnt/cg
kill $!

Though the above will cause oops in -mm only but not mainline, but the bug
can cause memory leak in mainline (and even oops)

Signed-off-by: Paul Menage &lt;menage@google.com&gt;
Reviewed-by: Li Zefan &lt;lizf@cn.fujitsu.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>cgroups: fix a serious bug in cgroupstats</title>
<updated>2008-11-20T02:50:00Z</updated>
<author>
<name>Li Zefan</name>
<email>lizf@cn.fujitsu.com</email>
</author>
<published>2008-11-19T23:36:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=33d283bef23132c48195eafc21449f8ba88fce6b'/>
<id>urn:sha1:33d283bef23132c48195eafc21449f8ba88fce6b</id>
<content type='text'>
Try this, and you'll get oops immediately:
 # cd Documentation/accounting/
 # gcc -o getdelays getdelays.c
 # mount -t cgroup -o debug xxx /mnt
 # ./getdelays -C /mnt/tasks

Because a normal file's dentry-&gt;d_fsdata is a pointer to struct cftype,
not struct cgroup.

After the patch, it returns EINVAL if we try to get cgroupstats
from a normal file.

Cc: Balbir Singh &lt;balbir@linux.vnet.ibm.com&gt;
Signed-off-by: Li Zefan &lt;lizf@cn.fujitsu.com&gt;
Acked-by: Paul Menage &lt;menage@google.com&gt;
Cc: &lt;stable@kernel.org&gt;		[2.6.25.x, 2.6.26.x, 2.6.27.x]
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>cgroup: fix potential deadlock in pre_destroy</title>
<updated>2008-11-20T02:49:58Z</updated>
<author>
<name>KAMEZAWA Hiroyuki</name>
<email>kamezawa.hiroyu@jp.fujitsu.com</email>
</author>
<published>2008-11-19T23:36:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=3fa59dfbc3b223f02c26593be69ce6fc9a940405'/>
<id>urn:sha1:3fa59dfbc3b223f02c26593be69ce6fc9a940405</id>
<content type='text'>
As Balbir pointed out, memcg's pre_destroy handler has potential deadlock.

It has following lock sequence.

	cgroup_mutex (cgroup_rmdir)
	    -&gt; pre_destroy -&gt; mem_cgroup_pre_destroy-&gt; force_empty
		-&gt; cpu_hotplug.lock. (lru_add_drain_all-&gt;
				      schedule_work-&gt;
                                      get_online_cpus)

But, cpuset has following.
	cpu_hotplug.lock (call notifier)
		-&gt; cgroup_mutex. (within notifier)

Then, this lock sequence should be fixed.

Considering how pre_destroy works, it's not necessary to holding
cgroup_mutex() while calling it.

As a side effect, we don't have to wait at this mutex while memcg's
force_empty works.(it can be long when there are tons of pages.)

Signed-off-by: KAMEZAWA Hiroyuki &lt;kamezawa.hiroyu@jp.fujitsu.com&gt;
Acked-by: Balbir Singh &lt;balbir@linux.vnet.ibm.com&gt;
Cc: Li Zefan &lt;lizf@cn.fujitsu.com&gt;
Cc: Paul Menage &lt;menage@google.com&gt;
Cc: Daisuke Nishimura &lt;nishimura@mxp.nes.nec.co.jp&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>cgroups: fix invalid cgrp-&gt;dentry before cgroup has been completely removed</title>
<updated>2008-11-06T23:41:19Z</updated>
<author>
<name>Li Zefan</name>
<email>lizf@cn.fujitsu.com</email>
</author>
<published>2008-11-06T20:53:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=24eb089950ce44603b30a3145a2c8520e2b55bb1'/>
<id>urn:sha1:24eb089950ce44603b30a3145a2c8520e2b55bb1</id>
<content type='text'>
This fixes an oops when reading /proc/sched_debug.

A cgroup won't be removed completely until finishing cgroup_diput(), so we
shouldn't invalidate cgrp-&gt;dentry in cgroup_rmdir().  Otherwise, when a
group is being removed while cgroup_path() gets called, we may trigger
NULL dereference BUG.

The bug can be reproduced:

 # cat test.sh
 #!/bin/sh
 mount -t cgroup -o cpu xxx /mnt
 for (( ; ; ))
 {
	mkdir /mnt/sub
	rmdir /mnt/sub
 }
 # ./test.sh &amp;
 # cat /proc/sched_debug

BUG: unable to handle kernel NULL pointer dereference at 00000038
IP: [&lt;c045a47f&gt;] cgroup_path+0x39/0x90
...
Call Trace:
 [&lt;c0420344&gt;] ? print_cfs_rq+0x6e/0x75d
 [&lt;c0421160&gt;] ? sched_debug_show+0x72d/0xc1e
...

Signed-off-by: Li Zefan &lt;lizf@cn.fujitsu.com&gt;
Acked-by: Paul Menage &lt;menage@google.com&gt;
Cc: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Cc: Ingo Molnar &lt;mingo@elte.hu&gt;
Cc: &lt;stable@kernel.org&gt;		[2.6.26.x, 2.6.27.x]
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>cgroup: remove unused variable</title>
<updated>2008-10-26T16:38:17Z</updated>
<author>
<name>Stephen Rothwell</name>
<email>sfr@canb.auug.org.au</email>
</author>
<published>2008-10-21T05:11:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=2077776641b6ffb0049f13018d2e162340ec51c7'/>
<id>urn:sha1:2077776641b6ffb0049f13018d2e162340ec51c7</id>
<content type='text'>
/scratch/sfr/next/kernel/cgroup.c: In function 'cgroup_tasks_start':
/scratch/sfr/next/kernel/cgroup.c:2107: warning: unused variable 'i'

Introduced in commit cc31edceee04a7b87f2be48f9489ebb72d264844 "cgroups:
convert tasks file to use a seq_file with shared pid array".

Signed-off-by: Stephen Rothwell &lt;sfr@canb.auug.org.au&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>cgroups: convert tasks file to use a seq_file with shared pid array</title>
<updated>2008-10-20T15:52:38Z</updated>
<author>
<name>Paul Menage</name>
<email>menage@google.com</email>
</author>
<published>2008-10-19T03:28:04Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=cc31edceee04a7b87f2be48f9489ebb72d264844'/>
<id>urn:sha1:cc31edceee04a7b87f2be48f9489ebb72d264844</id>
<content type='text'>
Rather than pre-generating the entire text for the "tasks" file each
time the file is opened, we instead just generate/update the array of
process ids and use a seq_file to report these to userspace.  All open
file handles on the same "tasks" file can share a pid array, which may
be updated any time that no thread is actively reading the array.  By
sharing the array, the potential for userspace to DoS the system by
opening many handles on the same "tasks" file is removed.

[Based on a patch by Lai Jiangshan, extended to use seq_file]

Signed-off-by: Paul Menage &lt;menage@google.com&gt;
Reviewed-by: Lai Jiangshan &lt;laijs@cn.fujitsu.com&gt;
Cc: Serge Hallyn &lt;serue@us.ibm.com&gt;
Cc: Balbir Singh &lt;balbir@in.ibm.com&gt;
Cc: KAMEZAWA Hiroyuki &lt;kamezawa.hiroyu@jp.fujitsu.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>cgroups: fix probable race with put_css_set[_taskexit] and find_css_set</title>
<updated>2008-10-20T15:52:38Z</updated>
<author>
<name>Lai Jiangshan</name>
<email>laijs@cn.fujitsu.com</email>
</author>
<published>2008-10-19T03:28:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=146aa1bd0511f88ddb4e92fafa2b8aad4f2f65f3'/>
<id>urn:sha1:146aa1bd0511f88ddb4e92fafa2b8aad4f2f65f3</id>
<content type='text'>
put_css_set_taskexit may be called when find_css_set is called on other
cpu.  And the race will occur:

put_css_set_taskexit side                    find_css_set side

                                        |
atomic_dec_and_test(&amp;kref-&gt;refcount)    |
    /* kref-&gt;refcount = 0 */            |
....................................................................
                                        |  read_lock(&amp;css_set_lock)
                                        |  find_existing_css_set
                                        |  get_css_set
                                        |  read_unlock(&amp;css_set_lock);
....................................................................
__release_css_set                       |
....................................................................
                                        | /* use a released css_set */
                                        |

[put_css_set is the same. But in the current code, all put_css_set are
put into cgroup mutex critical region as the same as find_css_set.]

[akpm@linux-foundation.org: repair comments]
[menage@google.com: eliminate race in css_set refcounting]
Signed-off-by: Lai Jiangshan &lt;laijs@cn.fujitsu.com&gt;
Cc: Balbir Singh &lt;balbir@in.ibm.com&gt;
Cc: KAMEZAWA Hiroyuki &lt;kamezawa.hiroyu@jp.fujitsu.com&gt;
Signed-off-by: Paul Menage &lt;menage@google.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>memrlimit: cgroup mm owner callback changes to add task info</title>
<updated>2008-10-16T18:21:28Z</updated>
<author>
<name>Balbir Singh</name>
<email>balbir@linux.vnet.ibm.com</email>
</author>
<published>2008-10-16T05:01:05Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=9363b9f23c9cc36cc8ef6c05fdf879ee4a96ae92'/>
<id>urn:sha1:9363b9f23c9cc36cc8ef6c05fdf879ee4a96ae92</id>
<content type='text'>
This patch adds an additional field to the mm_owner callbacks. This field
is required to get to the mm that changed. Hold mmap_sem in write mode
before calling the mm_owner_changed callback

[hugh@veritas.com: fix mmap_sem deadlock]
Signed-off-by: Balbir Singh &lt;balbir@linux.vnet.ibm.com&gt;
Cc: Sudhir Kumar &lt;skumar@linux.vnet.ibm.com&gt;
Cc: YAMAMOTO Takashi &lt;yamamoto@valinux.co.jp&gt;
Cc: Paul Menage &lt;menage@google.com&gt;
Cc: Li Zefan &lt;lizf@cn.fujitsu.com&gt;
Cc: Pavel Emelianov &lt;xemul@openvz.org&gt;
Cc: Balbir Singh &lt;balbir@linux.vnet.ibm.com&gt;
Cc: KAMEZAWA Hiroyuki &lt;kamezawa.hiroyu@jp.fujitsu.com&gt;
Cc: David Rientjes &lt;rientjes@google.com&gt;
Cc: Vivek Goyal &lt;vgoyal@redhat.com&gt;
Signed-off-by: Hugh Dickins &lt;hugh@veritas.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>
