https://github.com/torvalds/linux
Revision 8d6c83f0ba5e1bd1e8bb2e3c7de4c276dc247f99 authored by KOSAKI Motohiro on 19 August 2010, 21:13:39 UTC, committed by Linus Torvalds on 20 August 2010, 16:34:55 UTC
dump_tasks() needs to hold the RCU read lock around its access of the
target task's UID.  To this end it should use task_uid() as it only needs
that one thing from the creds.

The fact that dump_tasks() holds tasklist_lock is insufficient to prevent the
target process replacing its credentials on another CPU.

Then, this patch change to call rcu_read_lock() explicitly.

	===================================================
	[ INFO: suspicious rcu_dereference_check() usage. ]
	---------------------------------------------------
	mm/oom_kill.c:410 invoked rcu_dereference_check() without protection!

	other info that might help us debug this:

	rcu_scheduler_active = 1, debug_locks = 1
	4 locks held by kworker/1:2/651:
	 #0:  (events){+.+.+.}, at: [<ffffffff8106aae7>]
	process_one_work+0x137/0x4a0
	 #1:  (moom_work){+.+...}, at: [<ffffffff8106aae7>]
	process_one_work+0x137/0x4a0
	 #2:  (tasklist_lock){.+.+..}, at: [<ffffffff810fafd4>]
	out_of_memory+0x164/0x3f0
	 #3:  (&(&p->alloc_lock)->rlock){+.+...}, at: [<ffffffff810fa48e>]
	find_lock_task_mm+0x2e/0x70

Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Acked-by: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent b52723c
History
Tip revision: 8d6c83f0ba5e1bd1e8bb2e3c7de4c276dc247f99 authored by KOSAKI Motohiro on 19 August 2010, 21:13:39 UTC
oom: __task_cred() need rcu_read_lock()
Tip revision: 8d6c83f
File Mode Size
aoe
drbd
paride
DAC960.c -rw-r--r-- 259.6 KB
DAC960.h -rw-r--r-- 148.2 KB
Kconfig -rw-r--r-- 17.1 KB
Makefile -rw-r--r-- 1.3 KB
amiflop.c -rw-r--r-- 46.1 KB
ataflop.c -rw-r--r-- 51.3 KB
brd.c -rw-r--r-- 14.9 KB
cciss.c -rw-r--r-- 138.3 KB
cciss.h -rw-r--r-- 10.5 KB
cciss_cmd.h -rw-r--r-- 6.9 KB
cciss_scsi.c -rw-r--r-- 47.9 KB
cciss_scsi.h -rw-r--r-- 3.1 KB
cpqarray.c -rw-r--r-- 47.0 KB
cpqarray.h -rw-r--r-- 3.0 KB
cryptoloop.c -rw-r--r-- 4.9 KB
floppy.c -rw-r--r-- 116.4 KB
hd.c -rw-r--r-- 18.9 KB
ida_cmd.h -rw-r--r-- 6.8 KB
ida_ioctl.h -rw-r--r-- 2.6 KB
loop.c -rw-r--r-- 40.7 KB
mg_disk.c -rw-r--r-- 26.0 KB
nbd.c -rw-r--r-- 20.1 KB
osdblk.c -rw-r--r-- 15.7 KB
pktcdvd.c -rw-r--r-- 76.3 KB
ps3disk.c -rw-r--r-- 13.9 KB
ps3vram.c -rw-r--r-- 22.0 KB
smart1,2.h -rw-r--r-- 7.1 KB
sunvdc.c -rw-r--r-- 19.1 KB
swim.c -rw-r--r-- 19.8 KB
swim3.c -rw-r--r-- 29.5 KB
swim_asm.S -rw-r--r-- 4.6 KB
sx8.c -rw-r--r-- 39.8 KB
ub.c -rw-r--r-- 62.0 KB
umem.c -rw-r--r-- 30.0 KB
umem.h -rw-r--r-- 3.6 KB
viodasd.c -rw-r--r-- 21.4 KB
virtio_blk.c -rw-r--r-- 14.4 KB
xd.c -rw-r--r-- 34.0 KB
xd.h -rw-r--r-- 5.7 KB
xen-blkfront.c -rw-r--r-- 31.3 KB
xsysace.c -rw-r--r-- 34.2 KB
z2ram.c -rw-r--r-- 9.0 KB

back to top