bisecting fixing commit since d09b80172c22df7a5e2ec58aa1a0fbe8914752e7 building syzkaller on 54289b0835634ca07a8117613c48b73e9e647d13 testing commit d09b80172c22df7a5e2ec58aa1a0fbe8914752e7 with gcc (GCC) 8.4.1 20210217 kernel signature: 6ce65bc44c1f7c1b93dd4680eb9bc5a36e330f8e0d9ac391fdee344b64e3a18a all runs: crashed: KASAN: use-after-free Read in tcf_action_destroy testing current HEAD 125222814e7b8f84df767d6ab622aff2a6d2f234 testing commit 125222814e7b8f84df767d6ab622aff2a6d2f234 with gcc (GCC) 8.4.1 20210217 kernel signature: 1f2eef0126663333704469f8c276efe09e64edc33cdee025ce890c3acf618458 all runs: crashed: KASAN: use-after-free Read in tcf_action_destroy revisions tested: 2, total time: 26m46.409099746s (build: 16m30.02068554s, test: 9m47.644520031s) the crash still happens on HEAD commit msg: Linux 4.19.182 crash: KASAN: use-after-free Read in tcf_action_destroy netlink: 32 bytes leftover after parsing attributes in process `syz-executor.5'. netlink: 32 bytes leftover after parsing attributes in process `syz-executor.3'. netlink: 32 bytes leftover after parsing attributes in process `syz-executor.4'. netlink: 32 bytes leftover after parsing attributes in process `syz-executor.1'. ================================================================== BUG: KASAN: use-after-free in tcf_action_destroy+0xda/0xf0 net/sched/act_api.c:655 Read of size 8 at addr ffff8881f47625c0 by task syz-executor.3/25165 CPU: 1 PID: 25165 Comm: syz-executor.3 Not tainted 4.19.182-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x17c/0x226 lib/dump_stack.c:118 print_address_description.cold.6+0x9/0x211 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.7+0x242/0x2fe mm/kasan/report.c:396 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:433 tcf_action_destroy+0xda/0xf0 net/sched/act_api.c:655 tcf_action_init+0x292/0x300 net/sched/act_api.c:949 tcf_action_add+0xf2/0x320 net/sched/act_api.c:1314 tc_ctl_action+0x28d/0x3d0 net/sched/act_api.c:1369 rtnetlink_rcv_msg+0x34f/0x950 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/0x660 net/netlink/af_netlink.c:1344 netlink_sendmsg+0x667/0xc60 net/netlink/af_netlink.c:1909 sock_sendmsg_nosec net/socket.c:622 [inline] sock_sendmsg+0xac/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 RIP: 0033:0x465ad9 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fcd7a9f9188 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 000000000055cf20 RCX: 0000000000465ad9 RDX: 0000000000000000 RSI: 0000000020002980 RDI: 0000000000000003 RBP: 00000000004af756 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 000000000055cf20 R13: 00007fffe7d5663f R14: 00007fcd7a9f9300 R15: 0000000000022000 Allocated by task 25165: save_stack mm/kasan/kasan.c:448 [inline] set_track mm/kasan/kasan.c:460 [inline] kasan_kmalloc.part.1+0x62/0xf0 mm/kasan/kasan.c:553 kasan_kmalloc+0xaf/0xc0 mm/kasan/kasan.c:538 __do_kmalloc mm/slab.c:3727 [inline] __kmalloc+0x15d/0x3d0 mm/slab.c:3736 kmalloc include/linux/slab.h:520 [inline] kzalloc include/linux/slab.h:709 [inline] tcf_idr_create+0x55/0x560 net/sched/act_api.c:361 tcf_connmark_init+0x3d8/0x6a0 net/sched/act_connmark.c:127 tcf_action_init_1+0x837/0xaf0 net/sched/act_api.c:870 tcf_action_init+0x178/0x300 net/sched/act_api.c:933 tcf_action_add+0xf2/0x320 net/sched/act_api.c:1314 tc_ctl_action+0x28d/0x3d0 net/sched/act_api.c:1369 rtnetlink_rcv_msg+0x34f/0x950 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/0x660 net/netlink/af_netlink.c:1344 netlink_sendmsg+0x667/0xc60 net/netlink/af_netlink.c:1909 sock_sendmsg_nosec net/socket.c:622 [inline] sock_sendmsg+0xac/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 25176: save_stack mm/kasan/kasan.c:448 [inline] set_track mm/kasan/kasan.c:460 [inline] __kasan_slab_free+0x13c/0x220 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 free_tcf net/sched/act_api.c:90 [inline] tcf_action_cleanup+0xfd/0x130 net/sched/act_api.c:99 __tcf_action_put+0xbe/0x100 net/sched/act_api.c:112 __tcf_idr_release net/sched/act_api.c:142 [inline] __tcf_idr_release+0x6a/0x90 net/sched/act_api.c:122 tcf_del_walker net/sched/act_api.c:266 [inline] tcf_generic_walker+0x581/0x940 net/sched/act_api.c:292 tcf_connmark_walker+0x113/0x1d0 net/sched/act_connmark.c:194 tca_action_flush net/sched/act_api.c:1142 [inline] tca_action_gd+0x7ae/0x1440 net/sched/act_api.c:1248 tc_ctl_action+0x1fe/0x3d0 net/sched/act_api.c:1373 rtnetlink_rcv_msg+0x34f/0x950 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/0x660 net/netlink/af_netlink.c:1344 netlink_sendmsg+0x667/0xc60 net/netlink/af_netlink.c:1909 sock_sendmsg_nosec net/socket.c:622 [inline] sock_sendmsg+0xac/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 ffff8881f47625c0 which belongs to the cache kmalloc-256 of size 256 The buggy address is located 0 bytes inside of 256-byte region [ffff8881f47625c0, ffff8881f47626c0) The buggy address belongs to the page: page:ffffea0007d1d880 count:1 mapcount:0 mapping:ffff8881f60007c0 index:0xffff8881f4762980 flags: 0x17ffe0000000100(slab) raw: 017ffe0000000100 ffffea0007d35448 ffffea0007609fc8 ffff8881f60007c0 raw: ffff8881f4762980 ffff8881f47620c0 000000010000000a 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8881f4762480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881f4762500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8881f4762580: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb ^ ffff8881f4762600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881f4762680: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ================================================================== ------------[ cut here ]------------ refcount_t: underflow; use-after-free. WARNING: CPU: 1 PID: 25165 at lib/refcount.c:280 refcount_dec_not_one lib/refcount.c:280 [inline] WARNING: CPU: 1 PID: 25165 at lib/refcount.c:280 refcount_dec_not_one+0x141/0x160 lib/refcount.c:267 Modules linked in: CPU: 1 PID: 25165 Comm: syz-executor.3 Tainted: G B 4.19.182-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 RIP: 0010:refcount_dec_not_one lib/refcount.c:280 [inline] RIP: 0010:refcount_dec_not_one+0x141/0x160 lib/refcount.c:267 Code: 83 f8 01 74 29 44 8d 60 ff 44 39 e0 73 8f 80 3d 69 fd fc 05 00 75 ab 48 c7 c7 20 45 8b 87 c6 05 59 fd fc 05 01 e8 37 f6 97 03 <0f> 0b eb 94 31 c0 eb 95 48 89 df e8 6f b1 4b fe e9 3d ff ff ff e8 RSP: 0018:ffff8881d9fef118 EFLAGS: 00010282 RAX: 0000000000000000 RBX: ffff8881f47625dc RCX: 0000000000000000 RDX: 0000000000000004 RSI: ffffffff878b60c0 RDI: ffffffff8a3e0aa0 RBP: ffff8881d9fef1a0 R08: ffffed103ece5081 R09: ffffed103ece5080 R10: ffffed103ece5080 R11: ffff8881f6728407 R12: 00000000ffffffff R13: ffff8881d9fef138 R14: 1ffff1103b3fde23 R15: ffff8881d9fef178 FS: 00007fcd7a9f9700(0000) GS:ffff8881f6700000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 000000000055d000 CR3: 00000001cf645002 CR4: 00000000001606e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: refcount_dec_and_lock+0x17/0x50 lib/refcount.c:339 __tcf_action_put+0x42/0x100 net/sched/act_api.c:106 __tcf_idr_release net/sched/act_api.c:142 [inline] __tcf_idr_release+0x6a/0x90 net/sched/act_api.c:122 tcf_action_destroy+0x7d/0xf0 net/sched/act_api.c:656 tcf_action_init+0x292/0x300 net/sched/act_api.c:949 tcf_action_add+0xf2/0x320 net/sched/act_api.c:1314 tc_ctl_action+0x28d/0x3d0 net/sched/act_api.c:1369 rtnetlink_rcv_msg+0x34f/0x950 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/0x660 net/netlink/af_netlink.c:1344 netlink_sendmsg+0x667/0xc60 net/netlink/af_netlink.c:1909 sock_sendmsg_nosec net/socket.c:622 [inline] sock_sendmsg+0xac/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 RIP: 0033:0x465ad9 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fcd7a9f9188 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 000000000055cf20 RCX: 0000000000465ad9 RDX: 0000000000000000 RSI: 0000000020002980 RDI: 0000000000000003 RBP: 00000000004af756 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 000000000055cf20 R13: 00007fffe7d5663f R14: 00007fcd7a9f9300 R15: 0000000000022000 irq event stamp: 172 hardirqs last enabled at (171): [] __raw_spin_unlock_irq include/linux/spinlock_api_smp.h:168 [inline] hardirqs last enabled at (171): [] _raw_spin_unlock_irq+0x27/0x90 kernel/locking/spinlock.c:192 hardirqs last disabled at (172): [] __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:108 [inline] hardirqs last disabled at (172): [] _raw_spin_lock_irqsave+0x74/0xd0 kernel/locking/spinlock.c:152 softirqs last enabled at (138): [] __do_softirq+0x62d/0x919 kernel/softirq.c:318 softirqs last disabled at (89): [] invoke_softirq kernel/softirq.c:372 [inline] softirqs last disabled at (89): [] irq_exit+0x17f/0x1c0 kernel/softirq.c:412 ---[ end trace cf568e6232aebdce ]--- netlink: 32 bytes leftover after parsing attributes in process `syz-executor.0'. netlink: 32 bytes leftover after parsing attributes in process `syz-executor.2'. netlink: 32 bytes leftover after parsing attributes in process `syz-executor.5'. netlink: 32 bytes leftover after parsing attributes in process `syz-executor.1'. nla_parse: 43 callbacks suppressed netlink: 32 bytes leftover after parsing attributes in process `syz-executor.1'. netlink: 32 bytes leftover after parsing attributes in process `syz-executor.0'. netlink: 32 bytes leftover after parsing attributes in process `syz-executor.2'. netlink: 32 bytes leftover after parsing attributes in process `syz-executor.4'. netlink: 32 bytes leftover after parsing attributes in process `syz-executor.3'. netlink: 32 bytes leftover after parsing attributes in process `syz-executor.1'. netlink: 32 bytes leftover after parsing attributes in process `syz-executor.5'. netlink: 32 bytes leftover after parsing attributes in process `syz-executor.2'. netlink: 32 bytes leftover after parsing attributes in process `syz-executor.4'. netlink: 32 bytes leftover after parsing attributes in process `syz-executor.2'. nla_parse: 65 callbacks suppressed netlink: 32 bytes leftover after parsing attributes in process `syz-executor.4'. netlink: 32 bytes leftover after parsing attributes in process `syz-executor.3'. netlink: 32 bytes leftover after parsing attributes in process `syz-executor.1'. netlink: 32 bytes leftover after parsing attributes in process `syz-executor.2'. netlink: 32 bytes leftover after parsing attributes in process `syz-executor.5'.