netlink: 20 bytes leftover after parsing attributes in process `syz-executor.4'. ================================================================== BUG: KASAN: use-after-free in test_and_clear_bit include/asm-generic/bitops-instrumented.h:185 [inline] BUG: KASAN: use-after-free in napi_hash_del net/core/dev.c:6228 [inline] BUG: KASAN: use-after-free in netif_napi_del+0x2c/0x7a0 net/core/dev.c:6323 Write of size 8 at addr ffff8881bfacbf10 by task syz-executor.4/13840 CPU: 0 PID: 13840 Comm: syz-executor.4 Not tainted 5.4.197-syzkaller-00011-gf3c75e616e3f #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/22/2022 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x18e/0x1d5 lib/dump_stack.c:118 print_address_description+0x8c/0x630 mm/kasan/report.c:384 __kasan_report+0xf6/0x130 mm/kasan/report.c:516 kasan_report+0x30/0x60 mm/kasan/common.c:653 check_memory_region_inline mm/kasan/generic.c:141 [inline] check_memory_region+0x298/0x2d0 mm/kasan/generic.c:191 test_and_clear_bit include/asm-generic/bitops-instrumented.h:185 [inline] napi_hash_del net/core/dev.c:6228 [inline] netif_napi_del+0x2c/0x7a0 net/core/dev.c:6323 free_netdev+0x188/0x310 net/core/dev.c:9697 netdev_run_todo+0xa79/0xc80 net/core/dev.c:9447 rtnl_unlock net/core/rtnetlink.c:112 [inline] rtnetlink_rcv_msg+0xa49/0xb90 net/core/rtnetlink.c:5263 netlink_rcv_skb+0x190/0x3a0 net/netlink/af_netlink.c:2499 netlink_unicast_kernel net/netlink/af_netlink.c:1312 [inline] netlink_unicast+0x771/0x8d0 net/netlink/af_netlink.c:1338 netlink_sendmsg+0x913/0xb90 net/netlink/af_netlink.c:1933 sock_sendmsg_nosec net/socket.c:638 [inline] sock_sendmsg net/socket.c:658 [inline] ____sys_sendmsg+0x4ee/0x7c0 net/socket.c:2287 ___sys_sendmsg net/socket.c:2341 [inline] __sys_sendmsg+0x235/0x2f0 net/socket.c:2387 do_syscall_64+0xcb/0x1c0 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x7f44d08c3279 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 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f44cfa39168 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00007f44d09d5f80 RCX: 00007f44d08c3279 RDX: 0000000000000000 RSI: 0000000020000180 RDI: 0000000000000004 RBP: 00007f44d091d189 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffdf83242cf R14: 00007f44cfa39300 R15: 0000000000022000 The buggy address belongs to the page: page:ffffea0006feb2c0 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 flags: 0x8000000000000000() raw: 8000000000000000 ffffea0006feb288 ffffea0006fece08 0000000000000000 raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as freed page last allocated via order 0, migratetype Unmovable, gfp_mask 0x102800(GFP_NOWAIT|__GFP_NOWARN|__GFP_HARDWALL) set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook mm/page_alloc.c:2165 [inline] prep_new_page+0x194/0x380 mm/page_alloc.c:2171 get_page_from_freelist+0x524/0x560 mm/page_alloc.c:3794 __alloc_pages_nodemask+0x2ab/0x6f0 mm/page_alloc.c:4857 __alloc_pages include/linux/gfp.h:503 [inline] __alloc_pages_node include/linux/gfp.h:516 [inline] alloc_pages_node include/linux/gfp.h:530 [inline] __get_free_pages+0xa/0x30 mm/page_alloc.c:4901 tlb_next_batch mm/mmu_gather.c:29 [inline] __tlb_remove_page_size+0x168/0x2f0 mm/mmu_gather.c:83 __tlb_remove_page include/asm-generic/tlb.h:422 [inline] zap_pte_range+0x8dc/0x1c10 mm/memory.c:1107 zap_pmd_range mm/memory.c:1221 [inline] zap_pud_range mm/memory.c:1250 [inline] zap_p4d_range mm/memory.c:1271 [inline] unmap_page_range+0x35e/0x450 mm/memory.c:1292 unmap_single_vma mm/memory.c:1337 [inline] unmap_vmas+0x306/0x440 mm/memory.c:1369 exit_mmap+0x286/0x4f0 mm/mmap.c:3166 __mmput+0x34/0x240 kernel/fork.c:1090 exit_mm kernel/exit.c:489 [inline] do_exit+0xb40/0x2b40 kernel/exit.c:799 do_group_exit+0x136/0x300 kernel/exit.c:910 get_signal+0xd99/0x13f0 kernel/signal.c:2735 do_signal+0x3b/0x540 arch/x86/kernel/signal.c:809 exit_to_usermode_loop+0xdd/0x1d0 arch/x86/entry/common.c:159 prepare_exit_to_usermode+0x17c/0x1d0 arch/x86/entry/common.c:194 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1176 [inline] free_pcp_prepare+0x1a4/0x290 mm/page_alloc.c:1233 free_unref_page_prepare mm/page_alloc.c:3085 [inline] free_unref_page mm/page_alloc.c:3134 [inline] free_the_page mm/page_alloc.c:4917 [inline] __free_pages+0x52/0x1e0 mm/page_alloc.c:4925 tlb_batch_list_free mm/mmu_gather.c:61 [inline] tlb_finish_mmu+0x124/0x200 mm/mmu_gather.c:275 exit_mmap+0x2a6/0x4f0 mm/mmap.c:3168 __mmput+0x34/0x240 kernel/fork.c:1090 exit_mm kernel/exit.c:489 [inline] do_exit+0xb40/0x2b40 kernel/exit.c:799 do_group_exit+0x136/0x300 kernel/exit.c:910 get_signal+0xd99/0x13f0 kernel/signal.c:2735 do_signal+0x3b/0x540 arch/x86/kernel/signal.c:809 exit_to_usermode_loop+0xdd/0x1d0 arch/x86/entry/common.c:159 prepare_exit_to_usermode+0x17c/0x1d0 arch/x86/entry/common.c:194 ret_from_fork+0x15/0x30 arch/x86/entry/entry_64.S:344 Memory state around the buggy address: ffff8881bfacbe00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff8881bfacbe80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff8881bfacbf00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff8881bfacbf80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff8881bfacc000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ================================================================== ------------[ cut here ]------------ refcount_t: underflow; use-after-free. WARNING: CPU: 0 PID: 13840 at lib/refcount.c:190 refcount_sub_and_test_checked+0x1b8/0x210 lib/refcount.c:190 Modules linked in: CPU: 0 PID: 13840 Comm: syz-executor.4 Tainted: G B 5.4.197-syzkaller-00011-gf3c75e616e3f #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/22/2022 RIP: 0010:refcount_sub_and_test_checked+0x1b8/0x210 lib/refcount.c:190 Code: ff 31 db eb c9 e8 f8 2b 48 ff 31 db eb c0 e8 ef 2b 48 ff c6 05 0f c5 cc 03 01 31 db 48 c7 c7 20 e8 bd 84 31 c0 e8 b8 57 21 ff <0f> 0b eb a0 44 89 e1 80 e1 07 80 c1 03 38 c1 0f 8c 84 fe ff ff 4c RSP: 0018:ffff8881e46e7710 EFLAGS: 00010246 RAX: 0c3f164296619200 RBX: 0000000000000000 RCX: ffff8881e40e8000 RDX: 0000000000000000 RSI: 0000000080000000 RDI: 0000000000000000 RBP: 00000000ffffffff R08: ffffffff814a983a R09: ffffed103c8dcebe R10: ffffed103c8dcebe R11: 1ffff1103c8dcebd R12: ffffea0006d3fe24 R13: dffffc0000000000 R14: 1ffff1103c8dcee2 R15: 0000000000000001 FS: 00007f44cfa39700(0000) GS:ffff8881f6e00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f44cf931718 CR3: 00000001e7bd4000 CR4: 00000000003406f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: skb_unref include/linux/skbuff.h:1023 [inline] kfree_skb+0x8d/0x330 net/core/skbuff.c:703 napi_free_frags include/linux/netdevice.h:3726 [inline] netif_napi_del+0x23c/0x7a0 net/core/dev.c:6326 free_netdev+0x188/0x310 net/core/dev.c:9697 netdev_run_todo+0xa79/0xc80 net/core/dev.c:9447 rtnl_unlock net/core/rtnetlink.c:112 [inline] rtnetlink_rcv_msg+0xa49/0xb90 net/core/rtnetlink.c:5263 netlink_rcv_skb+0x190/0x3a0 net/netlink/af_netlink.c:2499 netlink_unicast_kernel net/netlink/af_netlink.c:1312 [inline] netlink_unicast+0x771/0x8d0 net/netlink/af_netlink.c:1338 netlink_sendmsg+0x913/0xb90 net/netlink/af_netlink.c:1933 sock_sendmsg_nosec net/socket.c:638 [inline] sock_sendmsg net/socket.c:658 [inline] ____sys_sendmsg+0x4ee/0x7c0 net/socket.c:2287 ___sys_sendmsg net/socket.c:2341 [inline] __sys_sendmsg+0x235/0x2f0 net/socket.c:2387 do_syscall_64+0xcb/0x1c0 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x7f44d08c3279 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 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f44cfa39168 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00007f44d09d5f80 RCX: 00007f44d08c3279 RDX: 0000000000000000 RSI: 0000000020000180 RDI: 0000000000000004 RBP: 00007f44d091d189 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffdf83242cf R14: 00007f44cfa39300 R15: 0000000000022000 ---[ end trace 79a0d43f64387b92 ]--- 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: 13840 Comm: syz-executor.4 Tainted: G B W 5.4.197-syzkaller-00011-gf3c75e616e3f #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/22/2022 RIP: 0010:flush_gro_hash net/core/dev.c:6313 [inline] RIP: 0010:netif_napi_del+0x28f/0x7a0 net/core/dev.c:6328 Code: 00 74 08 4c 89 ff e8 a0 1b 32 fe 49 8b 2f 49 39 ef 75 10 e8 53 b2 05 fe eb 35 90 e8 4b b2 05 fe 48 89 dd 48 89 e8 48 c1 e8 03 <42> 80 3c 28 00 74 08 48 89 ef e8 72 1b 32 fe 48 8b 5d 00 48 89 ef RSP: 0018:ffff8881e46e7790 EFLAGS: 00010a06 RAX: 1000000000000000 RBX: 8000000000000000 RCX: ffff8881e40e8000 RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000000 RBP: 8000000000000000 R08: ffffffff821825ed R09: fffff94000daae55 R10: fffff94000daae55 R11: 1ffffd4000daae54 R12: ffff8881bfacbf00 R13: dffffc0000000000 R14: ffff8881bfacbf00 R15: ffff8881bfacbf38 FS: 00007f44cfa39700(0000) GS:ffff8881f6f00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f58f9ed3058 CR3: 00000001e7bd4000 CR4: 00000000003406e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: free_netdev+0x188/0x310 net/core/dev.c:9697 netdev_run_todo+0xa79/0xc80 net/core/dev.c:9447 rtnl_unlock net/core/rtnetlink.c:112 [inline] rtnetlink_rcv_msg+0xa49/0xb90 net/core/rtnetlink.c:5263 netlink_rcv_skb+0x190/0x3a0 net/netlink/af_netlink.c:2499 netlink_unicast_kernel net/netlink/af_netlink.c:1312 [inline] netlink_unicast+0x771/0x8d0 net/netlink/af_netlink.c:1338 netlink_sendmsg+0x913/0xb90 net/netlink/af_netlink.c:1933 sock_sendmsg_nosec net/socket.c:638 [inline] sock_sendmsg net/socket.c:658 [inline] ____sys_sendmsg+0x4ee/0x7c0 net/socket.c:2287 ___sys_sendmsg net/socket.c:2341 [inline] __sys_sendmsg+0x235/0x2f0 net/socket.c:2387 do_syscall_64+0xcb/0x1c0 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x7f44d08c3279 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 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f44cfa39168 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00007f44d09d5f80 RCX: 00007f44d08c3279 RDX: 0000000000000000 RSI: 0000000020000180 RDI: 0000000000000004 RBP: 00007f44d091d189 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffdf83242cf R14: 00007f44cfa39300 R15: 0000000000022000 Modules linked in: ---[ end trace 79a0d43f64387b93 ]--- RIP: 0010:flush_gro_hash net/core/dev.c:6313 [inline] RIP: 0010:netif_napi_del+0x28f/0x7a0 net/core/dev.c:6328 Code: 00 74 08 4c 89 ff e8 a0 1b 32 fe 49 8b 2f 49 39 ef 75 10 e8 53 b2 05 fe eb 35 90 e8 4b b2 05 fe 48 89 dd 48 89 e8 48 c1 e8 03 <42> 80 3c 28 00 74 08 48 89 ef e8 72 1b 32 fe 48 8b 5d 00 48 89 ef RSP: 0018:ffff8881e46e7790 EFLAGS: 00010a06 RAX: 1000000000000000 RBX: 8000000000000000 RCX: ffff8881e40e8000 RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000000 RBP: 8000000000000000 R08: ffffffff821825ed R09: fffff94000daae55 R10: fffff94000daae55 R11: 1ffffd4000daae54 R12: ffff8881bfacbf00 R13: dffffc0000000000 R14: ffff8881bfacbf00 R15: ffff8881bfacbf38 FS: 00007f44cfa39700(0000) GS:ffff8881f6f00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007ffc6a4d7638 CR3: 00000001e7bd4000 CR4: 00000000003406e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 ---------------- Code disassembly (best guess): 0: 00 74 08 4c add %dh,0x4c(%rax,%rcx,1) 4: 89 ff mov %edi,%edi 6: e8 a0 1b 32 fe callq 0xfe321bab b: 49 8b 2f mov (%r15),%rbp e: 49 39 ef cmp %rbp,%r15 11: 75 10 jne 0x23 13: e8 53 b2 05 fe callq 0xfe05b26b 18: eb 35 jmp 0x4f 1a: 90 nop 1b: e8 4b b2 05 fe callq 0xfe05b26b 20: 48 89 dd mov %rbx,%rbp 23: 48 89 e8 mov %rbp,%rax 26: 48 c1 e8 03 shr $0x3,%rax * 2a: 42 80 3c 28 00 cmpb $0x0,(%rax,%r13,1) <-- trapping instruction 2f: 74 08 je 0x39 31: 48 89 ef mov %rbp,%rdi 34: e8 72 1b 32 fe callq 0xfe321bab 39: 48 8b 5d 00 mov 0x0(%rbp),%rbx 3d: 48 89 ef mov %rbp,%rdi