<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/fs/proc, branch v2.6.35</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.35</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v2.6.35'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2010-07-29T22:16:17Z</updated>
<entry>
<title>CRED: Fix get_task_cred() and task_state() to not resurrect dead credentials</title>
<updated>2010-07-29T22:16:17Z</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2010-07-29T11:45:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=de09a9771a5346029f4d11e4ac886be7f9bfdd75'/>
<id>urn:sha1:de09a9771a5346029f4d11e4ac886be7f9bfdd75</id>
<content type='text'>
It's possible for get_task_cred() as it currently stands to 'corrupt' a set of
credentials by incrementing their usage count after their replacement by the
task being accessed.

What happens is that get_task_cred() can race with commit_creds():

	TASK_1			TASK_2			RCU_CLEANER
	--&gt;get_task_cred(TASK_2)
	rcu_read_lock()
	__cred = __task_cred(TASK_2)
				--&gt;commit_creds()
				old_cred = TASK_2-&gt;real_cred
				TASK_2-&gt;real_cred = ...
				put_cred(old_cred)
				  call_rcu(old_cred)
		[__cred-&gt;usage == 0]
	get_cred(__cred)
		[__cred-&gt;usage == 1]
	rcu_read_unlock()
							--&gt;put_cred_rcu()
							[__cred-&gt;usage == 1]
							panic()

However, since a tasks credentials are generally not changed very often, we can
reasonably make use of a loop involving reading the creds pointer and using
atomic_inc_not_zero() to attempt to increment it if it hasn't already hit zero.

If successful, we can safely return the credentials in the knowledge that, even
if the task we're accessing has released them, they haven't gone to the RCU
cleanup code.

We then change task_state() in procfs to use get_task_cred() rather than
calling get_cred() on the result of __task_cred(), as that suffers from the
same problem.

Without this change, a BUG_ON in __put_cred() or in put_cred_rcu() can be
tripped when it is noticed that the usage count is not zero as it ought to be,
for example:

kernel BUG at kernel/cred.c:168!
invalid opcode: 0000 [#1] SMP
last sysfs file: /sys/kernel/mm/ksm/run
CPU 0
Pid: 2436, comm: master Not tainted 2.6.33.3-85.fc13.x86_64 #1 0HR330/OptiPlex
745
RIP: 0010:[&lt;ffffffff81069881&gt;]  [&lt;ffffffff81069881&gt;] __put_cred+0xc/0x45
RSP: 0018:ffff88019e7e9eb8  EFLAGS: 00010202
RAX: 0000000000000001 RBX: ffff880161514480 RCX: 00000000ffffffff
RDX: 00000000ffffffff RSI: ffff880140c690c0 RDI: ffff880140c690c0
RBP: ffff88019e7e9eb8 R08: 00000000000000d0 R09: 0000000000000000
R10: 0000000000000001 R11: 0000000000000040 R12: ffff880140c690c0
R13: ffff88019e77aea0 R14: 00007fff336b0a5c R15: 0000000000000001
FS:  00007f12f50d97c0(0000) GS:ffff880007400000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f8f461bc000 CR3: 00000001b26ce000 CR4: 00000000000006f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Process master (pid: 2436, threadinfo ffff88019e7e8000, task ffff88019e77aea0)
Stack:
 ffff88019e7e9ec8 ffffffff810698cd ffff88019e7e9ef8 ffffffff81069b45
&lt;0&gt; ffff880161514180 ffff880161514480 ffff880161514180 0000000000000000
&lt;0&gt; ffff88019e7e9f28 ffffffff8106aace 0000000000000001 0000000000000246
Call Trace:
 [&lt;ffffffff810698cd&gt;] put_cred+0x13/0x15
 [&lt;ffffffff81069b45&gt;] commit_creds+0x16b/0x175
 [&lt;ffffffff8106aace&gt;] set_current_groups+0x47/0x4e
 [&lt;ffffffff8106ac89&gt;] sys_setgroups+0xf6/0x105
 [&lt;ffffffff81009b02&gt;] system_call_fastpath+0x16/0x1b
Code: 48 8d 71 ff e8 7e 4e 15 00 85 c0 78 0b 8b 75 ec 48 89 df e8 ef 4a 15 00
48 83 c4 18 5b c9 c3 55 8b 07 8b 07 48 89 e5 85 c0 74 04 &lt;0f&gt; 0b eb fe 65 48 8b
04 25 00 cc 00 00 48 3b b8 58 04 00 00 75
RIP  [&lt;ffffffff81069881&gt;] __put_cred+0xc/0x45
 RSP &lt;ffff88019e7e9eb8&gt;
---[ end trace df391256a100ebdd ]---

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Acked-by: Jiri Olsa &lt;jolsa@redhat.com&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>nommu: add '[stack]' label to /proc/pid/maps output</title>
<updated>2010-06-29T22:29:30Z</updated>
<author>
<name>Mike Frysinger</name>
<email>vapier@gentoo.org</email>
</author>
<published>2010-06-29T22:05:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=3c26c9d9597f982973b9b3a32364230096ab0d78'/>
<id>urn:sha1:3c26c9d9597f982973b9b3a32364230096ab0d78</id>
<content type='text'>
Add support to the NOMMU /proc/pid/maps file to show which mapping is the stack
of the original thread after execve.  This is largely based on the MMU code.
Subsidiary thread stacks are not indicated.

For FDPIC, we now get:

	root:/&gt; cat /proc/self/maps
	02064000-02067ccc rw-p 0004d000 00:01 22         /bin/busybox
	0206e000-0206f35c rw-p 00006000 00:01 295        /lib/ld-uClibc.so.0
	025f0000-025f6f0c r-xs 00000000 00:01 295        /lib/ld-uClibc.so.0
	02680000-026ba6b0 r-xs 00000000 00:01 297        /lib/libc.so.0
	02700000-0274d384 r-xs 00000000 00:01 22         /bin/busybox
	02816000-02817000 rw-p 00000000 00:00 0
	02848000-0284c0d8 rw-p 00000000 00:00 0
	02860000-02880000 rw-p 00000000 00:00 0          [stack]

The semi-downside here is that for FLAT, we get:

	root:/&gt; cat /proc/155/maps
	029f0000-029f9000 rwxp 00000000 00:00 0          [stack]

The reason being that FLAT combines a whole lot of stuff into one map
(including the stack).  But this isn't any worse than the current output
(which is nothing), so screw it.

Signed-off-by: Mike Frysinger &lt;vapier@gentoo.org&gt;
Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Cc: Greg Ungerer &lt;gerg@snapgear.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>of: Drop properties with "/" in their name</title>
<updated>2010-06-14T00:12:24Z</updated>
<author>
<name>Michael Ellerman</name>
<email>michael@ellerman.id.au</email>
</author>
<published>2010-05-19T02:32:29Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=9f069af5b62919151d76b37a3b168cbb34c874c3'/>
<id>urn:sha1:9f069af5b62919151d76b37a3b168cbb34c874c3</id>
<content type='text'>
Some bogus firmwares include properties with "/" in their name. This
causes problems when creating the /proc/device-tree file system,
because the slash is taken to indicate a directory.

We don't care about those properties, and we don't want to encourage
them, so just throw them away when creating /proc/device-tree.

Signed-off-by: Michael Ellerman &lt;michael@ellerman.id.au&gt;
Tested-by: Christian Kujau &lt;lists@nerdbynature.de&gt;
Signed-off-by: Grant Likely &lt;grant.likely@secretlab.ca&gt;
</content>
</entry>
<entry>
<title>kcore: add _text to KCORE_TEXT</title>
<updated>2010-05-27T16:12:47Z</updated>
<author>
<name>Wu Fengguang</name>
<email>fengguang.wu@intel.com</email>
</author>
<published>2010-05-26T21:43:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=36e15263aa5dcf3b72f1f88437e69497782b7ab8'/>
<id>urn:sha1:36e15263aa5dcf3b72f1f88437e69497782b7ab8</id>
<content type='text'>
Extend KCORE_TEXT to cover the pages between _text and _stext, to allow
examining some important page table pages.

`readelf -a` output on x86_64 before and after patch:
	  Type           Offset             VirtAddr           PhysAddr
before    LOAD           0x00007fff8100c000 0xffffffff81009000 0x0000000000000000
after     LOAD           0x00007fff81003000 0xffffffff81000000 0x0000000000000000

The newly covered pages are:

	0xffffffff81000000 &lt;startup_64&gt; etc.
	0xffffffff81001000 &lt;init_level4_pgt&gt;
	0xffffffff81002000 &lt;level3_ident_pgt&gt;
	0xffffffff81003000 &lt;level3_kernel_pgt&gt;
	0xffffffff81004000 &lt;level2_fixmap_pgt&gt;
	0xffffffff81005000 &lt;level1_fixmap_pgt&gt;
	0xffffffff81006000 &lt;level2_ident_pgt&gt;
	0xffffffff81007000 &lt;level2_kernel_pgt&gt;
	0xffffffff81008000 &lt;level2_spare_pgt&gt;

Before patch, /proc/kcore shows outdated contents for the above page
table pages, for example:

	(gdb) p level3_ident_pgt
	$1 = {&lt;text variable, no debug info&gt;} 0xffffffff81002000 &lt;level3_ident_pgt&gt;
	(gdb) p/x *((pud_t *)&amp;level3_ident_pgt)@512
	$2 = {{pud = 0x1006063}, {pud = 0x0} &lt;repeats 511 times&gt;}

while the real content is:

	root@hp /home/wfg# hexdump -s 0x1002000 -n 4096 /dev/mem
	1002000 6063 0100 0000 0000 8067 0000 0000 0000
	1002010 0000 0000 0000 0000 0000 0000 0000 0000
	*
	1003000

That is, on a x86_64 box with 2GB memory, we can see first-1GB / full-2GB
identity mapping before/after patch:

	(gdb) p/x *((pud_t *)&amp;level3_ident_pgt)@512
before  $1 = {{pud = 0x1006063}, {pud = 0x0} &lt;repeats 511 times&gt;}
after   $1 = {{pud = 0x1006063}, {pud = 0x8067}, {pud = 0x0} &lt;repeats 510 times&gt;}

Obviously the content before patch is wrong.

Signed-off-by: Wu Fengguang &lt;fengguang.wu@intel.com&gt;
Cc: Andi Kleen &lt;andi@firstfloor.org&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>proc: remove obsolete comments</title>
<updated>2010-05-27T16:12:47Z</updated>
<author>
<name>Amerigo Wang</name>
<email>amwang@redhat.com</email>
</author>
<published>2010-05-26T21:43:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=57f87869f073929f8e8b3c73748aabb0cece19aa'/>
<id>urn:sha1:57f87869f073929f8e8b3c73748aabb0cece19aa</id>
<content type='text'>
A quick test shows these comments are obsolete, so just remove them.

Signed-off-by: WANG Cong &lt;amwang@redhat.com&gt;
Cc: Alexey Dobriyan &lt;adobriyan@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>proc: cleanup: remove unused assignments</title>
<updated>2010-05-27T16:12:47Z</updated>
<author>
<name>Dan Carpenter</name>
<email>error27@gmail.com</email>
</author>
<published>2010-05-26T21:43:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=73d3646029138743989b6c213628484301a72eb1'/>
<id>urn:sha1:73d3646029138743989b6c213628484301a72eb1</id>
<content type='text'>
I removed 3 unused assignments.  The first two get reset on the first
statement of their functions.  For "err" in root.c we don't return an
error and we don't use the variable again.

Signed-off-by: Dan Carpenter &lt;error27@gmail.com&gt;
Cc: Oleg Nesterov &lt;oleg@redhat.com&gt;
Acked-by: Serge Hallyn &lt;serue@us.ibm.com&gt;
Reviewed-by: KOSAKI Motohiro &lt;kosaki.motohiro@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>proc: get_nr_threads() doesn't need -&gt;siglock any longer</title>
<updated>2010-05-27T16:12:47Z</updated>
<author>
<name>Oleg Nesterov</name>
<email>oleg@redhat.com</email>
</author>
<published>2010-05-26T21:43:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7e49827cc937a742ae02078b483e3eb78f791a2a'/>
<id>urn:sha1:7e49827cc937a742ae02078b483e3eb78f791a2a</id>
<content type='text'>
Now that task-&gt;signal can't go away get_nr_threads() doesn't need
-&gt;siglock to read signal-&gt;count.

Also, make it inline, move into sched.h, and convert 2 other proc users of
signal-&gt;count to use this (now trivial) helper.

Henceforth get_nr_threads() is the only valid user of signal-&gt;count, we
are ready to turn it into "int nr_threads" or, perhaps, kill it.

Signed-off-by: Oleg Nesterov &lt;oleg@redhat.com&gt;
Cc: Alexey Dobriyan &lt;adobriyan@gmail.com&gt;
Cc: David Howells &lt;dhowells@redhat.com&gt;
Cc: "Eric W. Biederman" &lt;ebiederm@xmission.com&gt;
Acked-by: Roland McGrath &lt;roland@redhat.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>pagemap: add #ifdefs CONFIG_HUGETLB_PAGE on code walking hugetlb vma</title>
<updated>2010-05-25T15:06:58Z</updated>
<author>
<name>Naoya Horiguchi</name>
<email>n-horiguchi@ah.jp.nec.com</email>
</author>
<published>2010-05-24T21:32:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=1a5cb81465b66b74bf3d6ad36e5382238de6a132'/>
<id>urn:sha1:1a5cb81465b66b74bf3d6ad36e5382238de6a132</id>
<content type='text'>
If !CONFIG_HUGETLB_PAGE, pagemap_hugetlb_range() is never called.  So put
it (and its calling function) into #ifdef block.

Signed-off-by: Naoya Horiguchi &lt;n-horiguchi@ah.jp.nec.com&gt;
Acked-by: Matt Mackall &lt;mpm@selenic.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>Merge branch 'bkl/procfs' of git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing</title>
<updated>2010-05-20T00:23:28Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2010-05-20T00:23:28Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=98c89cdd3a292af3451e47a2a33132f5183861b0'/>
<id>urn:sha1:98c89cdd3a292af3451e47a2a33132f5183861b0</id>
<content type='text'>
* 'bkl/procfs' of git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing:
  sunrpc: Include missing smp_lock.h
  procfs: Kill the bkl in ioctl
  procfs: Push down the bkl from ioctl
  procfs: Use generic_file_llseek in /proc/vmcore
  procfs: Use generic_file_llseek in /proc/kmsg
  procfs: Use generic_file_llseek in /proc/kcore
  procfs: Kill BKL in llseek on proc base
</content>
</entry>
<entry>
<title>procfs: Kill the bkl in ioctl</title>
<updated>2010-05-17T01:06:24Z</updated>
<author>
<name>Frederic Weisbecker</name>
<email>fweisbec@gmail.com</email>
</author>
<published>2010-03-30T05:32:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=c2f980500a81006173daf3048284b28832858616'/>
<id>urn:sha1:c2f980500a81006173daf3048284b28832858616</id>
<content type='text'>
There are no more users of procfs that implement the ioctl
callback. Drop the bkl from this path and warn on any use
of this callback.

Signed-off-by: Frederic Weisbecker &lt;fweisbec@gmail.com&gt;
Cc: Arnd Bergmann &lt;arnd@arndb.de&gt;
Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Cc: Ingo Molnar &lt;mingo@elte.hu&gt;
Cc: John Kacur &lt;jkacur@redhat.com&gt;
Cc: KAMEZAWA Hiroyuki &lt;kamezawa.hiroyu@jp.fujitsu.com&gt;
Cc: Al Viro &lt;viro@ZenIV.linux.org.uk&gt;
</content>
</entry>
</feed>
