================================================================== BUG: KFENCE: use-after-free read in __bpf_trace_run kernel/trace/bpf_trace.c:2304 [inline] BUG: KFENCE: use-after-free read in bpf_trace_run2+0xfa/0x540 kernel/trace/bpf_trace.c:2359 Use-after-free read at 0xffff88823bfdaf98 (in kfence-#236): __bpf_trace_run kernel/trace/bpf_trace.c:2304 [inline] bpf_trace_run2+0xfa/0x540 kernel/trace/bpf_trace.c:2359 __bpf_trace_sys_enter+0x38/0x60 include/trace/events/syscalls.h:18 trace_sys_enter+0xd9/0x150 include/trace/events/syscalls.h:18 syscall_trace_enter+0xf8/0x150 kernel/entry/common.c:61 syscall_enter_from_user_mode_work include/linux/entry-common.h:168 [inline] syscall_enter_from_user_mode include/linux/entry-common.h:198 [inline] do_syscall_64+0xcc/0x230 arch/x86/entry/common.c:79 entry_SYSCALL_64_after_hwframe+0x77/0x7f kfence-#236: 0xffff88823bfdaf80-0xffff88823bfdaff7, size=120, cache=kmalloc-128 allocated by task 5419 on cpu 0 at 71.743610s (1.595793s ago): kmalloc_noprof include/linux/slab.h:901 [inline] kzalloc_noprof include/linux/slab.h:1037 [inline] bpf_raw_tp_link_attach+0x2a0/0x6e0 kernel/bpf/syscall.c:3829 bpf_raw_tracepoint_open+0x177/0x1f0 kernel/bpf/syscall.c:3876 __sys_bpf+0x3c0/0x810 kernel/bpf/syscall.c:5691 __do_sys_bpf kernel/bpf/syscall.c:5756 [inline] __se_sys_bpf kernel/bpf/syscall.c:5754 [inline] __x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:5754 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f freed by task 1051 on cpu 1 at 73.231561s (0.147756s ago): rcu_do_batch kernel/rcu/tree.c:2567 [inline] rcu_core+0xaaa/0x17a0 kernel/rcu/tree.c:2823 handle_softirqs+0x2c5/0x980 kernel/softirq.c:554 __do_softirq kernel/softirq.c:588 [inline] invoke_softirq kernel/softirq.c:428 [inline] __irq_exit_rcu+0xf4/0x1c0 kernel/softirq.c:637 irq_exit_rcu+0x9/0x30 kernel/softirq.c:649 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1037 [inline] sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1037 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702 filter_irq_stacks+0x4f/0xa0 kernel/stacktrace.c:397 stack_depot_save_flags+0x29/0x830 lib/stackdepot.c:609 save_stack+0x109/0x1f0 mm/page_owner.c:157 __set_page_owner+0x92/0x800 mm/page_owner.c:320 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x1f3/0x230 mm/page_alloc.c:1537 prep_new_page mm/page_alloc.c:1545 [inline] get_page_from_freelist+0x3123/0x3270 mm/page_alloc.c:3493 __alloc_pages_noprof+0x292/0x710 mm/page_alloc.c:4769 alloc_pages_mpol_noprof+0x3e8/0x680 mm/mempolicy.c:2265 alloc_slab_page+0x6a/0x120 mm/slub.c:2399 allocate_slab+0x5a/0x2f0 mm/slub.c:2565 new_slab mm/slub.c:2618 [inline] ___slab_alloc+0xcd1/0x14b0 mm/slub.c:3805 __slab_alloc+0x58/0xa0 mm/slub.c:3895 __slab_alloc_node mm/slub.c:3970 [inline] slab_alloc_node mm/slub.c:4131 [inline] __do_kmalloc_node mm/slub.c:4272 [inline] __kmalloc_node_track_caller_noprof+0x2e9/0x4c0 mm/slub.c:4292 kmalloc_reserve+0x111/0x2a0 net/core/skbuff.c:609 __alloc_skb+0x1f3/0x440 net/core/skbuff.c:678 alloc_skb include/linux/skbuff.h:1322 [inline] nsim_dev_trap_skb_build drivers/net/netdevsim/dev.c:748 [inline] nsim_dev_trap_report drivers/net/netdevsim/dev.c:805 [inline] nsim_dev_trap_report_work+0x254/0xab0 drivers/net/netdevsim/dev.c:851 process_one_work kernel/workqueue.c:3229 [inline] process_scheduled_works+0xa63/0x1850 kernel/workqueue.c:3310 worker_thread+0x870/0xd30 kernel/workqueue.c:3391 kthread+0x2f0/0x390 kernel/kthread.c:389 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 CPU: 0 UID: 0 PID: 5240 Comm: syz-executor Not tainted 6.12.0-rc3-next-20241016-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 RIP: 0010:__bpf_trace_run kernel/trace/bpf_trace.c:2304 [inline] RIP: 0010:bpf_trace_run2+0xfa/0x540 kernel/trace/bpf_trace.c:2359 Code: b4 24 88 00 00 00 49 8d 5d 18 48 89 d8 48 c1 e8 03 49 be 00 00 00 00 00 fc ff df 42 80 3c 30 00 74 08 48 89 df e8 16 0c 5e 00 <4c> 8b 23 ba 10 00 00 00 4c 89 ff 31 f6 e8 d4 0e 5e 00 48 c7 c7 60 RSP: 0018:ffffc90003bffda0 EFLAGS: 00010246 RAX: 1ffff110477fb5f3 RBX: ffff88823bfdaf98 RCX: dffffc0000000000 RDX: 0000000000000000 RSI: ffffc90003bfff58 RDI: ffffc90003bffe28 RBP: ffffc90003bffe88 R08: ffffffff901db3ef R09: 1ffffffff203b67d R10: dffffc0000000000 R11: fffffbfff203b67e R12: ffffc90003bffe20 R13: ffff88823bfdaf80 R14: dffffc0000000000 R15: ffffc90003bffe00 FS: 00005555802ce500(0000) GS:ffff8880b8600000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: ffff88823bfdaf98 CR3: 0000000063346000 CR4: 00000000003526f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: __bpf_trace_sys_enter+0x38/0x60 include/trace/events/syscalls.h:18 trace_sys_enter+0xd9/0x150 include/trace/events/syscalls.h:18 syscall_trace_enter+0xf8/0x150 kernel/entry/common.c:61 syscall_enter_from_user_mode_work include/linux/entry-common.h:168 [inline] syscall_enter_from_user_mode include/linux/entry-common.h:198 [inline] do_syscall_64+0xcc/0x230 arch/x86/entry/common.c:79 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f23bc174257 Code: 89 7c 24 10 48 89 4c 24 18 e8 55 16 03 00 4c 8b 54 24 18 8b 54 24 14 41 89 c0 48 8b 74 24 08 8b 7c 24 10 b8 3d 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 31 44 89 c7 89 44 24 10 e8 a5 16 03 00 8b 44 RSP: 002b:00007ffe3dfefc80 EFLAGS: 00000293 ORIG_RAX: 000000000000003d RAX: ffffffffffffffda RBX: 0000000000000013 RCX: 00007f23bc174257 RDX: 0000000040000001 RSI: 00007ffe3dfefcdc RDI: 00000000ffffffff RBP: 00007ffe3dfefcdc R08: 0000000000000000 R09: 7fffffffffffffff R10: 0000000000000000 R11: 0000000000000293 R12: 0000000000000032 R13: 0000000000011c90 R14: 0000000000010ffe R15: 00007ffe3dfefd30 ================================================================== ---------------- Code disassembly (best guess): 0: b4 24 mov $0x24,%ah 2: 88 00 mov %al,(%rax) 4: 00 00 add %al,(%rax) 6: 49 8d 5d 18 lea 0x18(%r13),%rbx a: 48 89 d8 mov %rbx,%rax d: 48 c1 e8 03 shr $0x3,%rax 11: 49 be 00 00 00 00 00 movabs $0xdffffc0000000000,%r14 18: fc ff df 1b: 42 80 3c 30 00 cmpb $0x0,(%rax,%r14,1) 20: 74 08 je 0x2a 22: 48 89 df mov %rbx,%rdi 25: e8 16 0c 5e 00 call 0x5e0c40 * 2a: 4c 8b 23 mov (%rbx),%r12 <-- trapping instruction 2d: ba 10 00 00 00 mov $0x10,%edx 32: 4c 89 ff mov %r15,%rdi 35: 31 f6 xor %esi,%esi 37: e8 d4 0e 5e 00 call 0x5e0f10 3c: 48 rex.W 3d: c7 .byte 0xc7 3e: c7 (bad) 3f: 60 (bad)