================================================================== BUG: KASAN: slab-use-after-free in __lock_acquire+0x4208/0x5de0 kernel/locking/lockdep.c:5004 Read of size 8 at addr ffff88800014b818 by task udevd/5609 CPU: 1 PID: 5609 Comm: udevd Not tainted 6.6.0-rc5-syzkaller-00157-ge8c127b05766 #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:364 [inline] print_report+0xc4/0x620 mm/kasan/report.c:475 kasan_report+0xda/0x110 mm/kasan/report.c:588 __lock_acquire+0x4208/0x5de0 kernel/locking/lockdep.c:5004 lock_acquire kernel/locking/lockdep.c:5753 [inline] lock_acquire+0x1ae/0x510 kernel/locking/lockdep.c:5718 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x3a/0x50 kernel/locking/spinlock.c:162 p9_tag_remove net/9p/client.c:394 [inline] p9_req_put net/9p/client.c:402 [inline] p9_req_put+0xc6/0x250 net/9p/client.c:399 req_done+0x1e7/0x2e0 net/9p/trans_virtio.c:147 vring_interrupt drivers/virtio/virtio_ring.c:2595 [inline] vring_interrupt+0x317/0x3f0 drivers/virtio/virtio_ring.c:2570 __handle_irq_event_percpu+0x22a/0x740 kernel/irq/handle.c:158 handle_irq_event_percpu kernel/irq/handle.c:193 [inline] handle_irq_event+0xab/0x1e0 kernel/irq/handle.c:210 handle_edge_irq+0x261/0xcf0 kernel/irq/chip.c:831 generic_handle_irq_desc include/linux/irqdesc.h:161 [inline] handle_irq arch/x86/kernel/irq.c:238 [inline] __common_interrupt+0xdb/0x240 arch/x86/kernel/irq.c:257 common_interrupt+0xa9/0xd0 arch/x86/kernel/irq.c:247 asm_common_interrupt+0x26/0x40 arch/x86/include/asm/idtentry.h:636 RIP: 0010:__raw_spin_unlock include/linux/spinlock_api_smp.h:143 [inline] RIP: 0010:_raw_spin_unlock+0x1e/0x40 kernel/locking/spinlock.c:186 Code: 66 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa 53 48 8b 74 24 08 48 89 fb 48 83 c7 18 e8 aa de 24 f7 48 89 df e8 a2 5d 25 f7 01 00 00 00 e8 28 c6 16 f7 65 8b 05 19 19 c0 75 85 c0 74 02 5b RSP: 0018:ffffc90027737958 EFLAGS: 00000246 RAX: 0000000000000001 RBX: ffff8880150bb0b8 RCX: ffffffff81690193 RDX: dffffc0000000000 RSI: 0000000000000004 RDI: ffff8880150bb0b8 RBP: 000000000000006e R08: 0000000000000000 R09: ffffed1002a17617 R10: ffff8880150bb0bb R11: 0000000000000000 R12: 0000000000000001 R13: ffffc90027737c68 R14: ffff8880150c58f8 R15: 0000000000000006 spin_unlock include/linux/spinlock.h:391 [inline] lockref_get_not_dead+0x6a/0x80 lib/lockref.c:190 __legitimize_path+0x7f/0x1c0 fs/namei.c:710 legitimize_path fs/namei.c:720 [inline] legitimize_root fs/namei.c:748 [inline] try_to_unlazy+0x31d/0x650 fs/namei.c:783 may_lookup fs/namei.c:1720 [inline] link_path_walk.part.0.constprop.0+0x7c7/0xce0 fs/namei.c:2270 link_path_walk fs/namei.c:2253 [inline] path_openat+0x231/0x29c0 fs/namei.c:3792 do_filp_open+0x1de/0x430 fs/namei.c:3823 do_sys_openat2+0x176/0x1e0 fs/open.c:1422 do_sys_open fs/open.c:1437 [inline] __do_sys_openat fs/open.c:1453 [inline] __se_sys_openat fs/open.c:1448 [inline] __x64_sys_openat+0x175/0x210 fs/open.c:1448 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7fd098b169a4 Code: 24 20 48 8d 44 24 30 48 89 44 24 28 64 8b 04 25 18 00 00 00 85 c0 75 2c 44 89 e2 48 89 ee bf 9c ff ff ff b8 01 01 00 00 0f 05 <48> 3d 00 f0 ff ff 76 60 48 8b 15 55 a4 0d 00 f7 d8 64 89 02 48 83 RSP: 002b:00007ffc4c802a40 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 0000558c6f2f9060 RCX: 00007fd098b169a4 RDX: 0000000000080000 RSI: 0000558c6f2e5460 RDI: 00000000ffffff9c RBP: 0000558c6f2e5460 R08: 0000558c6f2e5460 R09: 0000000000020000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000080000 R13: 0000000000000701 R14: 0000000000000000 R15: 0000000000000001 Allocated by task 14859: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 ____kasan_kmalloc mm/kasan/common.c:374 [inline] __kasan_kmalloc+0xa2/0xb0 mm/kasan/common.c:383 kmalloc include/linux/slab.h:599 [inline] p9_client_create+0xcf/0x1210 net/9p/client.c:978 v9fs_session_init+0x1f8/0x1a80 fs/9p/v9fs.c:410 v9fs_mount+0xc6/0xcd0 fs/9p/vfs_super.c:123 legacy_get_tree+0x109/0x220 fs/fs_context.c:638 vfs_get_tree+0x8c/0x370 fs/super.c:1750 do_new_mount fs/namespace.c:3335 [inline] path_mount+0x1492/0x1ed0 fs/namespace.c:3662 do_mount fs/namespace.c:3675 [inline] __do_sys_mount fs/namespace.c:3884 [inline] __se_sys_mount fs/namespace.c:3861 [inline] __ia32_sys_mount+0x291/0x310 fs/namespace.c:3861 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x61/0xe0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x70/0x82 Freed by task 14859: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 kasan_save_free_info+0x2b/0x40 mm/kasan/generic.c:522 ____kasan_slab_free mm/kasan/common.c:236 [inline] ____kasan_slab_free+0x15b/0x1b0 mm/kasan/common.c:200 kasan_slab_free include/linux/kasan.h:164 [inline] slab_free_hook mm/slub.c:1800 [inline] slab_free_freelist_hook+0x114/0x1e0 mm/slub.c:1826 slab_free mm/slub.c:3809 [inline] __kmem_cache_free+0xb8/0x2f0 mm/slub.c:3822 p9_client_create+0xa14/0x1210 net/9p/client.c:1049 v9fs_session_init+0x1f8/0x1a80 fs/9p/v9fs.c:410 v9fs_mount+0xc6/0xcd0 fs/9p/vfs_super.c:123 legacy_get_tree+0x109/0x220 fs/fs_context.c:638 vfs_get_tree+0x8c/0x370 fs/super.c:1750 do_new_mount fs/namespace.c:3335 [inline] path_mount+0x1492/0x1ed0 fs/namespace.c:3662 do_mount fs/namespace.c:3675 [inline] __do_sys_mount fs/namespace.c:3884 [inline] __se_sys_mount fs/namespace.c:3861 [inline] __ia32_sys_mount+0x291/0x310 fs/namespace.c:3861 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x61/0xe0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x70/0x82 Last potentially related work creation: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 __kasan_record_aux_stack+0xbc/0xd0 mm/kasan/generic.c:492 kvfree_call_rcu+0x70/0xbe0 kernel/rcu/tree.c:3372 ma_put net/ipv6/mcast.c:869 [inline] ma_put+0x11a/0x170 net/ipv6/mcast.c:865 __ipv6_dev_mc_dec+0x297/0x360 net/ipv6/mcast.c:982 addrconf_leave_solict net/ipv6/addrconf.c:2201 [inline] __ipv6_ifa_notify+0x374/0x11d0 net/ipv6/addrconf.c:6221 addrconf_ifdown.isra.0+0xeed/0x1c50 net/ipv6/addrconf.c:3916 addrconf_notify+0x22d/0x1920 net/ipv6/addrconf.c:3715 notifier_call_chain+0xb6/0x3b0 kernel/notifier.c:93 call_netdevice_notifiers_info+0xb9/0x130 net/core/dev.c:1970 call_netdevice_notifiers_extack net/core/dev.c:2008 [inline] call_netdevice_notifiers net/core/dev.c:2022 [inline] __dev_notify_flags+0x1f5/0x2e0 net/core/dev.c:8642 dev_change_flags+0x122/0x170 net/core/dev.c:8678 do_setlink+0x1a2a/0x3fa0 net/core/rtnetlink.c:2880 rtnl_setlink+0x28f/0x3f0 net/core/rtnetlink.c:3176 rtnetlink_rcv_msg+0x3c4/0xdf0 net/core/rtnetlink.c:6444 netlink_rcv_skb+0x16b/0x440 net/netlink/af_netlink.c:2545 netlink_unicast_kernel net/netlink/af_netlink.c:1342 [inline] netlink_unicast+0x536/0x810 net/netlink/af_netlink.c:1368 netlink_sendmsg+0x93c/0xe40 net/netlink/af_netlink.c:1910 sock_sendmsg_nosec net/socket.c:730 [inline] __sock_sendmsg+0xd5/0x180 net/socket.c:745 sock_write_iter+0x29b/0x3d0 net/socket.c:1158 call_write_iter include/linux/fs.h:1956 [inline] do_iter_readv_writev+0x21e/0x3c0 fs/read_write.c:735 do_iter_write+0x17f/0x830 fs/read_write.c:860 vfs_writev+0x221/0x700 fs/read_write.c:933 do_writev+0x285/0x370 fs/read_write.c:976 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x61/0xe0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x70/0x82 The buggy address belongs to the object at ffff88800014b800 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 24 bytes inside of freed 512-byte region [ffff88800014b800, ffff88800014ba00) The buggy address belongs to the physical page: page:ffffea0000005200 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x148 head:ffffea0000005200 order:2 entire_mapcount:0 nr_pages_mapped:0 pincount:0 anon flags: 0x7ff00000000840(slab|head|node=0|zone=0|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 007ff00000000840 ffff888012c42c80 0000000000000000 dead000000000001 raw: 0000000000000000 0000000080100010 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 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 13330, tgid 13329 (syz-executor.1), ts 309874409795, free_ts 307234420013 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x2cf/0x340 mm/page_alloc.c:1536 prep_new_page mm/page_alloc.c:1543 [inline] get_page_from_freelist+0xee0/0x2f20 mm/page_alloc.c:3170 __alloc_pages+0x1d0/0x4a0 mm/page_alloc.c:4426 alloc_pages+0x1a9/0x270 mm/mempolicy.c:2297 alloc_slab_page mm/slub.c:1870 [inline] allocate_slab+0x251/0x380 mm/slub.c:2017 new_slab mm/slub.c:2070 [inline] ___slab_alloc+0x8c7/0x1580 mm/slub.c:3223 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3322 __slab_alloc_node mm/slub.c:3375 [inline] slab_alloc_node mm/slub.c:3468 [inline] __kmem_cache_alloc_node+0x131/0x340 mm/slub.c:3517 __do_kmalloc_node mm/slab_common.c:1022 [inline] __kmalloc+0x4f/0x100 mm/slab_common.c:1036 kmalloc include/linux/slab.h:603 [inline] kzalloc include/linux/slab.h:720 [inline] copy_splice_read+0x1ac/0x8f0 fs/splice.c:338 vfs_splice_read fs/splice.c:992 [inline] vfs_splice_read+0x2ea/0x3b0 fs/splice.c:962 splice_direct_to_actor+0x2a5/0xa30 fs/splice.c:1069 do_splice_direct+0x1af/0x280 fs/splice.c:1194 do_sendfile+0xb88/0x1390 fs/read_write.c:1254 __do_compat_sys_sendfile fs/read_write.c:1343 [inline] __se_compat_sys_sendfile fs/read_write.c:1326 [inline] __ia32_compat_sys_sendfile+0x1e3/0x220 fs/read_write.c:1326 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x61/0xe0 arch/x86/entry/common.c:178 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1136 [inline] free_unref_page_prepare+0x476/0xa40 mm/page_alloc.c:2312 free_unref_page_list+0xe6/0xb30 mm/page_alloc.c:2451 release_pages+0x32a/0x14e0 mm/swap.c:1042 __folio_batch_release+0x77/0xe0 mm/swap.c:1062 folio_batch_release include/linux/pagevec.h:83 [inline] truncate_inode_pages_range+0x34b/0x1030 mm/truncate.c:371 evict_inode_truncate_pages fs/btrfs/inode.c:5085 [inline] btrfs_evict_inode+0x1c0/0xe30 fs/btrfs/inode.c:5208 evict+0x2ed/0x6b0 fs/inode.c:664 iput_final fs/inode.c:1775 [inline] iput.part.0+0x55e/0x7a0 fs/inode.c:1801 iput+0x5c/0x80 fs/inode.c:1791 close_ctree+0x8eb/0xdd0 fs/btrfs/disk-io.c:4415 generic_shutdown_super+0x161/0x3c0 fs/super.c:693 kill_anon_super+0x3a/0x60 fs/super.c:1292 btrfs_kill_super+0x3b/0x50 fs/btrfs/super.c:2144 deactivate_locked_super+0x9a/0x170 fs/super.c:481 deactivate_super+0xde/0x100 fs/super.c:514 cleanup_mnt+0x222/0x3d0 fs/namespace.c:1254 Memory state around the buggy address: ffff88800014b700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88800014b780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88800014b800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88800014b880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88800014b900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess): 0: 66 66 2e 0f 1f 84 00 data16 cs nopw 0x0(%rax,%rax,1) 7: 00 00 00 00 b: 90 nop c: f3 0f 1e fa endbr64 10: 53 push %rbx 11: 48 8b 74 24 08 mov 0x8(%rsp),%rsi 16: 48 89 fb mov %rdi,%rbx 19: 48 83 c7 18 add $0x18,%rdi 1d: e8 aa de 24 f7 call 0xf724decc 22: 48 89 df mov %rbx,%rdi 25: e8 a2 5d 25 f7 call 0xf7255dcc * 2a: bf 01 00 00 00 mov $0x1,%edi <-- trapping instruction 2f: e8 28 c6 16 f7 call 0xf716c65c 34: 65 8b 05 19 19 c0 75 mov %gs:0x75c01919(%rip),%eax # 0x75c01954 3b: 85 c0 test %eax,%eax 3d: 74 02 je 0x41 3f: 5b pop %rbx