================================================================== BUG: KASAN: slab-use-after-free in instrument_atomic_read_write include/linux/instrumented.h:96 [inline] BUG: KASAN: slab-use-after-free in atomic_dec_and_test include/linux/atomic/atomic-instrumented.h:1383 [inline] BUG: KASAN: slab-use-after-free in gfs2_qd_dealloc+0x81/0xe0 fs/gfs2/quota.c:112 Write of size 4 at addr ffff888040be4b68 by task udevd/4717 CPU: 0 UID: 0 PID: 4717 Comm: udevd Not tainted syzkaller #0 PREEMPT(full) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 Call Trace: dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0xba/0x230 mm/kasan/report.c:482 kasan_report+0x117/0x150 mm/kasan/report.c:595 check_region_inline mm/kasan/generic.c:-1 [inline] kasan_check_range+0x264/0x2c0 mm/kasan/generic.c:200 instrument_atomic_read_write include/linux/instrumented.h:96 [inline] atomic_dec_and_test include/linux/atomic/atomic-instrumented.h:1383 [inline] gfs2_qd_dealloc+0x81/0xe0 fs/gfs2/quota.c:112 rcu_do_batch kernel/rcu/tree.c:2605 [inline] rcu_core+0xc9e/0x1750 kernel/rcu/tree.c:2857 handle_softirqs+0x22a/0x7c0 kernel/softirq.c:622 __do_softirq kernel/softirq.c:656 [inline] invoke_softirq kernel/softirq.c:496 [inline] __irq_exit_rcu+0x5f/0x150 kernel/softirq.c:723 irq_exit_rcu+0x9/0x30 kernel/softirq.c:739 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1056 [inline] sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1056 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:697 RIP: 0010:lock_acquire+0x221/0x330 kernel/locking/lockdep.c:5872 Code: ff ff ff e8 41 c0 f8 09 f7 44 24 08 00 02 00 00 0f 84 3a ff ff ff 65 48 8b 05 2b 11 53 11 48 3b 44 24 58 75 33 fb 48 83 c4 60 <5b> 41 5c 41 5d 41 5e 41 5f 5d e9 50 a4 fb 09 cc 48 8d 3d 58 39 52 RSP: 0000:ffffc900025e7210 EFLAGS: 00000282 RAX: 61138d21ce21a600 RBX: 0000000000000000 RCX: 0000000000000046 RDX: 000000000d56648c RSI: ffffffff8df3b8b0 RDI: ffffffff8c075000 RBP: ffffffff81d3dbd6 R08: ffffffff81d3dbd6 R09: ffffffff8e55a360 R10: ffffc900025e7338 R11: ffffffff81afb170 R12: 0000000000000002 R13: ffffffff8e55a360 R14: 0000000000000000 R15: 0000000000000246 rcu_lock_acquire include/linux/rcupdate.h:331 [inline] rcu_read_lock include/linux/rcupdate.h:867 [inline] is_bpf_text_address+0x47/0x2b0 kernel/bpf/core.c:744 kernel_text_address+0xa5/0xe0 kernel/extable.c:125 __kernel_text_address+0xd/0x30 kernel/extable.c:79 unwind_get_return_address+0x4d/0x90 arch/x86/kernel/unwind_orc.c:385 arch_stack_walk+0xfb/0x150 arch/x86/kernel/stacktrace.c:26 stack_trace_save+0xa9/0x100 kernel/stacktrace.c:122 save_stack+0x122/0x230 mm/page_owner.c:165 __set_page_owner+0x8d/0x4c0 mm/page_owner.c:341 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x228/0x280 mm/page_alloc.c:1884 prep_new_page mm/page_alloc.c:1892 [inline] get_page_from_freelist+0x24dc/0x2580 mm/page_alloc.c:3945 __alloc_frozen_pages_noprof+0x18d/0x380 mm/page_alloc.c:5240 alloc_pages_mpol+0x232/0x4a0 mm/mempolicy.c:2486 folio_alloc_mpol_noprof mm/mempolicy.c:2505 [inline] vma_alloc_folio_noprof+0xea/0x210 mm/mempolicy.c:2540 folio_prealloc mm/memory.c:-1 [inline] wp_page_copy mm/memory.c:3722 [inline] do_wp_page+0x127b/0x5990 mm/memory.c:4183 handle_pte_fault mm/memory.c:6292 [inline] __handle_mm_fault mm/memory.c:6414 [inline] handle_mm_fault+0x1520/0x32a0 mm/memory.c:6583 do_user_addr_fault+0xa73/0x1360 arch/x86/mm/fault.c:1334 handle_page_fault arch/x86/mm/fault.c:1474 [inline] exc_page_fault+0x6a/0xc0 arch/x86/mm/fault.c:1527 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:618 RIP: 0033:0x7f9b2e0b8dd9 Code: 83 f9 1f 0f 86 5e 01 00 00 48 8b 45 70 66 49 0f 6e df 49 8d 54 1d 00 66 48 0f 6e c0 66 0f 6c c3 4c 39 78 18 0f 85 31 01 00 00 <0f> 11 42 10 48 89 55 70 48 89 50 18 48 81 f9 ff 03 00 00 76 08 66 RSP: 002b:00007ffceca96ea0 EFLAGS: 00010246 RAX: 00007f9b2e1f1b20 RBX: 0000000000004010 RCX: 0000000000000410 RDX: 00005618dabd71b0 RSI: 00007f9b2e1f2230 RDI: 00005618dabd31a0 RBP: 00007f9b2e1f1ac0 R08: 00000000000003ff R09: 0000000000000000 R10: 00005618dab39441 R11: 00005618dab50225 R12: 0000000000004000 R13: 00005618dabd31a0 R14: 0000000000004420 R15: 00007f9b2e1f1b20 Allocated by task 5329: kasan_save_stack mm/kasan/common.c:57 [inline] kasan_save_track+0x3e/0x80 mm/kasan/common.c:78 poison_kmalloc_redzone mm/kasan/common.c:398 [inline] __kasan_kmalloc+0x93/0xb0 mm/kasan/common.c:415 kasan_kmalloc include/linux/kasan.h:263 [inline] __kmalloc_cache_noprof+0x3d1/0x6e0 mm/slub.c:5780 kmalloc_noprof include/linux/slab.h:957 [inline] kzalloc_noprof include/linux/slab.h:1094 [inline] init_sbd fs/gfs2/ops_fstype.c:79 [inline] gfs2_fill_super+0x128/0x21d0 fs/gfs2/ops_fstype.c:1121 get_tree_bdev_flags+0x431/0x4f0 fs/super.c:1691 gfs2_get_tree+0x51/0x1e0 fs/gfs2/ops_fstype.c:1332 vfs_get_tree+0x92/0x2a0 fs/super.c:1751 fc_mount fs/namespace.c:1199 [inline] do_new_mount_fc fs/namespace.c:3636 [inline] do_new_mount+0x329/0xa50 fs/namespace.c:3712 do_mount fs/namespace.c:4035 [inline] __do_sys_mount fs/namespace.c:4224 [inline] __se_sys_mount+0x31d/0x420 fs/namespace.c:4201 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xe2/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 5329: kasan_save_stack mm/kasan/common.c:57 [inline] kasan_save_track+0x3e/0x80 mm/kasan/common.c:78 kasan_save_free_info+0x46/0x50 mm/kasan/generic.c:584 poison_slab_object mm/kasan/common.c:253 [inline] __kasan_slab_free+0x5c/0x80 mm/kasan/common.c:285 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:2540 [inline] slab_free mm/slub.c:6674 [inline] kfree+0x1be/0x650 mm/slub.c:6882 free_sbd fs/gfs2/ops_fstype.c:72 [inline] gfs2_fill_super+0x150e/0x21d0 fs/gfs2/ops_fstype.c:1316 get_tree_bdev_flags+0x431/0x4f0 fs/super.c:1691 gfs2_get_tree+0x51/0x1e0 fs/gfs2/ops_fstype.c:1332 vfs_get_tree+0x92/0x2a0 fs/super.c:1751 fc_mount fs/namespace.c:1199 [inline] do_new_mount_fc fs/namespace.c:3636 [inline] do_new_mount+0x329/0xa50 fs/namespace.c:3712 do_mount fs/namespace.c:4035 [inline] __do_sys_mount fs/namespace.c:4224 [inline] __se_sys_mount+0x31d/0x420 fs/namespace.c:4201 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xe2/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f The buggy address belongs to the object at ffff888040be4000 which belongs to the cache kmalloc-8k of size 8192 The buggy address is located 2920 bytes inside of freed 8192-byte region [ffff888040be4000, ffff888040be6000) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x40be0 head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0x4fff00000000040(head|node=1|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 04fff00000000040 ffff88801a842280 ffffea0001030000 0000000000000004 raw: 0000000000000000 0000000080020002 00000000f5000000 0000000000000000 head: 04fff00000000040 ffff88801a842280 ffffea0001030000 0000000000000004 head: 0000000000000000 0000000080020002 00000000f5000000 0000000000000000 head: 04fff00000000003 ffffea000102f801 00000000ffffffff 00000000ffffffff head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000008 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5291, tgid 5291 (syz-executor), ts 79388575604, free_ts 69938673078 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x228/0x280 mm/page_alloc.c:1884 prep_new_page mm/page_alloc.c:1892 [inline] get_page_from_freelist+0x24dc/0x2580 mm/page_alloc.c:3945 __alloc_frozen_pages_noprof+0x18d/0x380 mm/page_alloc.c:5240 alloc_pages_mpol+0x232/0x4a0 mm/mempolicy.c:2486 alloc_slab_page mm/slub.c:3075 [inline] allocate_slab+0x86/0x3a0 mm/slub.c:3248 new_slab mm/slub.c:3302 [inline] ___slab_alloc+0xd82/0x1760 mm/slub.c:4656 __slab_alloc+0x65/0x100 mm/slub.c:4779 __slab_alloc_node mm/slub.c:4855 [inline] slab_alloc_node mm/slub.c:5251 [inline] __kmalloc_cache_noprof+0x40d/0x6e0 mm/slub.c:5775 kmalloc_noprof include/linux/slab.h:957 [inline] kzalloc_noprof include/linux/slab.h:1094 [inline] cgroup1_root_to_use kernel/cgroup/cgroup-v1.c:1240 [inline] cgroup1_get_tree+0x4fb/0x8a0 kernel/cgroup/cgroup-v1.c:1267 vfs_get_tree+0x92/0x2a0 fs/super.c:1751 fc_mount fs/namespace.c:1199 [inline] do_new_mount_fc fs/namespace.c:3636 [inline] do_new_mount+0x329/0xa50 fs/namespace.c:3712 do_mount fs/namespace.c:4035 [inline] __do_sys_mount fs/namespace.c:4224 [inline] __se_sys_mount+0x31d/0x420 fs/namespace.c:4201 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xe2/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f page last free pid 5294 tgid 5294 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1433 [inline] __free_frozen_pages+0xbf8/0xd70 mm/page_alloc.c:2973 __folio_put+0x414/0x4f0 mm/swap.c:112 folio_put include/linux/mm.h:1616 [inline] put_page include/linux/mm.h:1685 [inline] do_exit+0x1843/0x2310 kernel/exit.c:1002 do_group_exit+0x21b/0x2d0 kernel/exit.c:1112 __do_sys_exit_group kernel/exit.c:1123 [inline] __se_sys_exit_group kernel/exit.c:1121 [inline] __x64_sys_exit_group+0x3f/0x40 kernel/exit.c:1121 __pfx_syscall_get_nr+0x0/0x10 arch/x86/include/generated/asm/syscalls_64.h:232 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xe2/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff888040be4a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888040be4a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888040be4b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888040be4b80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888040be4c00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess), 2 bytes skipped: 0: ff ljmp (bad) 1: e8 41 c0 f8 09 call 0x9f8c047 6: f7 44 24 08 00 02 00 testl $0x200,0x8(%rsp) d: 00 e: 0f 84 3a ff ff ff je 0xffffff4e 14: 65 48 8b 05 2b 11 53 mov %gs:0x1153112b(%rip),%rax # 0x11531147 1b: 11 1c: 48 3b 44 24 58 cmp 0x58(%rsp),%rax 21: 75 33 jne 0x56 23: fb sti 24: 48 83 c4 60 add $0x60,%rsp * 28: 5b pop %rbx <-- trapping instruction 29: 41 5c pop %r12 2b: 41 5d pop %r13 2d: 41 5e pop %r14 2f: 41 5f pop %r15 31: 5d pop %rbp 32: e9 50 a4 fb 09 jmp 0x9fba487 37: cc int3 38: 48 rex.W 39: 8d .byte 0x8d 3a: 3d .byte 0x3d 3b: 58 pop %rax 3c: 39 .byte 0x39 3d: 52 push %rdx