================================================================== BUG: KASAN: use-after-free in get_kprobe+0xa1/0xc0 kernel/kprobes.c:372 Read of size 8 at addr ffff88803c003328 by task syz-executor.1/6609 CPU: 0 PID: 6609 Comm: syz-executor.1 Not tainted 5.10.96 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x107/0x163 lib/dump_stack.c:118 print_address_description.constprop.0+0x1c/0x210 mm/kasan/report.c:385 __kasan_report mm/kasan/report.c:545 [inline] kasan_report.cold+0x37/0x7c mm/kasan/report.c:562 get_kprobe+0xa1/0xc0 kernel/kprobes.c:372 __recover_optprobed_insn+0x31/0x220 arch/x86/kernel/kprobes/opt.c:44 recover_probed_instruction+0x1c/0xf0 arch/x86/kernel/kprobes/core.c:275 can_optimize+0x231/0x400 arch/x86/kernel/kprobes/opt.c:321 arch_prepare_optimized_kprobe+0x3e/0x5f0 arch/x86/kernel/kprobes/opt.c:406 __prepare_optimized_kprobe kernel/kprobes.c:805 [inline] alloc_aggr_kprobe+0x140/0x190 kernel/kprobes.c:828 try_to_optimize_kprobe kernel/kprobes.c:853 [inline] register_kprobe kernel/kprobes.c:1740 [inline] register_kprobe+0xb78/0x1330 kernel/kprobes.c:1682 __register_trace_kprobe kernel/trace/trace_kprobe.c:514 [inline] __register_trace_kprobe+0x262/0x2d0 kernel/trace/trace_kprobe.c:482 create_local_trace_kprobe+0x1e6/0x3b0 kernel/trace/trace_kprobe.c:1840 perf_kprobe_init+0x18c/0x280 kernel/trace/trace_event_perf.c:272 perf_kprobe_event_init+0xf8/0x1c0 kernel/events/core.c:9655 perf_try_init_event+0x130/0x570 kernel/events/core.c:11033 perf_init_event kernel/events/core.c:11085 [inline] perf_event_alloc.part.0+0xd96/0x2b30 kernel/events/core.c:11363 perf_event_alloc kernel/events/core.c:11742 [inline] __do_sys_perf_event_open+0x57c/0x2d00 kernel/events/core.c:11840 do_syscall_64+0x33/0x40 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x7f2a1dba7b19 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f2a1b11d188 EFLAGS: 00000246 ORIG_RAX: 000000000000012a RAX: ffffffffffffffda RBX: 00007f2a1dcbaf60 RCX: 00007f2a1dba7b19 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000020001d80 RBP: 00007f2a1dc01f6d R08: 0000000000000000 R09: 0000000000000000 R10: ffffffffffffffff R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffceef53b0f R14: 00007f2a1b11d300 R15: 0000000000022000 Allocated by task 6062: kasan_save_stack+0x1b/0x40 mm/kasan/common.c:48 kasan_set_track mm/kasan/common.c:56 [inline] __kasan_kmalloc.constprop.0+0xc2/0xd0 mm/kasan/common.c:461 slab_post_alloc_hook mm/slab.h:532 [inline] slab_alloc_node mm/slub.c:2896 [inline] slab_alloc mm/slub.c:2904 [inline] __kmalloc_track_caller+0x159/0x3c0 mm/slub.c:4465 kmemdup+0x23/0x50 mm/util.c:128 kmemdup include/linux/string.h:472 [inline] neigh_parms_alloc+0x7e/0x470 net/core/neighbour.c:1630 inetdev_init+0x13d/0x4f0 net/ipv4/devinet.c:266 inetdev_event+0xd61/0x1550 net/ipv4/devinet.c:1531 notifier_call_chain kernel/notifier.c:83 [inline] raw_notifier_call_chain+0xb3/0x110 kernel/notifier.c:410 call_netdevice_notifiers_info+0xb5/0x130 net/core/dev.c:2047 call_netdevice_notifiers_extack net/core/dev.c:2059 [inline] call_netdevice_notifiers net/core/dev.c:2073 [inline] register_netdevice+0xff1/0x14b0 net/core/dev.c:10140 __tun_chr_ioctl.isra.0+0x2270/0x4260 drivers/net/tun.c:2807 vfs_ioctl fs/ioctl.c:48 [inline] __do_sys_ioctl fs/ioctl.c:753 [inline] __se_sys_ioctl fs/ioctl.c:739 [inline] __x64_sys_ioctl+0x196/0x210 fs/ioctl.c:739 do_syscall_64+0x33/0x40 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Last call_rcu(): kasan_save_stack+0x1b/0x40 mm/kasan/common.c:48 kasan_record_aux_stack+0x9e/0xb0 mm/kasan/generic.c:346 __call_rcu kernel/rcu/tree.c:2963 [inline] call_rcu+0x8a/0xa00 kernel/rcu/tree.c:3037 neigh_parms_release net/core/neighbour.c:1675 [inline] neigh_parms_release+0x178/0x1d0 net/core/neighbour.c:1665 inetdev_destroy net/ipv4/devinet.c:325 [inline] inetdev_event+0x1007/0x1550 net/ipv4/devinet.c:1599 notifier_call_chain kernel/notifier.c:83 [inline] raw_notifier_call_chain+0xb3/0x110 kernel/notifier.c:410 call_netdevice_notifiers_info+0xb5/0x130 net/core/dev.c:2047 call_netdevice_notifiers_extack net/core/dev.c:2059 [inline] call_netdevice_notifiers net/core/dev.c:2073 [inline] rollback_registered_many+0x83d/0x1270 net/core/dev.c:9558 rollback_registered net/core/dev.c:9603 [inline] unregister_netdevice_queue+0x1fd/0x420 net/core/dev.c:10748 unregister_netdevice include/linux/netdevice.h:2869 [inline] __tun_detach+0xfa8/0x1240 drivers/net/tun.c:681 tun_detach drivers/net/tun.c:698 [inline] tun_chr_close+0xc4/0x180 drivers/net/tun.c:3450 __fput+0x285/0x980 fs/file_table.c:281 task_work_run+0xe2/0x1a0 kernel/task_work.c:151 tracehook_notify_resume include/linux/tracehook.h:188 [inline] exit_to_user_mode_loop kernel/entry/common.c:164 [inline] exit_to_user_mode_prepare+0x155/0x160 kernel/entry/common.c:191 syscall_exit_to_user_mode+0x38/0x230 kernel/entry/common.c:266 entry_SYSCALL_64_after_hwframe+0x44/0xa9 The buggy address belongs to the object at ffff88803c003300 which belongs to the cache kmalloc-192 of size 192 The buggy address is located 40 bytes inside of 192-byte region [ffff88803c003300, ffff88803c0033c0) The buggy address belongs to the page: page:000000006416dad8 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88803c003a00 pfn:0x3c003 flags: 0x100000000000200(slab) raw: 0100000000000200 ffffea000032f0c8 ffffea00002d35c8 ffff888007c41500 raw: ffff88803c003a00 000000000010000b 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff88803c003200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88803c003280: 00 fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88803c003300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88803c003380: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffff88803c003400: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ================================================================== Process accounting resumed netlink: 'syz-executor.3': attribute type 16 has an invalid length. Process accounting resumed FAT-fs (loop2): Invalid FSINFO signature: 0x00000000, 0x00000000 (sector = 1) EXT4-fs (sda): quotafile must be on filesystem root Process accounting resumed EXT4-fs (sda): quotafile must be on filesystem root