================================================================== BUG: KASAN: double-free or invalid-free in slab_free mm/slub.c:3213 [inline] BUG: KASAN: double-free or invalid-free in kfree+0xe4/0x540 mm/slub.c:4267 CPU: 0 PID: 1964 Comm: systemd-udevd Not tainted 5.14.0-rc7-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:105 print_address_description.constprop.0.cold+0x6c/0x309 mm/kasan/report.c:233 kasan_report_invalid_free+0x51/0x80 mm/kasan/report.c:358 ____kasan_slab_free mm/kasan/common.c:346 [inline] __kasan_slab_free+0x124/0x130 mm/kasan/common.c:374 kasan_slab_free include/linux/kasan.h:230 [inline] slab_free_hook mm/slub.c:1628 [inline] slab_free_freelist_hook+0xe3/0x250 mm/slub.c:1653 slab_free mm/slub.c:3213 [inline] kfree+0xe4/0x540 mm/slub.c:4267 bdev_free_inode+0xe0/0x110 fs/block_dev.c:816 i_callback+0x3f/0x70 fs/inode.c:222 rcu_do_batch kernel/rcu/tree.c:2550 [inline] rcu_core+0x7ab/0x1380 kernel/rcu/tree.c:2785 __do_softirq+0x29b/0x9c2 kernel/softirq.c:558 invoke_softirq kernel/softirq.c:432 [inline] __irq_exit_rcu+0x16e/0x1c0 kernel/softirq.c:636 irq_exit_rcu+0x5/0x20 kernel/softirq.c:648 sysvec_apic_timer_interrupt+0x93/0xc0 arch/x86/kernel/apic/apic.c:1100 asm_sysvec_apic_timer_interrupt+0x12/0x20 arch/x86/include/asm/idtentry.h:638 RIP: 0010:lock_release+0x3f1/0x720 kernel/locking/lockdep.c:5633 Code: 7e 83 f8 01 0f 85 8d 01 00 00 9c 58 f6 c4 02 0f 85 78 01 00 00 48 f7 04 24 00 02 00 00 74 01 fb 48 b8 00 00 00 00 00 fc ff df <48> 01 c5 48 c7 45 00 00 00 00 00 c7 45 08 00 00 00 00 48 8b 84 24 RSP: 0018:ffffc90001abf6c0 EFLAGS: 00000206 RAX: dffffc0000000000 RBX: ffffffffffffffff RCX: ffffc90001abf710 RDX: 1ffff11003ae04c4 RSI: 0000000000000001 RDI: 0000000000000000 RBP: 1ffff92000357eda R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000001 R11: 0000000000000000 R12: 0000000000000000 R13: 0000000000000001 R14: ffff88801d702628 R15: ffff88801d701c40 __raw_spin_unlock include/linux/spinlock_api_smp.h:150 [inline] _raw_spin_unlock+0x12/0x40 kernel/locking/spinlock.c:183 spin_unlock include/linux/spinlock.h:394 [inline] __dentry_kill+0x4c3/0x640 fs/dcache.c:594 dentry_kill fs/dcache.c:720 [inline] dput+0x66b/0xbc0 fs/dcache.c:888 handle_mounts fs/namei.c:1491 [inline] step_into+0xcb3/0x1c80 fs/namei.c:1789 walk_component+0x171/0x6a0 fs/namei.c:1965 link_path_walk.part.0+0x757/0xd00 fs/namei.c:2286 link_path_walk fs/namei.c:2211 [inline] path_openat+0x260/0x27f0 fs/namei.c:3503 do_filp_open+0x1aa/0x400 fs/namei.c:3534 do_sys_openat2+0x16d/0x420 fs/open.c:1204 do_sys_open fs/open.c:1220 [inline] __do_sys_openat fs/open.c:1236 [inline] __se_sys_openat fs/open.c:1231 [inline] __x64_sys_openat+0x13f/0x1f0 fs/open.c:1231 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7ff5b4f3c7da Code: 75 3e 89 d0 45 31 d2 25 00 00 41 00 3d 00 00 41 00 74 2d 8b 05 37 2f 2c 00 85 c0 75 51 48 63 d2 48 63 ff b8 01 01 00 00 0f 05 <48> 3d 00 f0 ff ff 0f 87 8a 00 00 00 48 83 c4 60 5b 5d 41 5c c3 90 RSP: 002b:00007ffe8e5d08a0 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 00007ffe8e5d2a70 RCX: 00007ff5b4f3c7da RDX: 0000000000080000 RSI: 00007ff5b5a9831f RDI: 0000000000000010 RBP: 00007ff5b5a9831f R08: 0000000000000000 R09: 0000000000000020 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000080000 R13: 00007ffe8e5d2a88 R14: 0000000000000000 R15: 0000000000000000 Allocated by task 3918: kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38 kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:434 [inline] ____kasan_kmalloc mm/kasan/common.c:513 [inline] ____kasan_kmalloc mm/kasan/common.c:472 [inline] __kasan_kmalloc+0xa4/0xd0 mm/kasan/common.c:522 kmalloc_node include/linux/slab.h:609 [inline] kzalloc_node include/linux/slab.h:732 [inline] __alloc_disk_node+0x4e/0x380 block/genhd.c:1246 __blk_mq_alloc_disk+0xec/0x190 block/blk-mq.c:3127 nbd_dev_add+0x2a9/0x940 drivers/block/nbd.c:1707 nbd_genl_connect+0x551/0x1820 drivers/block/nbd.c:1846 genl_family_rcv_msg_doit+0x228/0x320 net/netlink/genetlink.c:731 genl_family_rcv_msg net/netlink/genetlink.c:775 [inline] genl_rcv_msg+0x328/0x580 net/netlink/genetlink.c:792 netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2504 genl_rcv+0x24/0x40 net/netlink/genetlink.c:803 netlink_unicast_kernel net/netlink/af_netlink.c:1314 [inline] netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1340 netlink_sendmsg+0x86d/0xdb0 net/netlink/af_netlink.c:1929 sock_sendmsg_nosec net/socket.c:704 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:724 ____sys_sendmsg+0x6e8/0x810 net/socket.c:2406 ___sys_sendmsg+0xf3/0x170 net/socket.c:2460 __sys_sendmsg+0xe5/0x1b0 net/socket.c:2489 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae Freed by task 3918: kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38 kasan_set_track+0x1c/0x30 mm/kasan/common.c:46 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:360 ____kasan_slab_free mm/kasan/common.c:366 [inline] ____kasan_slab_free mm/kasan/common.c:328 [inline] __kasan_slab_free+0xff/0x130 mm/kasan/common.c:374 kasan_slab_free include/linux/kasan.h:230 [inline] slab_free_hook mm/slub.c:1628 [inline] slab_free_freelist_hook+0xe3/0x250 mm/slub.c:1653 slab_free mm/slub.c:3213 [inline] kfree+0xe4/0x540 mm/slub.c:4267 __alloc_disk_node+0x2e8/0x380 block/genhd.c:1271 __blk_mq_alloc_disk+0xec/0x190 block/blk-mq.c:3127 nbd_dev_add+0x2a9/0x940 drivers/block/nbd.c:1707 nbd_genl_connect+0x551/0x1820 drivers/block/nbd.c:1846 genl_family_rcv_msg_doit+0x228/0x320 net/netlink/genetlink.c:731 genl_family_rcv_msg net/netlink/genetlink.c:775 [inline] genl_rcv_msg+0x328/0x580 net/netlink/genetlink.c:792 netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2504 genl_rcv+0x24/0x40 net/netlink/genetlink.c:803 netlink_unicast_kernel net/netlink/af_netlink.c:1314 [inline] netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1340 netlink_sendmsg+0x86d/0xdb0 net/netlink/af_netlink.c:1929 sock_sendmsg_nosec net/socket.c:704 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:724 ____sys_sendmsg+0x6e8/0x810 net/socket.c:2406 ___sys_sendmsg+0xf3/0x170 net/socket.c:2460 __sys_sendmsg+0xe5/0x1b0 net/socket.c:2489 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae The buggy address belongs to the object at ffff888027a84000 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 0 bytes inside of 512-byte region [ffff888027a84000, ffff888027a84200) The buggy address belongs to the page: page:ffffea00009ea100 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x27a84 head:ffffea00009ea100 order:2 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 0000000000000000 0000000400000001 ffff888010c41c80 raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 2, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 31798, ts 1317923680761, free_ts 1251251869826 prep_new_page mm/page_alloc.c:2436 [inline] get_page_from_freelist+0xa72/0x2f80 mm/page_alloc.c:4168 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5390 alloc_pages+0x18c/0x2a0 mm/mempolicy.c:2244 alloc_slab_page mm/slub.c:1691 [inline] allocate_slab+0x32e/0x4b0 mm/slub.c:1831 new_slab mm/slub.c:1894 [inline] new_slab_objects mm/slub.c:2640 [inline] ___slab_alloc+0x473/0x7b0 mm/slub.c:2803 __slab_alloc.constprop.0+0xa7/0xf0 mm/slub.c:2843 slab_alloc_node mm/slub.c:2925 [inline] __kmalloc_node_track_caller+0x2e3/0x360 mm/slub.c:4653 kmalloc_reserve net/core/skbuff.c:355 [inline] __alloc_skb+0xde/0x340 net/core/skbuff.c:426 alloc_skb include/linux/skbuff.h:1116 [inline] netlink_alloc_large_skb net/netlink/af_netlink.c:1186 [inline] netlink_sendmsg+0x967/0xdb0 net/netlink/af_netlink.c:1904 sock_sendmsg_nosec net/socket.c:704 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:724 ____sys_sendmsg+0x331/0x810 net/socket.c:2406 ___sys_sendmsg+0xf3/0x170 net/socket.c:2460 __sys_sendmmsg+0x195/0x470 net/socket.c:2546 __do_sys_sendmmsg net/socket.c:2575 [inline] __se_sys_sendmmsg net/socket.c:2572 [inline] __x64_sys_sendmmsg+0x99/0x100 net/socket.c:2572 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1346 [inline] free_pcp_prepare+0x2c5/0x780 mm/page_alloc.c:1397 free_unref_page_prepare mm/page_alloc.c:3332 [inline] free_unref_page+0x19/0x690 mm/page_alloc.c:3411 unfreeze_partials+0x16c/0x1b0 mm/slub.c:2421 put_cpu_partial+0x13d/0x230 mm/slub.c:2457 qlink_free mm/kasan/quarantine.c:146 [inline] qlist_free_all+0x5a/0xc0 mm/kasan/quarantine.c:165 kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:272 __kasan_slab_alloc+0x95/0xb0 mm/kasan/common.c:444 kasan_slab_alloc include/linux/kasan.h:254 [inline] slab_post_alloc_hook mm/slab.h:519 [inline] slab_alloc_node mm/slub.c:2959 [inline] slab_alloc mm/slub.c:2967 [inline] __kmalloc+0x1f4/0x330 mm/slub.c:4111 kmalloc include/linux/slab.h:596 [inline] tomoyo_realpath_from_path+0xc3/0x620 security/tomoyo/realpath.c:254 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_path_perm+0x21b/0x400 security/tomoyo/file.c:822 security_inode_getattr+0xcf/0x140 security/security.c:1333 vfs_getattr fs/stat.c:139 [inline] vfs_statx+0x164/0x390 fs/stat.c:207 vfs_fstatat fs/stat.c:225 [inline] vfs_lstat include/linux/fs.h:3386 [inline] __do_sys_newlstat+0x91/0x110 fs/stat.c:380 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae Memory state around the buggy address: ffff888027a83f00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888027a83f80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff888027a84000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888027a84080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888027a84100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess): 0: 7e 83 jle 0xffffff85 2: f8 clc 3: 01 0f add %ecx,(%rdi) 5: 85 8d 01 00 00 9c test %ecx,-0x63ffffff(%rbp) b: 58 pop %rax c: f6 c4 02 test $0x2,%ah f: 0f 85 78 01 00 00 jne 0x18d 15: 48 f7 04 24 00 02 00 testq $0x200,(%rsp) 1c: 00 1d: 74 01 je 0x20 1f: fb sti 20: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax 27: fc ff df * 2a: 48 01 c5 add %rax,%rbp <-- trapping instruction 2d: 48 c7 45 00 00 00 00 movq $0x0,0x0(%rbp) 34: 00 35: c7 45 08 00 00 00 00 movl $0x0,0x8(%rbp) 3c: 48 rex.W 3d: 8b .byte 0x8b 3e: 84 .byte 0x84 3f: 24 .byte 0x24