bisecting fixing commit since cbfa1702aaf69b2311ea1b35e04f113c48368c67 building syzkaller on fc7735a27949755327024847e12dcc1b868bcb99 testing commit cbfa1702aaf69b2311ea1b35e04f113c48368c67 with gcc (GCC) 8.4.1 20210217 kernel signature: f13e465bc6eadb0228aba1c3d2948d0fb061824e00692e6703af1b81a7deb2c7 run #0: crashed: KASAN: slab-out-of-bounds Read in perf_output_read 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: 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 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: slab-out-of-bounds 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: slab-out-of-bounds Read in perf_output_read run #16: crashed: KASAN: use-after-free Read in perf_output_read run #17: crashed: KASAN: use-after-free Read in perf_output_read run #18: OK run #19: OK testing current HEAD 29c52025152bab4c557d8174da58f1a4c8e70438 testing commit 29c52025152bab4c557d8174da58f1a4c8e70438 with gcc (GCC) 8.4.1 20210217 kernel signature: 7a7bf4bdac3e79f2663e34118e6db60c2efb2a23ade721a7a4c1674173f96f29 all runs: crashed: KASAN: use-after-free Read in perf_output_read revisions tested: 2, total time: 36m56.117399024s (build: 14m22.065781733s, test: 21m38.850463147s) the crash still happens on HEAD commit msg: Linux 4.14.221 crash: KASAN: use-after-free Read in perf_output_read IPv6: ADDRCONF(NETDEV_UP): batadv_slave_1: link is not ready batman_adv: batadv0: Interface activated: batadv_slave_1 IPv6: ADDRCONF(NETDEV_CHANGE): batadv_slave_1: link becomes ready IPv6: ADDRCONF(NETDEV_CHANGE): veth1_to_batadv: link becomes ready ================================================================== 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+0x1181/0x14f0 kernel/events/core.c:5930 Read of size 8 at addr ffff8881dfeed908 by task syz-executor738/25915 CPU: 0 PID: 25915 Comm: syz-executor738 Not tainted 4.14.221-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+0x1181/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+0x648/0xb10 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:ffff8881d5a2f918 EFLAGS: 00010202 RAX: 0000000000000000 RBX: 0000000020f21fe9 RCX: 0000000000003acb RDX: 0000000000003ae2 RSI: 0000000020f22000 RDI: ffff8881d6994535 RBP: ffff8881d5a2f940 R08: 0000000000000000 R09: 00000000000000eb R10: ffffed103ad32fff R11: ffff8881d6997fff R12: ffff8881d699451e R13: ffff8881deaea180 R14: ffff8881d5a2fdb0 R15: ffff8881d5a2fd60 _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:0x449179 RSP: 002b:00007f8bad2c5308 EFLAGS: 00000246 ORIG_RAX: 000000000000002c RAX: ffffffffffffffda RBX: 00000000004ce4e8 RCX: 0000000000449179 RDX: ffffffffffffffef RSI: 0000000020d7cfcb RDI: 0000000000000004 RBP: 00000000004ce4e0 R08: 0000000000000000 R09: 0000000000000053 R10: 0000000000000000 R11: 0000000000000246 R12: 000000000049d474 R13: 00007fff0c52862f R14: 00007f8bad2c5400 R15: 0000000000022000 Allocated by task 21441: 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 alloc_skb include/linux/skbuff.h:980 [inline] nlmsg_new include/net/netlink.h:511 [inline] netlink_ack+0x283/0xaa0 net/netlink/af_netlink.c:2360 netlink_rcv_skb+0x299/0x3b0 net/netlink/af_netlink.c:2439 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 21441: 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] consume_skb+0x84/0x2a0 net/core/skbuff.c:714 skb_free_datagram+0x12/0xc0 net/core/datagram.c:331 netlink_recvmsg+0x5d7/0xe20 net/netlink/af_netlink.c:1957 sock_recvmsg_nosec net/socket.c:819 [inline] sock_recvmsg net/socket.c:826 [inline] sock_recvmsg+0xb7/0xf0 net/socket.c:822 SYSC_recvfrom net/socket.c:1815 [inline] SyS_recvfrom+0x2ef/0x380 net/socket.c:1787 do_syscall_64+0x1c7/0x5b0 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x46/0xbb The buggy address belongs to the object at ffff8881dfeed800 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 264 bytes inside of 512-byte region [ffff8881dfeed800, ffff8881dfeeda00) The buggy address belongs to the page: page:ffffea00077fbb40 count:1 mapcount:0 mapping:ffff8881dfeed080 index:0xffff8881dfeed080 flags: 0x17ffe0000000100(slab) raw: 017ffe0000000100 ffff8881dfeed080 ffff8881dfeed080 0000000100000003 raw: ffffea00075f39e0 ffffea000758aae0 ffff8881f6000940 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8881dfeed800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881dfeed880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8881dfeed900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8881dfeed980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881dfeeda00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================