bisecting fixing commit since 2762b48e9611529239da2e68cba908dbbec9805f building syzkaller on 63631df1539816bc62c7be40779c5f3e23b23b2f testing commit 2762b48e9611529239da2e68cba908dbbec9805f with gcc (GCC) 8.4.1 20210217 kernel signature: b45c3bd8f415a5d72383bb78ade0cc92d344218263da516adf068c8fa9bdf830 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: BUG: soft lockup in __perf_sw_event run #8: crashed: KASAN: use-after-free 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: KASAN: use-after-free Read in perf_output_read run #12: crashed: KASAN: use-after-free Read in perf_output_read run #13: crashed: KASAN: use-after-free Read in perf_output_read run #14: crashed: KASAN: use-after-free Read in perf_output_read run #15: crashed: KASAN: use-after-free Read in perf_output_read run #16: OK run #17: crashed: KASAN: use-after-free Read in perf_output_read run #18: OK run #19: OK testing current HEAD 670d6552eda8ff0c5f396d3d6f0174237917c66c testing commit 670d6552eda8ff0c5f396d3d6f0174237917c66c with gcc (GCC) 8.4.1 20210217 kernel signature: 0e0162249227186454a65130ff103599f591079e13c613a49d4f49e08f309070 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: general protection fault 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: OK run #8: OK run #9: OK revisions tested: 2, total time: 38m8.959375245s (build: 14m45.289547266s, test: 23m1.73549936s) the crash still happens on HEAD commit msg: Linux 4.14.227 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 ffff8880a17a35a0 by task syz-executor904/9758 CPU: 1 PID: 9758 Comm: syz-executor904 Not tainted 4.14.227-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:ffff88808debf918 EFLAGS: 00010206 RAX: 0000000000000000 RBX: 0000000020ff5acb RCX: 0000000000006acb RDX: 0000000000008000 RSI: 0000000020ff7000 RDI: ffff88809ae11535 RBP: ffff88808debf940 R08: 0000000000000000 R09: 0000000000000200 R10: ffffed10135c2fff R11: ffff88809ae17fff R12: ffff88809ae10000 R13: ffff888098dd8340 R14: ffff88808debfdb0 R15: ffff88808debfd60 _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:00007fb1734c01f8 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: 00007fff92fdfabf R14: 00007fb1734c0300 R15: 0000000000022000 Allocated by task 8328: 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 kmem_cache_alloc_trace+0x152/0x3f0 mm/slab.c:3618 kmalloc include/linux/slab.h:488 [inline] kzalloc include/linux/slab.h:661 [inline] inetdev_init+0x57/0x3e0 net/ipv4/devinet.c:245 inetdev_event+0x193/0xd10 net/ipv4/devinet.c:1462 notifier_call_chain+0xd6/0x150 kernel/notifier.c:93 __raw_notifier_call_chain kernel/notifier.c:394 [inline] raw_notifier_call_chain+0x11/0x20 kernel/notifier.c:401 call_netdevice_notifiers_info+0x4b/0x60 net/core/dev.c:1667 call_netdevice_notifiers net/core/dev.c:1683 [inline] register_netdevice+0x98c/0xe50 net/core/dev.c:7691 macsec_newlink+0x2c6/0x1180 drivers/net/macsec.c:3245 rtnl_newlink+0xca6/0x1610 net/core/rtnetlink.c:2728 rtnetlink_rcv_msg+0x34c/0x9e0 net/core/rtnetlink.c:4316 netlink_rcv_skb+0x12f/0x3b0 net/netlink/af_netlink.c:2433 rtnetlink_rcv+0x10/0x20 net/core/rtnetlink.c:4328 netlink_unicast_kernel net/netlink/af_netlink.c:1287 [inline] netlink_unicast+0x40b/0x610 net/netlink/af_netlink.c:1313 netlink_sendmsg+0x639/0xbe0 net/netlink/af_netlink.c:1878 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 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 in_dev_finish_destroy+0x114/0x160 net/ipv4/devinet.c:234 in_dev_put include/linux/inetdevice.h:246 [inline] in_dev_rcu_put+0x24/0x30 net/ipv4/devinet.c:287 __rcu_reclaim kernel/rcu/rcu.h:195 [inline] rcu_do_batch kernel/rcu/tree.c:2699 [inline] invoke_rcu_callbacks kernel/rcu/tree.c:2962 [inline] __rcu_process_callbacks kernel/rcu/tree.c:2929 [inline] rcu_process_callbacks+0x7a5/0x11e0 kernel/rcu/tree.c:2946 __do_softirq+0x247/0x9a2 kernel/softirq.c:288 The buggy address belongs to the object at ffff8880a17a3540 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 96 bytes inside of 512-byte region [ffff8880a17a3540, ffff8880a17a3740) The buggy address belongs to the page: page:ffffea000285e8c0 count:1 mapcount:0 mapping:ffff8880a17a3040 index:0xffff8880a17a3540 flags: 0xfff00000000100(slab) raw: 00fff00000000100 ffff8880a17a3040 ffff8880a17a3540 0000000100000005 raw: ffffea0002ced7a0 ffffea000286c320 ffff88813fe64940 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8880a17a3480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8880a17a3500: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb >ffff8880a17a3580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8880a17a3600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880a17a3680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================