BUG: KFENCE: use-after-free read in find_uprobe

18 views
Skip to first unread message

syzbot

unread,
Feb 2, 2021, 3:16:15 AM2/2/21
to syzkaller-upst...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: fd821bf0 Add linux-next specific files for 20210201
git tree: linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=14387dd8d00000
kernel config: https://syzkaller.appspot.com/x/.config?x=80ac9f64e6e2c06
dashboard link: https://syzkaller.appspot.com/bug?extid=59b6135df61870e375cc
CC: [ac...@kernel.org alexander...@linux.intel.com jo...@redhat.com linux-...@vger.kernel.org mark.r...@arm.com mi...@redhat.com namh...@kernel.org pet...@infradead.org]

Unfortunately, I don't have any reproducer for this issue yet.

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+59b613...@syzkaller.appspotmail.com

==================================================================
BUG: KFENCE: use-after-free read in uprobe_cmp kernel/events/uprobes.c:620 [inline]
BUG: KFENCE: use-after-free read in __uprobe_cmp_key kernel/events/uprobes.c:646 [inline]
BUG: KFENCE: use-after-free read in rb_find include/linux/rbtree.h:289 [inline]
BUG: KFENCE: use-after-free read in __find_uprobe kernel/events/uprobes.c:661 [inline]
BUG: KFENCE: use-after-free read in find_uprobe+0x57/0x150 kernel/events/uprobes.c:678

Use-after-free read at 0xffff88823bc8cf68 (in kfence-#69):
uprobe_cmp kernel/events/uprobes.c:620 [inline]
__uprobe_cmp_key kernel/events/uprobes.c:646 [inline]
rb_find include/linux/rbtree.h:289 [inline]
__find_uprobe kernel/events/uprobes.c:661 [inline]
find_uprobe+0x57/0x150 kernel/events/uprobes.c:678
uprobe_apply+0x26/0x130 kernel/events/uprobes.c:1221
uprobe_perf_close+0x41e/0x6f0 kernel/trace/trace_uprobe.c:1287
trace_uprobe_register+0x3e7/0x880 kernel/trace/trace_uprobe.c:1466
perf_trace_event_close kernel/trace/trace_event_perf.c:192 [inline]
perf_uprobe_destroy+0x98/0x130 kernel/trace/trace_event_perf.c:348
_free_event+0x2ee/0x1380 kernel/events/core.c:4830
put_event kernel/events/core.c:4924 [inline]
perf_event_release_kernel+0xa24/0xe00 kernel/events/core.c:5039
perf_release+0x33/0x40 kernel/events/core.c:5049
__fput+0x283/0x920 fs/file_table.c:280
task_work_run+0xdd/0x190 kernel/task_work.c:140
tracehook_notify_resume include/linux/tracehook.h:189 [inline]
exit_to_user_mode_loop kernel/entry/common.c:174 [inline]
exit_to_user_mode_prepare+0x249/0x250 kernel/entry/common.c:201
__syscall_exit_to_user_mode_work kernel/entry/common.c:291 [inline]
syscall_exit_to_user_mode+0x19/0x50 kernel/entry/common.c:302
entry_SYSCALL_64_after_hwframe+0x44/0xa9

kfence-#69 [0xffff88823bc8ce00-0xffff88823bc8cfa7, size=424, cache=kmalloc-512] allocated by task 9997:
kmalloc include/linux/slab.h:556 [inline]
kzalloc include/linux/slab.h:686 [inline]
alloc_uprobe kernel/events/uprobes.c:731 [inline]
__uprobe_register+0x19c/0x850 kernel/events/uprobes.c:1167
trace_uprobe_enable kernel/trace/trace_uprobe.c:1060 [inline]
probe_event_enable+0x357/0xa00 kernel/trace/trace_uprobe.c:1129
trace_uprobe_register+0x443/0x880 kernel/trace/trace_uprobe.c:1456
perf_trace_event_reg kernel/trace/trace_event_perf.c:129 [inline]
perf_trace_event_init+0x549/0xa20 kernel/trace/trace_event_perf.c:204
perf_uprobe_init+0x16f/0x210 kernel/trace/trace_event_perf.c:336
perf_uprobe_event_init+0xff/0x1c0 kernel/events/core.c:9721
perf_try_init_event+0x12a/0x560 kernel/events/core.c:11038
perf_init_event kernel/events/core.c:11090 [inline]
perf_event_alloc.part.0+0xe3b/0x3960 kernel/events/core.c:11370
perf_event_alloc kernel/events/core.c:11749 [inline]
__do_sys_perf_event_open+0x647/0x2e60 kernel/events/core.c:11847
do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
entry_SYSCALL_64_after_hwframe+0x44/0xa9

freed by task 9997:
put_uprobe kernel/events/uprobes.c:612 [inline]
put_uprobe+0x13b/0x190 kernel/events/uprobes.c:601
uprobe_apply+0xfc/0x130 kernel/events/uprobes.c:1231
uprobe_perf_open kernel/trace/trace_uprobe.c:1311 [inline]
trace_uprobe_register+0x5c9/0x880 kernel/trace/trace_uprobe.c:1463
perf_trace_event_open kernel/trace/trace_event_perf.c:186 [inline]
perf_trace_event_init kernel/trace/trace_event_perf.c:208 [inline]
perf_trace_event_init+0x17a/0xa20 kernel/trace/trace_event_perf.c:195
perf_uprobe_init+0x16f/0x210 kernel/trace/trace_event_perf.c:336
perf_uprobe_event_init+0xff/0x1c0 kernel/events/core.c:9721
perf_try_init_event+0x12a/0x560 kernel/events/core.c:11038
perf_init_event kernel/events/core.c:11090 [inline]
perf_event_alloc.part.0+0xe3b/0x3960 kernel/events/core.c:11370
perf_event_alloc kernel/events/core.c:11749 [inline]
__do_sys_perf_event_open+0x647/0x2e60 kernel/events/core.c:11847
do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
entry_SYSCALL_64_after_hwframe+0x44/0xa9

CPU: 1 PID: 9991 Comm: syz-executor.4 Not tainted 5.11.0-rc6-next-20210201-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:uprobe_cmp kernel/events/uprobes.c:620 [inline]
RIP: 0010:__uprobe_cmp_key kernel/events/uprobes.c:646 [inline]
RIP: 0010:rb_find include/linux/rbtree.h:289 [inline]
RIP: 0010:__find_uprobe kernel/events/uprobes.c:661 [inline]
RIP: 0010:find_uprobe+0x57/0x150 kernel/events/uprobes.c:678
Code: 00 00 48 bd 00 00 00 00 00 fc ff df e8 c2 3d df ff 49 8d bc 24 68 01 00 00 48 89 f8 48 c1 e8 03 80 3c 28 00 0f 85 d0 00 00 00 <49> 8b 9c 24 68 01 00 00 49 39 dd 72 76 e8 97 3d df ff 49 39 dd 0f
RSP: 0018:ffffc900022dfbf0 EFLAGS: 00010246
RAX: 1ffff110477919ed RBX: ffff888012f58d70 RCX: 0000000000000000
RDX: ffff88801e21d400 RSI: ffffffff819396ee RDI: ffff88823bc8cf68
RBP: dffffc0000000000 R08: 0000000000000001 R09: 0000000000000003
R10: fffff5200045bf70 R11: 0000000000000001 R12: ffff88823bc8ce00
R13: ffff88806e946738 R14: 0000000000000000 R15: ffffed10025eb1b0
FS: 0000000002787400(0000) GS:ffff8880b9f00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffff88823bc8cf68 CR3: 00000000255bc000 CR4: 00000000001506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
uprobe_apply+0x26/0x130 kernel/events/uprobes.c:1221
uprobe_perf_close+0x41e/0x6f0 kernel/trace/trace_uprobe.c:1287
trace_uprobe_register+0x3e7/0x880 kernel/trace/trace_uprobe.c:1466
perf_trace_event_close kernel/trace/trace_event_perf.c:192 [inline]
perf_uprobe_destroy+0x98/0x130 kernel/trace/trace_event_perf.c:348
_free_event+0x2ee/0x1380 kernel/events/core.c:4830
put_event kernel/events/core.c:4924 [inline]
perf_event_release_kernel+0xa24/0xe00 kernel/events/core.c:5039
perf_release+0x33/0x40 kernel/events/core.c:5049
__fput+0x283/0x920 fs/file_table.c:280
task_work_run+0xdd/0x190 kernel/task_work.c:140
tracehook_notify_resume include/linux/tracehook.h:189 [inline]
exit_to_user_mode_loop kernel/entry/common.c:174 [inline]
exit_to_user_mode_prepare+0x249/0x250 kernel/entry/common.c:201
__syscall_exit_to_user_mode_work kernel/entry/common.c:291 [inline]
syscall_exit_to_user_mode+0x19/0x50 kernel/entry/common.c:302
entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x418e1b
Code: 0f 05 48 3d 00 f0 ff ff 77 45 c3 0f 1f 40 00 48 83 ec 18 89 7c 24 0c e8 63 fc ff ff 8b 7c 24 0c 41 89 c0 b8 03 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 35 44 89 c7 89 44 24 0c e8 a1 fc ff ff 8b 44
RSP: 002b:00007ffd31e83ed0 EFLAGS: 00000293 ORIG_RAX: 0000000000000003
RAX: 0000000000000000 RBX: 0000000000000007 RCX: 0000000000418e1b
RDX: 0000000000000000 RSI: 0000000000574938 RDI: 0000000000000006
RBP: 0000000000000001 R08: 0000000000000000 R09: 0000001b317278a8
R10: 00007ffd31e83fc0 R11: 0000000000000293 R12: 00000000000003e8
R13: 0000000000035f54 R14: 000000000056bf60 R15: 000000000056bf60
==================================================================


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

syzbot

unread,
Apr 3, 2021, 4:06:09 AM4/3/21
to syzkaller-upst...@googlegroups.com
Auto-closing this bug as obsolete.
Crashes did not happen for a while, no reproducer and no activity.
Reply all
Reply to author
Forward
0 new messages