================================================================== BUG: KASAN: slab-use-after-free in __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] BUG: KASAN: slab-use-after-free in _raw_spin_lock_irqsave+0x3a/0x60 kernel/locking/spinlock.c:162 Read of size 1 at addr ffff888031cf2c18 by task udevd/5358 CPU: 3 UID: 0 PID: 5358 Comm: udevd Not tainted 6.14.0-syzkaller-10167-g93d52288679e #0 PREEMPT(full) 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:94 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:408 [inline] print_report+0xc3/0x670 mm/kasan/report.c:521 kasan_report+0xe0/0x110 mm/kasan/report.c:634 __kasan_check_byte+0x36/0x50 mm/kasan/common.c:557 kasan_check_byte include/linux/kasan.h:399 [inline] lock_acquire kernel/locking/lockdep.c:5840 [inline] lock_acquire+0xfc/0x350 kernel/locking/lockdep.c:5823 __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+0x1dc/0x2e0 net/9p/trans_virtio.c:147 vring_interrupt drivers/virtio/virtio_ring.c:2715 [inline] vring_interrupt+0x31b/0x400 drivers/virtio/virtio_ring.c:2690 __handle_irq_event_percpu+0x229/0x7d0 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:254 [inline] call_irq_handler arch/x86/kernel/irq.c:266 [inline] __common_interrupt+0xdf/0x250 arch/x86/kernel/irq.c:292 common_interrupt+0x61/0xe0 arch/x86/kernel/irq.c:285 asm_common_interrupt+0x26/0x40 arch/x86/include/asm/idtentry.h:693 RIP: 0010:handle_softirqs+0x1dd/0x8e0 kernel/softirq.c:547 Code: 88 6c 24 26 4c 89 7c 24 18 48 c7 c7 00 82 8b 8b e8 68 e6 f0 09 65 66 c7 05 96 9a 27 12 00 00 e8 89 2e 46 00 fb bb ff ff ff ff <49> c7 c7 c0 c0 00 8e 41 0f bc dc 83 c3 01 0f 85 a4 00 00 00 e9 b1 RSP: 0018:ffffc900006f8f28 EFLAGS: 00000202 RAX: 00000000002565fe RBX: 00000000ffffffff RCX: ffffffff81c2d32f RDX: 0000000000000000 RSI: ffffffff8dbe0d4d RDI: ffffffff8bf3f220 RBP: 0000000000000000 R08: 0000000000000001 R09: 0000000000000001 R10: ffffffff90855f17 R11: 0000000000000000 R12: 0000000000000282 R13: 000000000000000a R14: 1ffff920000df1ed R15: ffffed10059b7910 __do_softirq kernel/softirq.c:595 [inline] invoke_softirq kernel/softirq.c:435 [inline] __irq_exit_rcu+0x109/0x170 kernel/softirq.c:662 irq_exit_rcu+0x9/0x30 kernel/softirq.c:678 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1049 [inline] sysvec_apic_timer_interrupt+0xa4/0xc0 arch/x86/kernel/apic/apic.c:1049 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702 RIP: 0010:__raw_write_unlock_irq include/linux/rwlock_api_smp.h:274 [inline] RIP: 0010:_raw_write_unlock_irq+0x29/0x50 kernel/locking/spinlock.c:358 Code: 90 f3 0f 1e fa 53 48 8b 74 24 08 48 89 fb 48 83 c7 18 e8 fa cd 27 f6 48 89 df e8 c2 2b 28 f6 e8 0d b5 52 f6 fb bf 01 00 00 00 d2 8f 18 f6 65 8b 05 fb 20 34 08 85 c0 74 06 5b c3 cc cc cc cc RSP: 0018:ffffc9000c86fcd8 EFLAGS: 00000206 RAX: 00000000002565f9 RBX: ffff8880250f5d40 RCX: ffffffff81c2d32f RDX: 0000000000000000 RSI: ffffffff8dbe0d4d RDI: 0000000000000001 RBP: dffffc0000000000 R08: 0000000000000001 R09: 0000000000000001 R10: ffffffff90855f17 R11: 0000000000000000 R12: 0000000000000001 R13: ffffc9000c86fdc0 R14: ffff8880250f5d40 R15: ffffc9000c86fdc0 ep_poll fs/eventpoll.c:2130 [inline] do_epoll_wait+0x914/0xfd0 fs/eventpoll.c:2523 __do_sys_epoll_wait fs/eventpoll.c:2531 [inline] __se_sys_epoll_wait fs/eventpoll.c:2526 [inline] __x64_sys_epoll_wait+0x194/0x290 fs/eventpoll.c:2526 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0x260 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f12d6323457 Code: 73 01 c3 48 8b 0d d1 d9 0c 00 f7 d8 64 89 01 48 83 c8 ff c3 41 89 ca 64 8b 04 25 18 00 00 00 85 c0 75 20 b8 e8 00 00 00 0f 05 <48> 3d 00 f0 ff ff 76 76 48 8b 15 a2 d9 0c 00 f7 d8 64 89 02 48 83 RSP: 002b:00007ffc31f89828 EFLAGS: 00000246 ORIG_RAX: 00000000000000e8 RAX: ffffffffffffffda RBX: 00007ffc31f89928 RCX: 00007f12d6323457 RDX: 0000000000000008 RSI: 00007ffc31f89928 RDI: 000000000000000b RBP: 000000000000000b R08: 0000000000000007 R09: 258d3430d27f7e7b R10: 0000000000000bb8 R11: 0000000000000246 R12: 0000000000000bb8 R13: 0000000200000001 R14: 0000000000000000 R15: 0000000000000000 Allocated by task 10161: 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:377 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:394 kmalloc_noprof include/linux/slab.h:902 [inline] p9_client_create+0xc7/0x11c0 net/9p/client.c:985 v9fs_session_init+0x1f7/0x1a80 fs/9p/v9fs.c:410 v9fs_mount+0xc5/0xa30 fs/9p/vfs_super.c:122 legacy_get_tree+0x109/0x220 fs/fs_context.c:662 vfs_get_tree+0x8b/0x340 fs/super.c:1759 do_new_mount fs/namespace.c:3878 [inline] path_mount+0x14d4/0x1f30 fs/namespace.c:4205 do_mount fs/namespace.c:4218 [inline] __do_sys_mount fs/namespace.c:4429 [inline] __se_sys_mount fs/namespace.c:4406 [inline] __x64_sys_mount+0x28d/0x310 fs/namespace.c:4406 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0x260 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 10161: 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:576 poison_slab_object mm/kasan/common.c:247 [inline] __kasan_slab_free+0x51/0x70 mm/kasan/common.c:264 kasan_slab_free include/linux/kasan.h:233 [inline] slab_free_hook mm/slub.c:2376 [inline] slab_free mm/slub.c:4633 [inline] kfree+0x2b6/0x4d0 mm/slub.c:4832 p9_client_create+0xa28/0x11c0 net/9p/client.c:1064 v9fs_session_init+0x1f7/0x1a80 fs/9p/v9fs.c:410 v9fs_mount+0xc5/0xa30 fs/9p/vfs_super.c:122 legacy_get_tree+0x109/0x220 fs/fs_context.c:662 vfs_get_tree+0x8b/0x340 fs/super.c:1759 do_new_mount fs/namespace.c:3878 [inline] path_mount+0x14d4/0x1f30 fs/namespace.c:4205 do_mount fs/namespace.c:4218 [inline] __do_sys_mount fs/namespace.c:4429 [inline] __se_sys_mount fs/namespace.c:4406 [inline] __x64_sys_mount+0x28d/0x310 fs/namespace.c:4406 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0x260 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f The buggy address belongs to the object at ffff888031cf2c00 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 24 bytes inside of freed 512-byte region [ffff888031cf2c00, ffff888031cf2e00) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x31cf0 head: order:2 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000040 ffff88801b442c80 ffffea0000c78c00 dead000000000002 raw: 0000000000000000 0000000000100010 00000000f5000000 0000000000000000 head: 00fff00000000040 ffff88801b442c80 ffffea0000c78c00 dead000000000002 head: 0000000000000000 0000000000100010 00000000f5000000 0000000000000000 head: 00fff00000000002 ffffea0000c73c01 ffffffffffffffff 0000000000000000 head: 0000000000000004 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 0xd2040(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 1, tgid 1 (init), ts 43873158313, free_ts 42446065419 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x181/0x1b0 mm/page_alloc.c:1551 prep_new_page mm/page_alloc.c:1559 [inline] get_page_from_freelist+0x10c4/0x34c0 mm/page_alloc.c:3477 __alloc_frozen_pages_noprof+0x223/0x24d0 mm/page_alloc.c:4740 alloc_pages_mpol+0x1fb/0x540 mm/mempolicy.c:2301 alloc_slab_page mm/slub.c:2446 [inline] allocate_slab mm/slub.c:2610 [inline] new_slab+0x23c/0x330 mm/slub.c:2663 ___slab_alloc+0xd9c/0x1940 mm/slub.c:3849 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3939 __slab_alloc_node mm/slub.c:4014 [inline] slab_alloc_node mm/slub.c:4175 [inline] __do_kmalloc_node mm/slub.c:4317 [inline] __kmalloc_noprof+0x2f2/0x510 mm/slub.c:4330 kmalloc_noprof include/linux/slab.h:906 [inline] kzalloc_noprof include/linux/slab.h:1036 [inline] tomoyo_init_log+0x1385/0x2140 security/tomoyo/audit.c:275 tomoyo_supervisor+0x302/0x13b0 security/tomoyo/common.c:2198 tomoyo_audit_path_log security/tomoyo/file.c:168 [inline] tomoyo_path_permission security/tomoyo/file.c:587 [inline] tomoyo_path_permission+0x270/0x3b0 security/tomoyo/file.c:573 tomoyo_path_perm+0x362/0x460 security/tomoyo/file.c:838 security_inode_getattr+0x116/0x290 security/security.c:2377 vfs_getattr fs/stat.c:243 [inline] vfs_fstat+0x4b/0xd0 fs/stat.c:265 vfs_fstatat+0xbc/0xf0 fs/stat.c:366 __do_sys_newfstatat+0xa1/0x130 fs/stat.c:532 page last free pid 1 tgid 1 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1127 [inline] free_frozen_pages+0x6d8/0xf40 mm/page_alloc.c:2660 kasan_depopulate_vmalloc_pte+0x63/0x80 mm/kasan/shadow.c:408 apply_to_pte_range mm/memory.c:2910 [inline] apply_to_pmd_range mm/memory.c:2954 [inline] apply_to_pud_range mm/memory.c:2990 [inline] apply_to_p4d_range mm/memory.c:3026 [inline] __apply_to_page_range+0x5f9/0xd30 mm/memory.c:3062 kasan_release_vmalloc+0xd1/0xe0 mm/kasan/shadow.c:529 kasan_release_vmalloc_node mm/vmalloc.c:2196 [inline] purge_vmap_node+0x1cb/0xa70 mm/vmalloc.c:2213 __purge_vmap_area_lazy+0x9d1/0xc90 mm/vmalloc.c:2304 _vm_unmap_aliases+0x43b/0x670 mm/vmalloc.c:2899 change_page_attr_set_clr+0x252/0x4a0 arch/x86/mm/pat/set_memory.c:2085 change_page_attr_set arch/x86/mm/pat/set_memory.c:2126 [inline] set_memory_nx+0xb5/0x110 arch/x86/mm/pat/set_memory.c:2301 free_init_pages+0x79/0xd0 arch/x86/mm/init.c:934 free_kernel_image_pages+0x24/0x50 arch/x86/mm/init.c:953 kernel_init+0x30/0x2b0 init/main.c:1466 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:153 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 Memory state around the buggy address: ffff888031cf2b00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888031cf2b80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff888031cf2c00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888031cf2c80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888031cf2d00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess): 0: 88 6c 24 26 mov %ch,0x26(%rsp) 4: 4c 89 7c 24 18 mov %r15,0x18(%rsp) 9: 48 c7 c7 00 82 8b 8b mov $0xffffffff8b8b8200,%rdi 10: e8 68 e6 f0 09 call 0x9f0e67d 15: 65 66 c7 05 96 9a 27 movw $0x0,%gs:0x12279a96(%rip) # 0x12279ab5 1c: 12 00 00 1f: e8 89 2e 46 00 call 0x462ead 24: fb sti 25: bb ff ff ff ff mov $0xffffffff,%ebx * 2a: 49 c7 c7 c0 c0 00 8e mov $0xffffffff8e00c0c0,%r15 <-- trapping instruction 31: 41 0f bc dc bsf %r12d,%ebx 35: 83 c3 01 add $0x1,%ebx 38: 0f 85 a4 00 00 00 jne 0xe2 3e: e9 .byte 0xe9 3f: b1 .byte 0xb1