bisecting fixing commit since 4fccc2503536a564a4ba31a1d50439854201659f building syzkaller on 2c36e7a75f8689b3da20e1a81a2ee5391f3af6e5 testing commit 4fccc2503536a564a4ba31a1d50439854201659f with gcc (GCC) 8.4.1 20210217 kernel signature: d2cd15090b21748e6f75f65f9b8bba4bcb7ccafae298be370cd09afeae574d9e all runs: crashed: KASAN: use-after-free Read in qfq_search_class testing current HEAD 78fec1611cbf7b0bdaddfdbf174a3a2463663bff testing commit 78fec1611cbf7b0bdaddfdbf174a3a2463663bff with gcc (GCC) 8.4.1 20210217 kernel signature: 3acec219718579e1165bc37f278ada26e4ac16926fcdc8b73c0ca8cc504c4b44 run #0: crashed: KASAN: use-after-free Read in qfq_search_class run #1: crashed: KASAN: use-after-free Read in qfq_search_class run #2: crashed: KASAN: use-after-free Read in qfq_search_class run #3: crashed: KASAN: use-after-free Read in qfq_search_class run #4: crashed: KASAN: use-after-free Read in qfq_search_class run #5: crashed: KASAN: use-after-free Read in qfq_search_class run #6: crashed: KASAN: use-after-free Read in qfq_reset_qdisc run #7: crashed: KASAN: use-after-free Read in qfq_reset_qdisc run #8: crashed: KASAN: use-after-free Read in qfq_reset_qdisc run #9: crashed: KASAN: use-after-free Read in qfq_reset_qdisc revisions tested: 2, total time: 30m55.033767425s (build: 15m54.125793585s, test: 14m38.344011691s) the crash still happens on HEAD commit msg: Linux 4.19.183 crash: KASAN: use-after-free Read in qfq_reset_qdisc device veth1_macvtap left promiscuous mode device veth0_macvtap left promiscuous mode device veth1_vlan left promiscuous mode device veth0_vlan left promiscuous mode ================================================================== BUG: KASAN: use-after-free in qfq_reset_qdisc+0x216/0x290 net/sched/sch_qfq.c:1468 Read of size 8 at addr ffff8881dd4e3d08 by task kworker/u4:1/23 CPU: 1 PID: 23 Comm: kworker/u4:1 Not tainted 4.19.183-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Workqueue: netns cleanup_net Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x123/0x171 lib/dump_stack.c:118 print_address_description.cold.8+0x9/0x1ff mm/kasan/report.c:256 kasan_report_error mm/kasan/report.c:354 [inline] kasan_report mm/kasan/report.c:412 [inline] kasan_report.cold.9+0x242/0x2fe mm/kasan/report.c:396 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:433 qfq_reset_qdisc+0x216/0x290 net/sched/sch_qfq.c:1468 qdisc_destroy+0xfb/0x650 net/sched/sch_generic.c:981 dev_shutdown+0x236/0x410 net/sched/sch_generic.c:1321 rollback_registered_many+0x4b7/0xb50 net/core/dev.c:8181 unregister_netdevice_many+0x3e/0x1f0 net/core/dev.c:9316 default_device_exit_batch+0x2e4/0x3d0 net/core/dev.c:9787 ops_exit_list.isra.5+0xd3/0x120 net/core/net_namespace.c:156 cleanup_net+0x368/0x850 net/core/net_namespace.c:553 process_one_work+0x830/0x1670 kernel/workqueue.c:2152 worker_thread+0x85/0xb60 kernel/workqueue.c:2295 kthread+0x347/0x410 kernel/kthread.c:259 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415 Allocated by task 13877: save_stack+0x43/0xd0 mm/kasan/kasan.c:448 set_track mm/kasan/kasan.c:460 [inline] kasan_kmalloc mm/kasan/kasan.c:553 [inline] kasan_kmalloc+0xc7/0xe0 mm/kasan/kasan.c:531 kmem_cache_alloc_trace+0x152/0x740 mm/slab.c:3625 kmalloc include/linux/slab.h:515 [inline] kzalloc include/linux/slab.h:709 [inline] qfq_change_class+0x613/0x14e0 net/sched/sch_qfq.c:476 tc_ctl_tclass+0x3e9/0xba0 net/sched/sch_api.c:1993 rtnetlink_rcv_msg+0x34f/0x8f0 net/core/rtnetlink.c:4778 netlink_rcv_skb+0x13e/0x3d0 net/netlink/af_netlink.c:2455 rtnetlink_rcv+0x10/0x20 net/core/rtnetlink.c:4796 netlink_unicast_kernel net/netlink/af_netlink.c:1318 [inline] netlink_unicast+0x443/0x650 net/netlink/af_netlink.c:1344 netlink_sendmsg+0x764/0xc60 net/netlink/af_netlink.c:1909 sock_sendmsg_nosec net/socket.c:622 [inline] sock_sendmsg+0xb5/0xf0 net/socket.c:632 ___sys_sendmsg+0x647/0x950 net/socket.c:2115 __sys_sendmsg+0xd9/0x180 net/socket.c:2153 __do_sys_sendmsg net/socket.c:2162 [inline] __se_sys_sendmsg net/socket.c:2160 [inline] __x64_sys_sendmsg+0x73/0xb0 net/socket.c:2160 do_syscall_64+0xd0/0x4e0 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe Freed by task 13877: save_stack+0x43/0xd0 mm/kasan/kasan.c:448 set_track mm/kasan/kasan.c:460 [inline] __kasan_slab_free+0x102/0x150 mm/kasan/kasan.c:521 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528 __cache_free mm/slab.c:3503 [inline] kfree+0xcf/0x220 mm/slab.c:3822 qfq_change_class+0xd44/0x14e0 net/sched/sch_qfq.c:530 tc_ctl_tclass+0x3e9/0xba0 net/sched/sch_api.c:1993 rtnetlink_rcv_msg+0x34f/0x8f0 net/core/rtnetlink.c:4778 netlink_rcv_skb+0x13e/0x3d0 net/netlink/af_netlink.c:2455 rtnetlink_rcv+0x10/0x20 net/core/rtnetlink.c:4796 netlink_unicast_kernel net/netlink/af_netlink.c:1318 [inline] netlink_unicast+0x443/0x650 net/netlink/af_netlink.c:1344 netlink_sendmsg+0x764/0xc60 net/netlink/af_netlink.c:1909 sock_sendmsg_nosec net/socket.c:622 [inline] sock_sendmsg+0xb5/0xf0 net/socket.c:632 ___sys_sendmsg+0x647/0x950 net/socket.c:2115 __sys_sendmsg+0xd9/0x180 net/socket.c:2153 __do_sys_sendmsg net/socket.c:2162 [inline] __se_sys_sendmsg net/socket.c:2160 [inline] __x64_sys_sendmsg+0x73/0xb0 net/socket.c:2160 do_syscall_64+0xd0/0x4e0 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe The buggy address belongs to the object at ffff8881dd4e3cc0 which belongs to the cache kmalloc-128 of size 128 The buggy address is located 72 bytes inside of 128-byte region [ffff8881dd4e3cc0, ffff8881dd4e3d40) The buggy address belongs to the page: page:ffffea00077538c0 count:1 mapcount:0 mapping:ffff8881f6400640 index:0x0 flags: 0x17ffe0000000100(slab) raw: 017ffe0000000100 ffffea0007758b88 ffffea000775b088 ffff8881f6400640 raw: 0000000000000000 ffff8881dd4e3000 0000000100000015 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8881dd4e3c00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff8881dd4e3c80: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb >ffff8881dd4e3d00: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ^ ffff8881dd4e3d80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fc fc ffff8881dd4e3e00: fc fc fc fc fc fc fc fc 00 00 00 00 00 00 00 00 ================================================================== kasan: CONFIG_KASAN_INLINE enabled kasan: GPF could be caused by NULL-ptr deref or user memory access general protection fault: 0000 [#1] PREEMPT SMP KASAN CPU: 1 PID: 23 Comm: kworker/u4:1 Tainted: G B 4.19.183-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Workqueue: netns cleanup_net RIP: 0010:qfq_rm_from_agg.isra.18+0x4c/0x2b0 net/sched/sch_qfq.c:369 Code: 08 80 3c 02 00 0f 85 11 02 00 00 48 b8 00 00 00 00 00 fc ff df 48 8b 1e 48 c7 06 00 00 00 00 48 8d 7b 40 48 89 fa 48 c1 ea 03 <0f> b6 04 02 84 c0 74 08 3c 03 0f 8e be 01 00 00 8b 53 40 83 fa 01 RSP: 0018:ffff8881f511f818 EFLAGS: 00010202 RAX: dffffc0000000000 RBX: 0000000000000000 RCX: ffffffff8574899a RDX: 0000000000000008 RSI: ffff8881dd4e3d20 RDI: 0000000000000040 RBP: ffff8881f511f840 R08: fffffbfff11351e5 R09: fffffbfff11351e4 R10: fffffbfff11351e4 R11: ffffffff889a8f23 R12: ffff8881f03e9280 R13: 0000000000000000 R14: 0000000000000000 R15: ffffed103e07d252 FS: 0000000000000000(0000) GS:ffff8881f6900000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f4d0a4e1018 CR3: 000000000846d002 CR4: 00000000001606e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: qfq_destroy_class+0x18/0x60 net/sched/sch_qfq.c:538 qfq_destroy_qdisc+0x109/0x1b0 net/sched/sch_qfq.c:1490 qdisc_destroy+0x128/0x650 net/sched/sch_generic.c:983 dev_shutdown+0x236/0x410 net/sched/sch_generic.c:1321 rollback_registered_many+0x4b7/0xb50 net/core/dev.c:8181 unregister_netdevice_many+0x3e/0x1f0 net/core/dev.c:9316 default_device_exit_batch+0x2e4/0x3d0 net/core/dev.c:9787 ops_exit_list.isra.5+0xd3/0x120 net/core/net_namespace.c:156 cleanup_net+0x368/0x850 net/core/net_namespace.c:553 process_one_work+0x830/0x1670 kernel/workqueue.c:2152 worker_thread+0x85/0xb60 kernel/workqueue.c:2295 kthread+0x347/0x410 kernel/kthread.c:259 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415 Modules linked in: ---[ end trace 625a1f4fd5718a24 ]--- RIP: 0010:qfq_rm_from_agg.isra.18+0x4c/0x2b0 net/sched/sch_qfq.c:369 Code: 08 80 3c 02 00 0f 85 11 02 00 00 48 b8 00 00 00 00 00 fc ff df 48 8b 1e 48 c7 06 00 00 00 00 48 8d 7b 40 48 89 fa 48 c1 ea 03 <0f> b6 04 02 84 c0 74 08 3c 03 0f 8e be 01 00 00 8b 53 40 83 fa 01 RSP: 0018:ffff8881f511f818 EFLAGS: 00010202 RAX: dffffc0000000000 RBX: 0000000000000000 RCX: ffffffff8574899a RDX: 0000000000000008 RSI: ffff8881dd4e3d20 RDI: 0000000000000040 RBP: ffff8881f511f840 R08: fffffbfff11351e5 R09: fffffbfff11351e4 R10: fffffbfff11351e4 R11: ffffffff889a8f23 R12: ffff8881f03e9280 R13: 0000000000000000 R14: 0000000000000000 R15: ffffed103e07d252 FS: 0000000000000000(0000) GS:ffff8881f6900000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f4d0a4e1018 CR3: 000000000846d002 CR4: 00000000001606e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400