Tejun Heo
40ae717d1e
ptrace: fix signal->wait_chldexit usage in task_clear_group_stop_trapping()
GROUP_STOP_TRAPPING waiting mechanism piggybacks on
signal->wait_chldexit which is primarily used to implement waiting for
wait(2) and friends. When do_wait() waits on signal->wait_chldexit,
it uses a custom wake up callback, child_wait_callback(), which
expects the child task which is waking up the parent to be passed in
as @key to filter out spurious wakeups.
task_clear_group_stop_trapping() used __wake_up_sync() which uses NULL
@key causing the following oops if the parent was doing do_wait().
BUG: unable to handle kernel NULL pointer dereference at 00000000000002d8
IP: [<ffffffff810499f9>] child_wait_callback+0x29/0x80
PGD 1d899067 PUD 1e418067 PMD 0
Oops: 0000 [#1] PREEMPT SMP
last sysfs file: /sys/devices/pci0000:00/0000:00:03.0/local_cpus
CPU 2
Modules linked in:
Pid: 4498, comm: test-continued Not tainted 2.6.39-rc6-work+ #32 Bochs Bochs
RIP: 0010:[<ffffffff810499f9>] [<ffffffff810499f9>] child_wait_callback+0x29/0x80
RSP: 0000:ffff88001b889bf8 EFLAGS: 00010046
RAX: 0000000000000000 RBX: ffff88001fab3af8 RCX: 0000000000000000
RDX: 0000000000000001 RSI: 0000000000000002 RDI: ffff88001d91df20
RBP: ffff88001b889c08 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000000
R13: ffff88001fb70550 R14: 0000000000000000 R15: 0000000000000001
FS: 00007f26ccae4700(0000) GS:ffff88001fd00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: 00000000000002d8 CR3: 000000001b8ac000 CR4: 00000000000006e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Process test-continued (pid: 4498, threadinfo ffff88001b888000, task ffff88001fb88000)
Stack:
ffff88001b889c18 ffff88001fb70538 ffff88001b889c58 ffffffff810312f9
0000000000000001 0000000200000001 ffff88001b889c58 ffff88001fb70518
0000000000000002 0000000000000082 0000000000000001 0000000000000000
Call Trace:
[<ffffffff810312f9>] __wake_up_common+0x59/0x90
[<ffffffff81035263>] __wake_up_sync_key+0x53/0x80
[<ffffffff810352a0>] __wake_up_sync+0x10/0x20
[<ffffffff8105a984>] task_clear_jobctl_trapping+0x44/0x50
[<ffffffff8105bcbc>] ptrace_stop+0x7c/0x290
[<ffffffff8105c20a>] do_signal_stop+0x28a/0x2d0
[<ffffffff8105d27f>] get_signal_to_deliver+0x14f/0x5a0
[<ffffffff81002175>] do_signal+0x75/0x7b0
[<ffffffff8100292d>] do_notify_resume+0x5d/0x70
[<ffffffff8182e36a>] retint_signal+0x46/0x8c
Code: 00 00 55 48 89 e5 53 48 83 ec 08 0f 1f 44 00 00 8b 47 d8 83 f8 03 74 3a 85 c0 49 89 c8 75 23 89 c0 48 8b 5f e0 4c 8d 0c 40 31 c0 <4b> 39 9c c8 d8 02 00 00 74 1d 48 83 c4 08 5b c9 c3 66 0f 1f 44
Fix it by using __wake_up_sync_key() and passing in the child as @key.
I still think it's a mistake to piggyback on wait_chldexit for this.
Given the relative low frequency of ptrace use, we would be much
better off leaving already complex wait_chldexit alone and using bit
waitqueue.
Signed-off-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Oleg Nesterov <oleg@redhat.com>
2011-05-09 14:19:54 +02:00
..
2011-03-25 21:04:56 -07:00
2011-03-20 18:14:55 -07:00
2011-03-30 14:13:23 +02:00
2011-03-24 10:16:26 -07:00
2011-04-04 08:31:23 -07:00
2011-03-25 17:53:09 -07:00
2010-08-09 16:48:42 -04:00
2010-07-14 11:29:46 +02:00
2010-10-30 02:18:32 -04:00
2011-03-14 09:15:23 -04:00
2011-03-03 10:55:40 -08:00
2010-10-30 01:42:19 -04:00
2011-03-03 10:55:40 -08:00
2010-10-30 08:45:43 -04:00
2011-03-23 19:46:28 -07:00
2011-03-23 19:47:06 -07:00
2010-10-27 18:03:08 -07:00
2011-03-22 17:43:58 -07:00
2011-04-28 13:01:38 +02:00
2010-10-15 15:53:27 +02:00
2011-03-22 17:44:11 -07:00
2011-03-23 19:46:35 -07:00
2011-03-23 19:47:19 -07:00
2011-03-23 19:47:02 -07:00
2009-09-18 09:48:52 -07:00
2010-03-06 11:26:46 -08:00
2010-08-09 20:45:05 -07:00
2011-04-07 20:44:11 +02:00
2011-03-24 10:16:26 -07:00
2010-12-24 15:02:40 +01:00
2011-03-23 19:47:08 -07:00
2011-03-25 17:52:22 -07:00
2011-03-23 19:47:08 -07:00
2011-03-15 18:53:35 -07:00
2010-08-17 09:11:52 +02:00
2010-12-16 11:36:43 +01:00
2010-12-18 15:54:48 +01:00
2009-11-18 16:32:12 +01:00
2010-10-29 12:56:13 -04:00
2011-03-25 17:52:22 -07:00
2009-12-03 11:50:11 +01:00
2011-04-01 16:14:30 +11:00
2010-10-01 10:50:58 -07:00
2010-08-17 18:07:43 -07:00
2011-01-07 17:02:58 -08:00
2010-05-21 09:37:31 -07:00
2011-03-22 17:44:01 -07:00
2011-01-13 08:03:16 -08:00
2010-05-04 05:38:16 +02:00
2011-03-23 13:54:47 +01:00
2011-01-20 13:32:33 +01:00
2011-03-23 19:47:19 -07:00
2011-03-22 17:44:12 -07:00
2009-10-11 11:20:58 -07:00
2009-12-14 23:55:32 +01:00
2010-11-26 15:05:34 +01:00
2010-02-25 10:34:26 +01:00
2010-10-27 18:03:09 -07:00
2011-03-23 19:47:08 -07:00
2010-08-04 15:23:14 -07:00
2011-03-22 17:44:11 -07:00
2011-01-24 14:32:51 +10:30
2011-03-31 13:02:56 +02:00
2011-03-23 19:46:58 -07:00
2011-03-17 13:08:28 -03:00
2011-03-15 00:43:18 +01:00
2011-02-02 15:28:19 +01:00
2011-02-21 12:53:09 -08:00
2011-03-22 17:44:13 -07:00
2010-10-15 15:53:27 +02:00
2011-04-07 20:44:11 +02:00
2010-11-12 07:55:31 -08:00
2011-03-04 08:05:41 -08:00
2011-03-04 08:05:08 -08:00
2011-01-14 04:58:08 -08:00
2011-03-04 08:05:17 -08:00
2010-12-17 12:34:08 -08:00
2010-11-29 22:01:58 -08:00
2011-01-07 17:02:58 -08:00
2010-12-17 12:34:20 -08:00
2010-11-05 08:21:34 -07:00
2011-03-23 19:46:22 -07:00
2010-12-17 10:01:09 -08:00
2011-01-27 21:13:51 -05:00
2011-01-27 21:13:51 -05:00
2011-02-22 22:07:22 +01:00
2011-01-27 21:13:51 -05:00
2011-02-23 11:34:03 +01:00
2011-02-23 11:33:59 +01:00
2010-11-23 10:29:08 +01:00
2010-07-17 12:06:22 +02:00
2010-07-17 12:06:22 +02:00
2011-02-03 14:20:33 +01:00
2011-03-31 13:00:37 +02:00
2010-11-18 13:27:46 +01:00
2011-03-23 14:09:41 +01:00
2011-03-04 11:12:26 +01:00
2010-10-24 13:29:01 +02:00
2011-03-23 14:09:41 +01:00
2011-03-31 13:00:34 +02:00
2011-05-09 14:19:54 +02:00
2011-03-22 17:44:11 -07:00
2011-03-22 17:44:01 -07:00
2009-12-14 23:55:33 +01:00
2011-01-14 04:56:49 -08:00
2011-03-22 17:44:01 -07:00
2011-03-15 02:21:44 -04:00
2011-03-23 19:47:06 -07:00
2011-03-14 09:15:28 -04:00
2011-03-23 19:46:51 -07:00
2011-03-23 19:46:54 -07:00
2011-03-23 19:47:14 -07:00
2010-10-14 08:55:27 +02:00
2011-03-15 18:53:35 -07:00
2011-03-15 18:53:35 -07:00
2011-02-03 09:28:46 -05:00
2010-10-27 18:03:17 -07:00
2011-03-23 19:47:08 -07:00
2011-01-13 08:03:18 -08:00
2009-12-02 10:22:59 +01:00
2011-03-23 19:46:59 -07:00
2009-11-12 02:04:55 -08:00
2011-03-23 19:47:03 -07:00
2010-10-26 17:32:41 -07:00
2011-03-22 17:44:12 -07:00
2010-06-29 10:07:14 +02:00
2011-03-22 17:44:01 -07:00