================================================================== BUG: KASAN: slab-use-after-free in __lock_acquire+0x4208/0x5de0 kernel/locking/lockdep.c:5012 Read of size 8 at addr ffff888074e90418 by task udevadm/17423 CPU: 1 PID: 17423 Comm: udevadm Not tainted 6.5.0-syzkaller-01207-g1c59d383390f #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:5012 lock_acquire kernel/locking/lockdep.c:5761 [inline] lock_acquire+0x1ae/0x510 kernel/locking/lockdep.c:5726 __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:2501 [inline] vring_interrupt+0x317/0x3f0 drivers/virtio/virtio_ring.c:2476 __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+0x9f/0x220 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:lock_acquire+0x1ef/0x510 kernel/locking/lockdep.c:5729 Code: c1 05 f5 1e 9b 7e 83 f8 01 0f 85 b0 02 00 00 9c 58 f6 c4 02 0f 85 9b 02 00 00 48 85 ed 74 01 fb 48 b8 00 00 00 00 00 fc ff df <48> 01 c3 48 c7 03 00 00 00 00 48 c7 43 08 00 00 00 00 48 8b 84 24 RSP: 0018:ffffc90027af78e8 EFLAGS: 00000206 RAX: dffffc0000000000 RBX: 1ffff92004f5ef1f RCX: 0000000000000001 RDX: 1ffff1100eca65d8 RSI: ffffffff8a6c8bc0 RDI: ffffffff8ac862e0 RBP: 0000000000000200 R08: 0000000000000000 R09: fffffbfff22f2fd2 R10: ffffffff91797e97 R11: 0000000000000000 R12: 0000000000000001 R13: 0000000000000000 R14: ffff888040a42948 R15: 0000000000000000 down_read+0x9c/0x470 kernel/locking/rwsem.c:1520 kernfs_dop_revalidate+0xf0/0x5a0 fs/kernfs/dir.c:1134 d_revalidate fs/namei.c:861 [inline] d_revalidate fs/namei.c:858 [inline] lookup_fast+0x232/0x520 fs/namei.c:1654 open_last_lookups fs/namei.c:3532 [inline] path_openat+0x3c7/0x29c0 fs/namei.c:3793 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:0x7faa8d36e9a4 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:00007ffe4bf05080 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 0000000000000008 RCX: 00007faa8d36e9a4 RDX: 0000000000080000 RSI: 00007ffe4bf051b8 RDI: 00000000ffffff9c RBP: 00007ffe4bf051b8 R08: 0000000000000008 R09: 0000000000000001 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000080000 R13: 000055556bf3835a R14: 0000000000000001 R15: 000055556d037da0 Allocated by task 17430: 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:582 [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:1711 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 17430: 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+0x15e/0x1b0 mm/kasan/common.c:200 kasan_slab_free include/linux/kasan.h:162 [inline] slab_free_hook mm/slub.c:1792 [inline] slab_free_freelist_hook+0x10b/0x1e0 mm/slub.c:1818 slab_free mm/slub.c:3801 [inline] __kmem_cache_free+0xb8/0x2f0 mm/slub.c:3814 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:1711 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 insert_work+0x4a/0x330 kernel/workqueue.c:1556 __queue_work+0x5f5/0x1040 kernel/workqueue.c:1717 call_timer_fn+0x1a0/0x580 kernel/time/timer.c:1700 expire_timers kernel/time/timer.c:1746 [inline] __run_timers+0x585/0xb10 kernel/time/timer.c:2022 run_timer_softirq+0x58/0xd0 kernel/time/timer.c:2035 __do_softirq+0x218/0x965 kernel/softirq.c:553 Second to 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 insert_work+0x4a/0x330 kernel/workqueue.c:1556 __queue_work+0x5f5/0x1040 kernel/workqueue.c:1717 queue_work_on+0xed/0x110 kernel/workqueue.c:1747 btrfs_cache_block_group+0x547/0x820 fs/btrfs/block-group.c:962 find_free_extent+0x33ab/0x6c00 fs/btrfs/extent-tree.c:4332 btrfs_reserve_extent+0x333/0x6b0 fs/btrfs/extent-tree.c:4514 btrfs_alloc_tree_block+0x234/0x1440 fs/btrfs/extent-tree.c:4929 __btrfs_cow_block+0x3ce/0x18f0 fs/btrfs/ctree.c:546 btrfs_cow_block+0x2f1/0x820 fs/btrfs/ctree.c:712 commit_cowonly_roots+0x18b/0xa60 fs/btrfs/transaction.c:1293 btrfs_commit_transaction+0x107e/0x3ed0 fs/btrfs/transaction.c:2426 btrfs_commit_super+0xc5/0x100 fs/btrfs/disk-io.c:4200 close_ctree+0xb11/0xdd0 fs/btrfs/disk-io.c:4354 generic_shutdown_super+0x161/0x3c0 fs/super.c:683 kill_anon_super+0x3a/0x60 fs/super.c:1280 btrfs_kill_super+0x3b/0x50 fs/btrfs/super.c:2144 deactivate_locked_super+0xa0/0x2d0 fs/super.c:454 deactivate_super+0xde/0x100 fs/super.c:504 cleanup_mnt+0x222/0x3d0 fs/namespace.c:1254 task_work_run+0x14d/0x240 kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop kernel/entry/common.c:171 [inline] exit_to_user_mode_prepare+0x210/0x240 kernel/entry/common.c:204 __syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline] syscall_exit_to_user_mode+0x1d/0x60 kernel/entry/common.c:296 __do_fast_syscall_32+0x6d/0xe0 arch/x86/entry/common.c:181 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 ffff888074e90400 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 24 bytes inside of freed 512-byte region [ffff888074e90400, ffff888074e90600) The buggy address belongs to the physical page: page:ffffea0001d3a400 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x74e90 head:ffffea0001d3a400 order:2 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0x4fff00000010200(slab|head|node=1|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 04fff00000010200 ffff888012842c80 ffffea0001d05d00 dead000000000002 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 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 5179, tgid 5179 (syz-executor.3), ts 122325699717, free_ts 0 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x2d2/0x350 mm/page_alloc.c:1570 prep_new_page mm/page_alloc.c:1577 [inline] get_page_from_freelist+0x10a9/0x31e0 mm/page_alloc.c:3221 __alloc_pages+0x1d0/0x4a0 mm/page_alloc.c:4477 __alloc_pages_node include/linux/gfp.h:237 [inline] alloc_slab_page mm/slub.c:1864 [inline] allocate_slab+0xa1/0x380 mm/slub.c:2009 new_slab mm/slub.c:2062 [inline] ___slab_alloc+0x8bc/0x1570 mm/slub.c:3215 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3314 __slab_alloc_node mm/slub.c:3367 [inline] slab_alloc_node mm/slub.c:3460 [inline] __kmem_cache_alloc_node+0x137/0x350 mm/slub.c:3509 kmalloc_node_trace+0x22/0xd0 mm/slab_common.c:1089 kmalloc_node include/linux/slab.h:598 [inline] kzalloc_node include/linux/slab.h:714 [inline] alloc_fair_sched_group+0x21d/0x450 kernel/sched/fair.c:12574 sched_create_group+0x2d/0x80 kernel/sched/core.c:10392 cpu_cgroup_css_alloc kernel/sched/core.c:10557 [inline] cpu_cgroup_css_alloc+0x15/0x30 kernel/sched/core.c:10547 css_create kernel/cgroup/cgroup.c:5546 [inline] cgroup_apply_control_enable+0x4b3/0xc70 kernel/cgroup/cgroup.c:3208 cgroup_mkdir+0x5ab/0x11d0 kernel/cgroup/cgroup.c:5763 kernfs_iop_mkdir+0x14a/0x1d0 fs/kernfs/dir.c:1221 vfs_mkdir+0x532/0x7e0 fs/namei.c:4120 do_mkdirat+0x2a9/0x330 fs/namei.c:4143 page_owner free stack trace missing Memory state around the buggy address: ffff888074e90300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888074e90380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff888074e90400: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888074e90480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888074e90500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess): 0: c1 05 f5 1e 9b 7e 83 roll $0x83,0x7e9b1ef5(%rip) # 0x7e9b1efc 7: f8 clc 8: 01 0f add %ecx,(%rdi) a: 85 b0 02 00 00 9c test %esi,-0x63fffffe(%rax) 10: 58 pop %rax 11: f6 c4 02 test $0x2,%ah 14: 0f 85 9b 02 00 00 jne 0x2b5 1a: 48 85 ed test %rbp,%rbp 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 c3 add %rax,%rbx <-- trapping instruction 2d: 48 c7 03 00 00 00 00 movq $0x0,(%rbx) 34: 48 c7 43 08 00 00 00 movq $0x0,0x8(%rbx) 3b: 00 3c: 48 rex.W 3d: 8b .byte 0x8b 3e: 84 .byte 0x84 3f: 24 .byte 0x24