netlink: 16 bytes leftover after parsing attributes in process `syz-executor.7'. ================================================================== BUG: KASAN: use-after-free in get_kprobe kernel/kprobes.c:372 [inline] BUG: KASAN: use-after-free in __get_valid_kprobe+0x1ff/0x230 kernel/kprobes.c:1585 Read of size 8 at addr ffff88801ce68328 by task syz-executor.1/4736 CPU: 0 PID: 4736 Comm: syz-executor.1 Not tainted 5.10.78 #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 kernel/kprobes.c:372 [inline] __get_valid_kprobe+0x1ff/0x230 kernel/kprobes.c:1585 check_kprobe_rereg kernel/kprobes.c:1606 [inline] register_kprobe+0x119/0x1330 kernel/kprobes.c:1695 __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+0x1f7/0x350 kernel/trace/trace_kprobe.c:1837 perf_kprobe_init+0x18c/0x280 kernel/trace/trace_event_perf.c:272 perf_kprobe_event_init+0xf8/0x1c0 kernel/events/core.c:9621 perf_try_init_event+0x130/0x570 kernel/events/core.c:10999 perf_init_event kernel/events/core.c:11051 [inline] perf_event_alloc.part.0+0xd81/0x2a90 kernel/events/core.c:11329 perf_event_alloc kernel/events/core.c:11708 [inline] __do_sys_perf_event_open+0x579/0x2c80 kernel/events/core.c:11806 do_syscall_64+0x33/0x40 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x466609 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:00007f3e658bd188 EFLAGS: 00000246 ORIG_RAX: 000000000000012a RAX: ffffffffffffffda RBX: 000000000056bf80 RCX: 0000000000466609 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000020001d80 RBP: 00000000004bfcb9 R08: 0000000000000000 R09: 0000000000000000 R10: ffffffffffffffff R11: 0000000000000246 R12: 000000000056bf80 R13: 00007ffd7993546f R14: 00007f3e658bd300 R15: 0000000000022000 Allocated by task 4719: 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 kmalloc include/linux/slab.h:552 [inline] kzalloc include/linux/slab.h:664 [inline] alloc_aggr_kprobe+0x41/0x190 kernel/kprobes.c:822 try_to_optimize_kprobe kernel/kprobes.c:853 [inline] register_kprobe kernel/kprobes.c:1740 [inline] register_kprobe+0xb5c/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+0x1f7/0x350 kernel/trace/trace_kprobe.c:1837 perf_kprobe_init+0x18c/0x280 kernel/trace/trace_event_perf.c:272 perf_kprobe_event_init+0xf8/0x1c0 kernel/events/core.c:9621 perf_try_init_event+0x130/0x570 kernel/events/core.c:10999 perf_init_event kernel/events/core.c:11051 [inline] perf_event_alloc.part.0+0xd81/0x2a90 kernel/events/core.c:11329 perf_event_alloc kernel/events/core.c:11708 [inline] __do_sys_perf_event_open+0x579/0x2c80 kernel/events/core.c:11806 do_syscall_64+0x33/0x40 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Freed by task 17: kasan_save_stack+0x1b/0x40 mm/kasan/common.c:48 kasan_set_track+0x1c/0x30 mm/kasan/common.c:56 kasan_set_free_info+0x1b/0x30 mm/kasan/generic.c:355 __kasan_slab_free+0x111/0x150 mm/kasan/common.c:422 slab_free_hook mm/slub.c:1542 [inline] slab_free_freelist_hook+0xa9/0x180 mm/slub.c:1576 slab_free mm/slub.c:3149 [inline] kfree+0xd7/0x380 mm/slub.c:4125 free_aggr_kprobe kernel/kprobes.c:434 [inline] do_free_cleaned_kprobes kernel/kprobes.c:586 [inline] kprobe_optimizer+0x56f/0x7e0 kernel/kprobes.c:624 process_one_work+0x9ac/0x1580 kernel/workqueue.c:2270 worker_thread+0x61d/0x1310 kernel/workqueue.c:2416 kthread+0x38f/0x470 kernel/kthread.c:313 ret_from_fork+0x22/0x30 arch/x86/entry/entry_64.S:296 The buggy address belongs to the object at ffff88801ce68300 which belongs to the cache kmalloc-192 of size 192 The buggy address is located 40 bytes inside of 192-byte region [ffff88801ce68300, ffff88801ce683c0) The buggy address belongs to the page: page:000000002e2d1c06 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1ce68 flags: 0x100000000000200(slab) raw: 0100000000000200 ffffea0000727380 0000000900000009 ffff888007c41500 raw: 0000000000000000 0000000080100010 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff88801ce68200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88801ce68280: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc >ffff88801ce68300: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88801ce68380: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffff88801ce68400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ------------[ cut here ]------------ WARNING: CPU: 0 PID: 4736 at kernel/kprobes.c:764 reuse_unused_kprobe kernel/kprobes.c:764 [inline] WARNING: CPU: 0 PID: 4736 at kernel/kprobes.c:764 register_aggr_kprobe kernel/kprobes.c:1447 [inline] WARNING: CPU: 0 PID: 4736 at kernel/kprobes.c:764 register_kprobe kernel/kprobes.c:1713 [inline] WARNING: CPU: 0 PID: 4736 at kernel/kprobes.c:764 register_kprobe+0xfec/0x1330 kernel/kprobes.c:1682 Modules linked in: CPU: 0 PID: 4736 Comm: syz-executor.1 Tainted: G B 5.10.78 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014 RIP: 0010:reuse_unused_kprobe kernel/kprobes.c:764 [inline] RIP: 0010:register_aggr_kprobe kernel/kprobes.c:1447 [inline] RIP: 0010:register_kprobe kernel/kprobes.c:1713 [inline] RIP: 0010:register_kprobe+0xfec/0x1330 kernel/kprobes.c:1682 Code: 4d 89 6c 24 08 e8 b4 64 ff ff 41 89 dc 48 b8 22 01 00 00 00 00 ad de 48 89 45 08 e8 1e e8 ed ff e9 5b f9 ff ff e8 94 64 ff ff <0f> 0b e9 9d fc ff ff 4c 89 ff e8 75 64 2a 00 e9 99 f5 ff ff e8 6b RSP: 0018:ffff888045e17bc8 EFLAGS: 00010216 RAX: 0000000000031d37 RBX: ffff88801ce68378 RCX: ffffc9000460e000 RDX: 0000000000040000 RSI: ffffffff813ffe7c RDI: ffff88801ce68378 RBP: ffff888008bffc18 R08: 0000000000000000 R09: ffffffff84ce8bc7 R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000000 R13: ffff888008bffc28 R14: ffff88801ce68370 R15: ffff88801ce68300 FS: 00007f3e658bd700(0000) GS:ffff88806ce00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00000000004e4da6 CR3: 0000000040bc8000 CR4: 0000000000350ef0 Call Trace: __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+0x1f7/0x350 kernel/trace/trace_kprobe.c:1837 perf_kprobe_init+0x18c/0x280 kernel/trace/trace_event_perf.c:272 perf_kprobe_event_init+0xf8/0x1c0 kernel/events/core.c:9621 perf_try_init_event+0x130/0x570 kernel/events/core.c:10999 perf_init_event kernel/events/core.c:11051 [inline] perf_event_alloc.part.0+0xd81/0x2a90 kernel/events/core.c:11329 perf_event_alloc kernel/events/core.c:11708 [inline] __do_sys_perf_event_open+0x579/0x2c80 kernel/events/core.c:11806 do_syscall_64+0x33/0x40 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x466609 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:00007f3e658bd188 EFLAGS: 00000246 ORIG_RAX: 000000000000012a RAX: ffffffffffffffda RBX: 000000000056bf80 RCX: 0000000000466609 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000020001d80 RBP: 00000000004bfcb9 R08: 0000000000000000 R09: 0000000000000000 R10: ffffffffffffffff R11: 0000000000000246 R12: 000000000056bf80 R13: 00007ffd7993546f R14: 00007f3e658bd300 R15: 0000000000022000 irq event stamp: 176 hardirqs last enabled at (175): [] __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:160 [inline] hardirqs last enabled at (175): [] _raw_spin_unlock_irqrestore+0x34/0x40 kernel/locking/spinlock.c:191 hardirqs last disabled at (176): [] __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:108 [inline] hardirqs last disabled at (176): [] _raw_spin_lock_irqsave+0x4b/0x50 kernel/locking/spinlock.c:159 softirqs last enabled at (134): [] asm_call_irq_on_stack+0x12/0x20 softirqs last disabled at (3): [] asm_call_irq_on_stack+0x12/0x20 ---[ end trace 169ed83112569888 ]--- general protection fault, probably for non-canonical address 0xf9f3fc3940000002: 0000 [#1] SMP KASAN NOPTI KASAN: maybe wild-memory-access in range [0xcfa001ca00000010-0xcfa001ca00000017] CPU: 1 PID: 4746 Comm: syz-executor.0 Tainted: G B W 5.10.78 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014 RIP: 0010:__hlist_del include/linux/list.h:838 [inline] RIP: 0010:hlist_del_rcu include/linux/rculist.h:514 [inline] RIP: 0010:__unregister_kprobe_top+0x3a3/0x550 kernel/kprobes.c:1859 Code: 00 fc ff df 48 89 fa 48 c1 ea 03 80 3c 02 00 0f 85 ab 01 00 00 48 b8 00 00 00 00 00 fc ff df 4c 8b 65 08 4c 89 e2 48 c1 ea 03 <80> 3c 02 00 0f 85 44 01 00 00 49 89 1c 24 48 85 db 74 28 e8 85 9b RSP: 0018:ffff88804155fca8 EFLAGS: 00010212 RAX: dffffc0000000000 RBX: ffff88800ce817a0 RCX: ffffffff813fc90e RDX: 19f4003940000002 RSI: 0000000000000008 RDI: ffff88801ce68308 RBP: ffff88801ce68300 R08: 0000000000000000 R09: ffffffff84e338c7 R10: 0000000000000000 R11: 0000000000000001 R12: cfa001ca00000011 R13: ffffffff813f7470 R14: ffff88801ce68370 R15: 0000000000000001 FS: 00007fb4b3d57700(0000) GS:ffff88806cf00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f4196093028 CR3: 000000003f7ba000 CR4: 0000000000350ee0 Call Trace: unregister_kprobes kernel/kprobes.c:1911 [inline] unregister_kprobes kernel/kprobes.c:1903 [inline] unregister_kprobe+0x26/0xc0 kernel/kprobes.c:1899 __unregister_trace_kprobe+0x1a2/0x210 kernel/trace/trace_kprobe.c:526 destroy_local_trace_kprobe+0xc8/0x170 kernel/trace/trace_kprobe.c:1860 _free_event+0x159/0xc70 kernel/events/core.c:4911 put_event kernel/events/core.c:5005 [inline] perf_event_release_kernel+0x899/0xc20 kernel/events/core.c:5120 perf_release+0x33/0x40 kernel/events/core.c:5130 __fput+0x285/0x970 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 RIP: 0033:0x466609 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:00007fb4b3d57188 EFLAGS: 00000246 ORIG_RAX: 00000000000001b4 RAX: 0000000000000000 RBX: 000000000056bf80 RCX: 0000000000466609 RDX: 0000000000000000 RSI: ffffffffffffffff RDI: 0000000000000003 RBP: 00000000004bfcb9 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 000000000056bf80 R13: 00007ffe477c9ccf R14: 00007fb4b3d57300 R15: 0000000000022000 Modules linked in: ---[ end trace 169ed83112569889 ]--- RIP: 0010:__hlist_del include/linux/list.h:838 [inline] RIP: 0010:hlist_del_rcu include/linux/rculist.h:514 [inline] RIP: 0010:__unregister_kprobe_top+0x3a3/0x550 kernel/kprobes.c:1859 Code: 00 fc ff df 48 89 fa 48 c1 ea 03 80 3c 02 00 0f 85 ab 01 00 00 48 b8 00 00 00 00 00 fc ff df 4c 8b 65 08 4c 89 e2 48 c1 ea 03 <80> 3c 02 00 0f 85 44 01 00 00 49 89 1c 24 48 85 db 74 28 e8 85 9b RSP: 0018:ffff88804155fca8 EFLAGS: 00010212 RAX: dffffc0000000000 RBX: ffff88800ce817a0 RCX: ffffffff813fc90e RDX: 19f4003940000002 RSI: 0000000000000008 RDI: ffff88801ce68308 RBP: ffff88801ce68300 R08: 0000000000000000 R09: ffffffff84e338c7 R10: 0000000000000000 R11: 0000000000000001 R12: cfa001ca00000011 R13: ffffffff813f7470 R14: ffff88801ce68370 R15: 0000000000000001 FS: 00007fb4b3d57700(0000) GS:ffff88806cf00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f4196093028 CR3: 000000003f7ba000 CR4: 0000000000350ee0