Shang XiaoJing
e0d75267f5
tracing: kprobe: Fix potential null-ptr-deref on trace_event_file in kprobe_event_gen_test_exit()
When trace_get_event_file() failed, gen_kretprobe_test will be assigned
as the error code. If module kprobe_event_gen_test is removed now, the
null pointer dereference will happen in kprobe_event_gen_test_exit().
Check if gen_kprobe_test or gen_kretprobe_test is error code or NULL
before dereference them.
BUG: kernel NULL pointer dereference, address: 0000000000000012
PGD 0 P4D 0
Oops: 0000 [#1] SMP PTI
CPU: 3 PID: 2210 Comm: modprobe Not tainted
6.1.0-rc1-00171-g2159299a3b74-dirty #217
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
rel-1.15.0-0-g2dd4b9b3f840-prebuilt.qemu.org 04/01/2014
RIP: 0010:kprobe_event_gen_test_exit+0x1c/0xb5 [kprobe_event_gen_test]
Code: Unable to access opcode bytes at 0xffffffff9ffffff2.
RSP: 0018:ffffc900015bfeb8 EFLAGS: 00010246
RAX: ffffffffffffffea RBX: ffffffffa0002080 RCX: 0000000000000000
RDX: ffffffffa0001054 RSI: ffffffffa0001064 RDI: ffffffffdfc6349c
RBP: ffffffffa0000000 R08: 0000000000000004 R09: 00000000001e95c0
R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000800
R13: ffffffffa0002420 R14: 0000000000000000 R15: 0000000000000000
FS: 00007f56b75be540(0000) GS:ffff88813bc00000(0000)
knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffffff9ffffff2 CR3: 000000010874a006 CR4: 0000000000330ee0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
__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
Link: https://lore.kernel.org/all/20221108015130.28326-2-shangxiaojing@huawei.com/
Fixes: 64836248dd ("tracing: Add kprobe event command generation test module")
Signed-off-by: Shang XiaoJing <shangxiaojing@huawei.com>
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Cc: stable@vger.kernel.org
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
2022-11-18 10:15:33 +09:00
..
2022-09-26 18:10:51 -04:00
2022-10-20 06:02:52 -07:00
2022-10-17 16:32:06 +02:00
2022-06-03 14:05:34 -07:00
2022-11-04 08:50:07 +09:00
2022-11-02 23:53:22 -04:00
2022-09-16 22:16:48 +02:00
2022-11-18 10:15:33 +09:00
2022-07-30 14:01:28 -04:00
2022-04-26 17:58:50 -04:00
2021-10-05 17:38:45 -04:00
2022-06-17 21:53:35 +02:00
2022-11-16 18:08:29 -05:00
2022-09-26 13:01:09 -04:00
2022-09-26 13:01:09 -04:00
2022-05-26 21:13:00 -04:00
2022-07-24 19:11:17 -04:00
2021-08-18 18:10:32 -04:00
2022-10-12 13:50:00 -04:00
2022-08-21 15:56:07 -04:00
2022-09-26 13:01:10 -04:00
2022-09-26 13:01:10 -04:00
2021-12-06 15:37:21 -05:00
2022-10-12 13:51:16 -04:00
2022-09-06 22:26:00 -04:00
2022-10-03 13:28:46 -04:00
2022-08-21 15:56:08 -04:00
2021-10-13 18:19:41 -04:00
2021-10-27 11:21:49 -04:00
2022-01-15 16:30:24 +02:00
2022-10-12 13:50:00 -04:00
2022-09-26 16:05:18 -04:00
2022-04-27 17:19:30 -04:00
2022-09-06 22:26:00 -04:00
2021-10-08 18:08:43 -04:00
2022-10-12 13:50:20 -04:00
2021-08-19 09:09:03 -04:00
2022-08-21 15:56:08 -04:00
2022-09-26 13:01:08 -04:00
2022-05-26 21:12:52 -04:00
2022-05-12 00:37:11 +02:00
2022-05-12 00:37:11 +02:00
2022-05-25 16:57:37 -04:00
2021-10-08 18:08:43 -04:00
2021-10-08 18:08:43 -04:00
2021-09-08 15:29:16 -04:00
2022-04-26 17:58:52 -04:00
2022-08-05 09:41:12 -07:00
2022-11-16 17:13:04 -05:00
2022-09-26 13:01:10 -04:00
2022-10-03 12:20:31 -04:00