Shang XiaoJing
e57daa7503
tracing: kprobe: Fix potential null-ptr-deref on trace_array in kprobe_event_gen_test_exit()
...
commit 22ea4ca9631eb137e64e5ab899e9c89cb6670959 upstream.
When test_gen_kprobe_cmd() failed after kprobe_event_gen_cmd_end(), it
will goto delete, which will call kprobe_event_delete() and release the
corresponding resource. However, the trace_array in gen_kretprobe_test
will point to the invalid resource. Set gen_kretprobe_test to NULL
after called kprobe_event_delete() to prevent null-ptr-deref.
BUG: kernel NULL pointer dereference, address: 0000000000000070
PGD 0 P4D 0
Oops: 0000 [#1 ] SMP PTI
CPU: 0 PID: 246 Comm: modprobe Tainted: G W
6.1.0-rc1-00174-g9522dc5c87da-dirty #248
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
rel-1.15.0-0-g2dd4b9b3f840-prebuilt.qemu.org 04/01/2014
RIP: 0010:__ftrace_set_clr_event_nolock+0x53/0x1b0
Code: e8 82 26 fc ff 49 8b 1e c7 44 24 0c ea ff ff ff 49 39 de 0f 84 3c
01 00 00 c7 44 24 18 00 00 00 00 e8 61 26 fc ff 48 8b 6b 10 <44> 8b 65
70 4c 8b 6d 18 41 f7 c4 00 02 00 00 75 2f
RSP: 0018:ffffc9000159fe00 EFLAGS: 00010293
RAX: 0000000000000000 RBX: ffff88810971d268 RCX: 0000000000000000
RDX: ffff8881080be600 RSI: ffffffff811b48ff RDI: ffff88810971d058
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000001
R10: ffffc9000159fe58 R11: 0000000000000001 R12: ffffffffa0001064
R13: ffffffffa000106c R14: ffff88810971d238 R15: 0000000000000000
FS: 00007f89eeff6540(0000) GS:ffff88813b600000(0000)
knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000070 CR3: 000000010599e004 CR4: 0000000000330ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
__ftrace_set_clr_event+0x3e/0x60
trace_array_set_clr_event+0x35/0x50
? 0xffffffffa0000000
kprobe_event_gen_test_exit+0xcd/0x10b [kprobe_event_gen_test]
__x64_sys_delete_module+0x206/0x380
? lockdep_hardirqs_on_prepare+0xd8/0x190
? syscall_enter_from_user_mode+0x1c/0x50
do_syscall_64+0x3f/0x90
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f89eeb061b7
Link: https://lore.kernel.org/all/20221108015130.28326-3-shangxiaojing@huawei.com/
Fixes: 64836248dda2 ("tracing: Add kprobe event command generation test module")
Signed-off-by: Shang XiaoJing <shangxiaojing@huawei.com>
Cc: stable@vger.kernel.org
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-11-26 09:24:43 +01:00
..
2022-11-26 09:24:38 +01:00
2022-10-26 12:35:25 +02:00
2022-05-25 09:57:37 +02:00
2022-10-05 10:39:40 +02:00
2022-09-20 12:39:42 +02:00
2022-11-03 23:59:15 +09:00
2022-10-26 12:35:56 +02:00
2022-08-17 14:23:14 +02:00
2021-09-02 13:00:15 -07:00
2022-10-26 12:34:30 +02:00
2022-09-20 12:39:42 +02:00
2022-11-03 23:59:17 +09:00
2022-06-09 10:22:49 +02:00
2022-10-26 12:35:29 +02:00
2022-11-03 23:59:15 +09:00
2022-08-17 14:24:24 +02:00
2022-11-26 09:24:43 +01:00
2021-09-08 11:50:26 -07:00
2022-02-23 12:03:07 +01:00
2022-08-31 17:16:33 +02:00
2021-08-24 18:52:36 -04:00
2022-02-08 18:34:03 +01:00
2022-04-08 14:23:06 +02:00
2022-04-08 14:23:06 +02:00
2022-06-22 14:22:04 +02:00
2021-09-08 15:32:35 -07:00
2021-08-16 18:55:32 +02:00
2022-05-30 09:29:09 +02:00
2021-12-29 12:28:49 +01:00
2022-02-23 12:03:20 +01:00
2022-07-21 21:24:11 +02:00
2022-09-15 11:30:06 +02:00
2021-06-18 11:43:08 +02:00
2021-09-03 23:00:22 +02:00
2021-05-27 04:01:50 +09:00
2021-07-02 12:08:10 -07:00
2021-06-10 10:00:08 +02:00
2021-07-05 10:46:20 +02:00
2021-07-08 11:48:22 -07:00
2021-08-17 17:50:51 +02:00
2021-06-28 22:43:05 +02:00
2021-08-30 16:36:10 +02:00
2022-07-21 21:24:29 +02:00
2021-09-08 15:32:34 -07:00
2022-11-10 18:15:38 +01:00
2021-06-29 17:29:11 -07:00
2022-04-13 20:59:28 +02:00
2022-07-12 16:35:09 +02:00
2021-08-16 18:55:32 +02:00
2021-09-03 09:58:12 -07:00
2021-08-27 16:30:18 +08:00
2021-08-30 16:36:10 +02:00
2021-08-16 14:42:22 +02:00
2021-09-03 09:58:12 -07:00
2021-08-10 12:53:07 +02:00
2022-08-17 14:24:04 +02:00
2022-06-09 10:22:29 +02:00
2021-06-21 13:08:36 +01:00
2022-04-08 14:23:43 +02:00
2022-04-08 14:23:10 +02:00
2022-06-09 10:22:46 +02:00
2021-11-18 19:16:29 +01:00
2022-02-16 12:56:38 +01:00
2022-07-21 21:24:42 +02:00
2022-08-17 14:24:24 +02:00
2021-08-10 14:57:42 +02:00
2021-08-10 22:50:07 +02:00
2022-02-23 12:03:07 +01:00
2022-04-13 20:59:28 +02:00
2022-04-13 20:59:28 +02:00
2022-04-13 20:59:28 +02:00
2022-08-31 17:16:33 +02:00
2022-02-23 12:03:20 +01:00
2021-06-23 16:41:24 -06:00
2022-07-29 17:25:11 +02:00
2021-08-10 10:48:07 -07:00
2021-08-16 11:39:51 -04:00
2022-01-27 11:05:35 +01:00
2022-02-23 12:03:20 +01:00
2022-03-08 19:12:42 +01:00
2021-09-08 11:50:27 -07:00
2021-07-03 11:41:14 -07:00
2022-08-03 12:03:43 +02:00
2022-08-25 11:40:43 +02:00
2021-08-17 07:49:10 -10:00
2022-09-28 11:11:56 +02:00