bisecting fixing commit since 2762b48e9611529239da2e68cba908dbbec9805f building syzkaller on 63631df1539816bc62c7be40779c5f3e23b23b2f testing commit 2762b48e9611529239da2e68cba908dbbec9805f with gcc (GCC) 8.4.1 20210217 kernel signature: bd4b53446e17df8d004dd9afa60b2ec2c6311c2cc2cc87c05432c8520d7e0e86 run #0: OK run #1: crashed: KASAN: use-after-free Read in perf_output_read run #2: crashed: KASAN: slab-out-of-bounds Read in perf_output_read run #3: crashed: KASAN: use-after-free Read in perf_output_read run #4: crashed: KASAN: use-after-free Read in perf_output_read run #5: crashed: KASAN: slab-out-of-bounds Read in perf_output_read run #6: crashed: KASAN: use-after-free Read in perf_output_read run #7: crashed: KASAN: use-after-free Read in perf_output_read run #8: crashed: KASAN: slab-out-of-bounds Read in perf_output_read run #9: crashed: KASAN: use-after-free Read in perf_output_read run #10: crashed: KASAN: use-after-free Read in perf_output_read run #11: crashed: BUG: soft lockup in __perf_sw_event run #12: crashed: BUG: soft lockup in __perf_sw_event run #13: crashed: KASAN: slab-out-of-bounds Read in perf_output_read run #14: crashed: KASAN: use-after-free Read in perf_output_read run #15: OK run #16: OK run #17: OK run #18: OK run #19: OK testing current HEAD cf256fbcbe347b7d0ff58fe2dfa382a156bd3694 testing commit cf256fbcbe347b7d0ff58fe2dfa382a156bd3694 with gcc (GCC) 8.4.1 20210217 kernel signature: 14e1c514d9babcfaa1109231f310a9d57ad53a3f240a3f0ff1aa42c561d9afb4 run #0: crashed: KASAN: use-after-free Read in perf_output_read run #1: crashed: KASAN: use-after-free Read in perf_output_read run #2: crashed: KASAN: use-after-free Read in perf_output_read run #3: crashed: KASAN: use-after-free Read in perf_output_read run #4: crashed: KASAN: use-after-free Read in perf_output_read run #5: crashed: KASAN: use-after-free Read in perf_output_read run #6: crashed: KASAN: use-after-free Read in perf_output_read run #7: crashed: KASAN: slab-out-of-bounds Read in perf_output_read run #8: crashed: KASAN: use-after-free Read in perf_output_read run #9: crashed: KASAN: use-after-free Read in perf_output_read revisions tested: 2, total time: 38m41.041262769s (build: 15m25.675834701s, test: 22m45.486881931s) the crash still happens on HEAD commit msg: Linux 4.14.231 crash: KASAN: use-after-free Read in perf_output_read ================================================================== BUG: KASAN: use-after-free in perf_output_read_group kernel/events/core.c:5895 [inline] BUG: KASAN: use-after-free in perf_output_read+0x1177/0x14f0 kernel/events/core.c:5930 Read of size 8 at addr ffff8880983455a0 by task syz-executor003/17027 CPU: 1 PID: 17027 Comm: syz-executor003 Not tainted 4.14.231-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x14b/0x1e7 lib/dump_stack.c:58 print_address_description.cold.6+0x9/0x1ca mm/kasan/report.c:252 kasan_report_error mm/kasan/report.c:351 [inline] kasan_report mm/kasan/report.c:409 [inline] kasan_report.cold.7+0x11a/0x2d3 mm/kasan/report.c:393 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:430 perf_output_read_group kernel/events/core.c:5895 [inline] perf_output_read+0x1177/0x14f0 kernel/events/core.c:5930 perf_output_sample+0x1276/0x1910 kernel/events/core.c:5972 __perf_event_output kernel/events/core.c:6285 [inline] perf_event_output_forward+0x103/0x1d0 kernel/events/core.c:6298 __perf_event_overflow+0x107/0x300 kernel/events/core.c:7547 perf_swevent_overflow+0x165/0x210 kernel/events/core.c:7623 perf_swevent_event+0x1f5/0x2f0 kernel/events/core.c:7656 do_perf_sw_event kernel/events/core.c:7764 [inline] ___perf_sw_event+0x26b/0x3f0 kernel/events/core.c:7795 __perf_sw_event+0x3c/0x60 kernel/events/core.c:7807 perf_sw_event include/linux/perf_event.h:1046 [inline] __do_page_fault+0x616/0xa90 arch/x86/mm/fault.c:1483 do_page_fault+0x64/0x400 arch/x86/mm/fault.c:1517 page_fault+0x25/0x50 arch/x86/entry/entry_64.S:1123 RIP: 0010:copy_user_enhanced_fast_string+0xe/0x20 arch/x86/lib/copy_user_64.S:181 RSP: 0018:ffff8880a538f918 EFLAGS: 00010206 RAX: 0000000000000000 RBX: 0000000020fe1d6d RCX: 0000000000000acb RDX: 0000000000003d5e RSI: 0000000020fe5000 RDI: ffff8880864a7535 RBP: ffff8880a538f940 R08: 0000000000000000 R09: 00000000000000f5 R10: ffffed1010c94fff R11: ffff8880864a7fff R12: ffff8880864a42a2 R13: ffff888099b2c180 R14: ffff8880a538fdb0 R15: ffff8880a538fd60 _copy_from_iter_full+0x166/0x760 lib/iov_iter.c:608 copy_from_iter_full include/linux/uio.h:126 [inline] skb_do_copy_data_nocache include/net/sock.h:1889 [inline] skb_copy_to_page_nocache include/net/sock.h:1915 [inline] tcp_sendmsg_locked+0x193f/0x3a10 net/ipv4/tcp.c:1360 tcp_sendmsg+0x27/0x40 net/ipv4/tcp.c:1457 inet_sendmsg+0x108/0x440 net/ipv4/af_inet.c:762 sock_sendmsg_nosec net/socket.c:646 [inline] sock_sendmsg+0xac/0xf0 net/socket.c:656 SYSC_sendto net/socket.c:1763 [inline] SyS_sendto+0x1e4/0x2c0 net/socket.c:1731 do_syscall_64+0x1c7/0x5b0 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x46/0xbb RIP: 0033:0x452db9 RSP: 002b:00007f85b3fee1f8 EFLAGS: 00000246 ORIG_RAX: 000000000000002c RAX: ffffffffffffffda RBX: 00000000004d14e8 RCX: 0000000000452db9 RDX: ffffffffffffffef RSI: 0000000020d7cfcb RDI: 0000000000000006 RBP: 00000000004d14e0 R08: 0000000000000000 R09: 0000000000000053 R10: 0000000000000000 R11: 0000000000000246 R12: 00000000004d14ec R13: 00007fffd17af32f R14: 00007f85b3fee300 R15: 0000000000022000 Allocated by task 14355: save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59 save_stack mm/kasan/kasan.c:447 [inline] set_track mm/kasan/kasan.c:459 [inline] kasan_kmalloc.part.1+0x62/0xf0 mm/kasan/kasan.c:551 kasan_kmalloc+0xaf/0xc0 mm/kasan/kasan.c:536 __do_kmalloc_node mm/slab.c:3682 [inline] __kmalloc_node_track_caller+0x50/0x70 mm/slab.c:3696 __kmalloc_reserve.isra.7+0x2c/0xc0 net/core/skbuff.c:137 __alloc_skb+0xc1/0x540 net/core/skbuff.c:205 __netdev_alloc_skb+0x45/0x3c0 net/core/skbuff.c:407 netdev_alloc_skb include/linux/skbuff.h:2676 [inline] dev_alloc_skb include/linux/skbuff.h:2689 [inline] send_hsr_supervision_frame+0x102/0xfc0 net/hsr/hsr_device.c:265 hsr_announce+0xd5/0x2b0 net/hsr/hsr_device.c:350 call_timer_fn+0x142/0x570 kernel/time/timer.c:1280 expire_timers+0x299/0x440 kernel/time/timer.c:1319 __run_timers kernel/time/timer.c:1637 [inline] run_timer_softirq+0x1cd/0x540 kernel/time/timer.c:1650 __do_softirq+0x247/0x9a2 kernel/softirq.c:288 Freed by task 7: save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59 save_stack mm/kasan/kasan.c:447 [inline] set_track mm/kasan/kasan.c:459 [inline] kasan_slab_free+0xab/0x190 mm/kasan/kasan.c:524 __cache_free mm/slab.c:3496 [inline] kfree+0xcc/0x270 mm/slab.c:3815 skb_free_head+0x74/0x90 net/core/skbuff.c:563 skb_release_data+0x4e0/0x820 net/core/skbuff.c:583 skb_release_all+0x3d/0x50 net/core/skbuff.c:640 __kfree_skb net/core/skbuff.c:654 [inline] kfree_skb+0x8a/0x2b0 net/core/skbuff.c:672 __netif_receive_skb_core+0x403/0x2fe0 net/core/dev.c:4481 __netif_receive_skb+0x1f/0x1b0 net/core/dev.c:4512 process_backlog+0x220/0x710 net/core/dev.c:5194 napi_poll net/core/dev.c:5596 [inline] net_rx_action+0x42d/0xe20 net/core/dev.c:5662 __do_softirq+0x247/0x9a2 kernel/softirq.c:288 The buggy address belongs to the object at ffff888098345540 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 96 bytes inside of 512-byte region [ffff888098345540, ffff888098345740) The buggy address belongs to the page: page:ffffea000260d140 count:1 mapcount:0 mapping:ffff888098345040 index:0x0 flags: 0xfff00000000100(slab) raw: 00fff00000000100 ffff888098345040 0000000000000000 0000000100000006 raw: ffffea000292c1e0 ffffea00023dd5e0 ffff88813fe60940 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff888098345480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888098345500: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb >ffff888098345580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888098345600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888098345680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================