================================================================== BUG: KASAN: slab-use-after-free in __lock_acquire+0x2de0/0x3cb0 kernel/locking/lockdep.c:5007 Read of size 8 at addr ffff888025e8fc18 by task udevd/4837 CPU: 0 UID: 0 PID: 4837 Comm: udevd Not tainted 6.11.0-rc6-syzkaller-00308-gb31c44928842 #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:93 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:119 print_address_description mm/kasan/report.c:377 [inline] print_report+0xc3/0x620 mm/kasan/report.c:488 kasan_report+0xd9/0x110 mm/kasan/report.c:601 __lock_acquire+0x2de0/0x3cb0 kernel/locking/lockdep.c:5007 lock_acquire kernel/locking/lockdep.c:5759 [inline] lock_acquire+0x1b1/0x560 kernel/locking/lockdep.c:5724 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x3a/0x60 kernel/locking/spinlock.c:162 p9_tag_remove net/9p/client.c:397 [inline] p9_req_put net/9p/client.c:405 [inline] p9_req_put+0xaf/0x250 net/9p/client.c:402 req_done+0x1e7/0x2f0 net/9p/trans_virtio.c:147 vring_interrupt drivers/virtio/virtio_ring.c:2595 [inline] vring_interrupt+0x31b/0x400 drivers/virtio/virtio_ring.c:2570 __handle_irq_event_percpu+0x229/0x7c0 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+0x263/0xd10 kernel/irq/chip.c:831 generic_handle_irq_desc include/linux/irqdesc.h:173 [inline] handle_irq arch/x86/kernel/irq.c:247 [inline] call_irq_handler arch/x86/kernel/irq.c:259 [inline] __common_interrupt+0xdf/0x250 arch/x86/kernel/irq.c:285 common_interrupt+0xab/0xd0 arch/x86/kernel/irq.c:278 asm_common_interrupt+0x26/0x40 arch/x86/include/asm/idtentry.h:693 RIP: 0010:lock_acquire+0x33/0x560 kernel/locking/lockdep.c:5727 Code: 00 00 fc ff df 41 57 4d 89 cf 41 56 49 89 fe 41 55 41 89 d5 41 54 45 89 c4 55 53 48 81 ec b0 00 00 00 48 8d 5c 24 10 89 34 24 <48> c1 eb 03 89 4c 24 04 48 c7 44 24 10 b3 8a b5 41 48 01 d8 48 c7 RSP: 0018:ffffc900249e7998 EFLAGS: 00000282 RAX: dffffc0000000000 RBX: ffffc900249e79a8 RCX: 0000000000000001 RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff88801ceb01e0 RBP: 1ffff9200493cf51 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000001 R13: 0000000000000000 R14: ffff88801ceb01e0 R15: 0000000000000000 down_read+0x9a/0x330 kernel/locking/rwsem.c:1526 kernfs_iop_permission+0xba/0x120 fs/kernfs/inode.c:287 do_inode_permission fs/namei.c:468 [inline] inode_permission fs/namei.c:535 [inline] inode_permission+0x388/0x5f0 fs/namei.c:510 may_lookup fs/namei.c:1746 [inline] link_path_walk.part.0.constprop.0+0x1d7/0xd40 fs/namei.c:2352 link_path_walk fs/namei.c:2335 [inline] path_lookupat+0x93/0x770 fs/namei.c:2565 filename_lookup+0x1e5/0x5b0 fs/namei.c:2595 do_readlinkat+0xcf/0x390 fs/stat.c:537 __do_sys_readlink fs/stat.c:574 [inline] __se_sys_readlink fs/stat.c:571 [inline] __x64_sys_readlink+0x78/0xc0 fs/stat.c:571 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f4396f17d47 Code: 73 01 c3 48 8b 0d e1 90 0d 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 b8 59 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d b1 90 0d 00 f7 d8 64 89 01 48 RSP: 002b:00007ffd88cca908 EFLAGS: 00000246 ORIG_RAX: 0000000000000059 RAX: ffffffffffffffda RBX: 00007ffd88cca918 RCX: 00007f4396f17d47 RDX: 0000000000000400 RSI: 00007ffd88cca918 RDI: 00007ffd88ccadf8 RBP: 0000000000000400 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000812 R11: 0000000000000246 R12: 00007ffd88ccadf8 R13: 00007ffd88ccad68 R14: 000055cf28500910 R15: 0000000000000000 Allocated by task 5922: kasan_save_stack+0x33/0x60 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 poison_kmalloc_redzone mm/kasan/common.c:370 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:387 kmalloc_noprof include/linux/slab.h:681 [inline] p9_client_create+0xcf/0x11b0 net/9p/client.c:983 v9fs_session_init+0x1f8/0x1a80 fs/9p/v9fs.c:410 v9fs_mount+0xc6/0xa50 fs/9p/vfs_super.c:122 legacy_get_tree+0x109/0x220 fs/fs_context.c:662 vfs_get_tree+0x8f/0x380 fs/super.c:1800 do_new_mount fs/namespace.c:3472 [inline] path_mount+0x6e1/0x1f10 fs/namespace.c:3799 do_mount fs/namespace.c:3812 [inline] __do_sys_mount fs/namespace.c:4020 [inline] __se_sys_mount fs/namespace.c:3997 [inline] __ia32_sys_mount+0x292/0x310 fs/namespace.c:3997 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline] __do_fast_syscall_32+0x73/0x120 arch/x86/entry/common.c:386 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411 entry_SYSENTER_compat_after_hwframe+0x84/0x8e Freed by task 5922: kasan_save_stack+0x33/0x60 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 kasan_save_free_info+0x3b/0x60 mm/kasan/generic.c:579 poison_slab_object+0xf7/0x160 mm/kasan/common.c:240 __kasan_slab_free+0x32/0x50 mm/kasan/common.c:256 kasan_slab_free include/linux/kasan.h:184 [inline] slab_free_hook mm/slub.c:2256 [inline] slab_free mm/slub.c:4477 [inline] kfree+0x12a/0x3b0 mm/slub.c:4598 p9_client_create+0x9ca/0x11b0 net/9p/client.c:1054 v9fs_session_init+0x1f8/0x1a80 fs/9p/v9fs.c:410 v9fs_mount+0xc6/0xa50 fs/9p/vfs_super.c:122 legacy_get_tree+0x109/0x220 fs/fs_context.c:662 vfs_get_tree+0x8f/0x380 fs/super.c:1800 do_new_mount fs/namespace.c:3472 [inline] path_mount+0x6e1/0x1f10 fs/namespace.c:3799 do_mount fs/namespace.c:3812 [inline] __do_sys_mount fs/namespace.c:4020 [inline] __se_sys_mount fs/namespace.c:3997 [inline] __ia32_sys_mount+0x292/0x310 fs/namespace.c:3997 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline] __do_fast_syscall_32+0x73/0x120 arch/x86/entry/common.c:386 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411 entry_SYSENTER_compat_after_hwframe+0x84/0x8e The buggy address belongs to the object at ffff888025e8fc00 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 24 bytes inside of freed 512-byte region [ffff888025e8fc00, ffff888025e8fe00) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x25e8c head: order:2 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 anon flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xfdffffff(slab) raw: 00fff00000000040 ffff88801ac42c80 0000000000000000 dead000000000001 raw: 0000000000000000 0000000080100010 00000001fdffffff 0000000000000000 head: 00fff00000000040 ffff88801ac42c80 0000000000000000 dead000000000001 head: 0000000000000000 0000000080100010 00000001fdffffff 0000000000000000 head: 00fff00000000002 ffffea000097a301 ffffffffffffffff 0000000000000000 head: ffff888000000004 0000000000000000 00000000ffffffff 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 0x252800(GFP_NOWAIT|__GFP_NORETRY|__GFP_COMP|__GFP_THISNODE), pid 5709, tgid 5708 (syz.0.239), ts 66996514555, free_ts 66918595547 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x2d1/0x350 mm/page_alloc.c:1500 prep_new_page mm/page_alloc.c:1508 [inline] get_page_from_freelist+0x1351/0x2e50 mm/page_alloc.c:3446 __alloc_pages_slowpath mm/page_alloc.c:4235 [inline] __alloc_pages_noprof+0x6ad/0x2460 mm/page_alloc.c:4715 __alloc_pages_node_noprof include/linux/gfp.h:269 [inline] alloc_pages_node_noprof include/linux/gfp.h:296 [inline] alloc_slab_page+0x4e/0xf0 mm/slub.c:2325 allocate_slab mm/slub.c:2488 [inline] new_slab+0x84/0x260 mm/slub.c:2541 ___slab_alloc+0xdac/0x1870 mm/slub.c:3727 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3817 __slab_alloc_node mm/slub.c:3870 [inline] slab_alloc_node mm/slub.c:4029 [inline] __do_kmalloc_node mm/slub.c:4161 [inline] __kmalloc_node_noprof+0x367/0x440 mm/slub.c:4168 kmalloc_array_node_noprof include/linux/slab.h:788 [inline] alloc_slab_obj_exts+0x41/0xa0 mm/slub.c:1976 __memcg_slab_post_alloc_hook+0x2bc/0x9c0 mm/memcontrol.c:3019 memcg_slab_post_alloc_hook mm/slub.c:2164 [inline] slab_post_alloc_hook mm/slub.c:4002 [inline] slab_alloc_node mm/slub.c:4041 [inline] kmem_cache_alloc_noprof+0x2cd/0x2f0 mm/slub.c:4048 anon_vma_chain_alloc mm/rmap.c:142 [inline] anon_vma_clone+0xe1/0x5e0 mm/rmap.c:288 anon_vma_fork+0x7a/0x620 mm/rmap.c:351 dup_mmap kernel/fork.c:712 [inline] dup_mm kernel/fork.c:1672 [inline] copy_mm+0x192b/0x2550 kernel/fork.c:1721 copy_process+0x3ea8/0x6f50 kernel/fork.c:2374 kernel_clone+0xfd/0x960 kernel/fork.c:2781 page last free pid 4837 tgid 4837 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1101 [inline] free_unref_page+0x64a/0xe40 mm/page_alloc.c:2619 __put_partials+0x14c/0x170 mm/slub.c:3055 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x4e/0x140 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x192/0x1e0 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x69/0x90 mm/kasan/common.c:322 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook mm/slub.c:3992 [inline] slab_alloc_node mm/slub.c:4041 [inline] kmem_cache_alloc_noprof+0x121/0x2f0 mm/slub.c:4048 getname_flags.part.0+0x4c/0x550 fs/namei.c:139 getname_flags+0x93/0xf0 include/linux/audit.h:322 do_readlinkat+0xb5/0x390 fs/stat.c:536 __do_sys_readlink fs/stat.c:574 [inline] __se_sys_readlink fs/stat.c:571 [inline] __x64_sys_readlink+0x78/0xc0 fs/stat.c:571 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff888025e8fb00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888025e8fb80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff888025e8fc00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888025e8fc80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888025e8fd00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess), 4 bytes skipped: 0: df 41 57 filds 0x57(%rcx) 3: 4d 89 cf mov %r9,%r15 6: 41 56 push %r14 8: 49 89 fe mov %rdi,%r14 b: 41 55 push %r13 d: 41 89 d5 mov %edx,%r13d 10: 41 54 push %r12 12: 45 89 c4 mov %r8d,%r12d 15: 55 push %rbp 16: 53 push %rbx 17: 48 81 ec b0 00 00 00 sub $0xb0,%rsp 1e: 48 8d 5c 24 10 lea 0x10(%rsp),%rbx 23: 89 34 24 mov %esi,(%rsp) * 26: 48 c1 eb 03 shr $0x3,%rbx <-- trapping instruction 2a: 89 4c 24 04 mov %ecx,0x4(%rsp) 2e: 48 c7 44 24 10 b3 8a movq $0x41b58ab3,0x10(%rsp) 35: b5 41 37: 48 01 d8 add %rbx,%rax 3a: 48 rex.W 3b: c7 .byte 0xc7