================================================================== 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:1375 [inline] BUG: KASAN: slab-use-after-free in gfs2_qd_dealloc+0x83/0xf0 fs/gfs2/quota.c:115 Write of size 4 at addr ffff888038d48a78 by task klogd/4468 CPU: 0 PID: 4468 Comm: klogd Not tainted 6.6.0-rc7-syzkaller-00195-g2af9b20dbb39 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/09/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:364 [inline] print_report+0x163/0x540 mm/kasan/report.c:475 kasan_report+0x175/0x1b0 mm/kasan/report.c:588 kasan_check_range+0x27e/0x290 mm/kasan/generic.c:187 instrument_atomic_read_write include/linux/instrumented.h:96 [inline] atomic_dec_and_test include/linux/atomic/atomic-instrumented.h:1375 [inline] gfs2_qd_dealloc+0x83/0xf0 fs/gfs2/quota.c:115 rcu_do_batch kernel/rcu/tree.c:2139 [inline] rcu_core+0xacf/0x1790 kernel/rcu/tree.c:2403 __do_softirq+0x2ab/0x908 kernel/softirq.c:553 invoke_softirq kernel/softirq.c:427 [inline] __irq_exit_rcu+0xf1/0x1b0 kernel/softirq.c:632 irq_exit_rcu+0x9/0x20 kernel/softirq.c:644 sysvec_apic_timer_interrupt+0x95/0xb0 arch/x86/kernel/apic/apic.c:1074 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:645 RIP: 0010:__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:152 [inline] RIP: 0010:_raw_spin_unlock_irqrestore+0xd8/0x140 kernel/locking/spinlock.c:194 Code: 9c 8f 44 24 20 42 80 3c 23 00 74 08 4c 89 f7 e8 be 18 12 f7 f6 44 24 21 02 75 4e 41 f7 c7 00 02 00 00 74 01 fb bf 01 00 00 00 f3 cc 89 f6 65 8b 05 e4 04 2d 75 85 c0 74 3f 48 c7 04 24 0e 36 RSP: 0018:ffffc9000318f9e0 EFLAGS: 00000206 RAX: b53062a38b82c700 RBX: 1ffff92000631f40 RCX: ffffffff91edc303 RDX: dffffc0000000000 RSI: ffffffff8b0aa520 RDI: 0000000000000001 RBP: ffffc9000318fa68 R08: ffffffff8e996d6f R09: 1ffffffff1d32dad R10: dffffc0000000000 R11: fffffbfff1d32dae R12: dffffc0000000000 R13: 1ffff92000631f3c R14: ffffc9000318fa00 R15: 0000000000000246 spin_unlock_irqrestore include/linux/spinlock.h:406 [inline] prepare_to_wait_event+0x3b9/0x3f0 kernel/sched/wait.c:340 syslog_print+0x2b7/0x9b0 kernel/printk/printk.c:1579 do_syslog+0x505/0x890 kernel/printk/printk.c:1732 __do_sys_syslog kernel/printk/printk.c:1824 [inline] __se_sys_syslog kernel/printk/printk.c:1822 [inline] __x64_sys_syslog+0x7c/0x90 kernel/printk/printk.c:1822 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f85295aafa7 Code: 73 01 c3 48 8b 0d 81 ce 0c 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 67 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 51 ce 0c 00 f7 d8 64 89 01 48 RSP: 002b:00007ffc4c9f1c88 EFLAGS: 00000206 ORIG_RAX: 0000000000000067 RAX: ffffffffffffffda RBX: 00007f85297494a0 RCX: 00007f85295aafa7 RDX: 00000000000003ff RSI: 00007f85297494a0 RDI: 0000000000000002 RBP: 0000000000000000 R08: 0000000000000007 R09: f0875db517da4067 R10: 0000000000004000 R11: 0000000000000206 R12: 00007f85297494a0 R13: 00007f8529739212 R14: 00007f85297497d2 R15: 00007f85297497d2 Allocated by task 26538: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4f/0x70 mm/kasan/common.c:52 ____kasan_kmalloc mm/kasan/common.c:374 [inline] __kasan_kmalloc+0x98/0xb0 mm/kasan/common.c:383 kmalloc include/linux/slab.h:599 [inline] kzalloc include/linux/slab.h:720 [inline] init_sbd fs/gfs2/ops_fstype.c:77 [inline] gfs2_fill_super+0x136/0x26c0 fs/gfs2/ops_fstype.c:1164 get_tree_bdev+0x416/0x5b0 fs/super.c:1577 gfs2_get_tree+0x54/0x210 fs/gfs2/ops_fstype.c:1348 vfs_get_tree+0x8c/0x280 fs/super.c:1750 do_new_mount+0x28f/0xae0 fs/namespace.c:3335 do_mount fs/namespace.c:3675 [inline] __do_sys_mount fs/namespace.c:3884 [inline] __se_sys_mount+0x2d9/0x3c0 fs/namespace.c:3861 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Freed by task 5066: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4f/0x70 mm/kasan/common.c:52 kasan_save_free_info+0x28/0x40 mm/kasan/generic.c:522 ____kasan_slab_free+0xd6/0x120 mm/kasan/common.c:236 kasan_slab_free include/linux/kasan.h:164 [inline] slab_free_hook mm/slub.c:1800 [inline] slab_free_freelist_hook mm/slub.c:1826 [inline] slab_free mm/slub.c:3809 [inline] __kmem_cache_free+0x25f/0x3b0 mm/slub.c:3822 generic_shutdown_super+0x13a/0x2c0 fs/super.c:693 kill_block_super+0x41/0x70 fs/super.c:1646 deactivate_locked_super+0xa4/0x110 fs/super.c:481 cleanup_mnt+0x426/0x4c0 fs/namespace.c:1254 task_work_run+0x24a/0x300 kernel/task_work.c:180 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop+0xde/0x100 kernel/entry/common.c:171 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:204 __syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline] syscall_exit_to_user_mode+0x64/0x280 kernel/entry/common.c:296 do_syscall_64+0x4d/0xc0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd Last potentially related work creation: kasan_save_stack+0x3f/0x60 mm/kasan/common.c:45 __kasan_record_aux_stack+0xad/0xc0 mm/kasan/generic.c:492 insert_work+0x3e/0x320 kernel/workqueue.c:1647 __queue_work+0xc06/0x1010 kernel/workqueue.c:1799 queue_work_on+0x14f/0x250 kernel/workqueue.c:1834 queue_work include/linux/workqueue.h:554 [inline] schedule_work include/linux/workqueue.h:615 [inline] f2fs_handle_critical_error+0x7c8/0x9c0 fs/f2fs/super.c:4130 f2fs_write_end_io+0x7da/0xb00 fs/f2fs/data.c:366 __submit_merged_bio+0x28e/0x6c0 fs/f2fs/data.c:589 __f2fs_submit_merged_write fs/f2fs/data.c:682 [inline] __submit_merged_write_cond fs/f2fs/data.c:704 [inline] f2fs_submit_merged_write+0x1ea/0x2c0 fs/f2fs/data.c:714 f2fs_sync_node_pages+0x155d/0x16d0 fs/f2fs/node.c:2066 f2fs_write_node_pages+0x30b/0x6a0 fs/f2fs/node.c:2138 do_writepages+0x3a6/0x670 mm/page-writeback.c:2553 __writeback_single_inode+0x155/0xfa0 fs/fs-writeback.c:1608 writeback_sb_inodes+0x8e3/0x1210 fs/fs-writeback.c:1899 wb_writeback+0x44d/0xc60 fs/fs-writeback.c:2075 wb_do_writeback fs/fs-writeback.c:2222 [inline] wb_workfn+0x400/0xff0 fs/fs-writeback.c:2262 process_one_work kernel/workqueue.c:2630 [inline] process_scheduled_works+0x90f/0x1400 kernel/workqueue.c:2703 worker_thread+0xa5f/0xff0 kernel/workqueue.c:2784 kthread+0x2d3/0x370 kernel/kthread.c:388 ret_from_fork+0x48/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:304 Second to last potentially related work creation: kasan_save_stack+0x3f/0x60 mm/kasan/common.c:45 __kasan_record_aux_stack+0xad/0xc0 mm/kasan/generic.c:492 insert_work+0x3e/0x320 kernel/workqueue.c:1647 __queue_work+0xc06/0x1010 kernel/workqueue.c:1799 queue_work_on+0x14f/0x250 kernel/workqueue.c:1834 queue_work include/linux/workqueue.h:554 [inline] schedule_work include/linux/workqueue.h:615 [inline] f2fs_handle_critical_error+0x7c8/0x9c0 fs/f2fs/super.c:4130 f2fs_write_end_io+0x7da/0xb00 fs/f2fs/data.c:366 __submit_merged_bio+0x28e/0x6c0 fs/f2fs/data.c:589 __f2fs_submit_merged_write fs/f2fs/data.c:682 [inline] __submit_merged_write_cond fs/f2fs/data.c:704 [inline] f2fs_submit_merged_write+0x1ea/0x2c0 fs/f2fs/data.c:714 f2fs_sync_node_pages+0x155d/0x16d0 fs/f2fs/node.c:2066 f2fs_write_node_pages+0x30b/0x6a0 fs/f2fs/node.c:2138 do_writepages+0x3a6/0x670 mm/page-writeback.c:2553 __writeback_single_inode+0x155/0xfa0 fs/fs-writeback.c:1608 writeback_sb_inodes+0x8e3/0x1210 fs/fs-writeback.c:1899 wb_writeback+0x44d/0xc60 fs/fs-writeback.c:2075 wb_do_writeback fs/fs-writeback.c:2222 [inline] wb_workfn+0x400/0xff0 fs/fs-writeback.c:2262 process_one_work kernel/workqueue.c:2630 [inline] process_scheduled_works+0x90f/0x1400 kernel/workqueue.c:2703 worker_thread+0xa5f/0xff0 kernel/workqueue.c:2784 kthread+0x2d3/0x370 kernel/kthread.c:388 ret_from_fork+0x48/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:304 The buggy address belongs to the object at ffff888038d48000 which belongs to the cache kmalloc-8k of size 8192 The buggy address is located 2680 bytes inside of freed 8192-byte region [ffff888038d48000, ffff888038d4a000) The buggy address belongs to the physical page: page:ffffea0000e35200 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x38d48 head:ffffea0000e35200 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff00000000840(slab|head|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 00fff00000000840 ffff888012842280 dead000000000100 dead000000000122 raw: 0000000000000000 0000000000020002 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Unmovable, gfp_mask 0x1d28c0(GFP_NOWAIT|__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 4694, tgid 4694 (dhcpcd), ts 753870669251, free_ts 753110841921 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x1e6/0x210 mm/page_alloc.c:1536 prep_new_page mm/page_alloc.c:1543 [inline] get_page_from_freelist+0x31db/0x3360 mm/page_alloc.c:3170 __alloc_pages+0x255/0x670 mm/page_alloc.c:4426 alloc_slab_page+0x6a/0x160 mm/slub.c:1870 allocate_slab mm/slub.c:2017 [inline] new_slab+0x84/0x2f0 mm/slub.c:2070 ___slab_alloc+0xc85/0x1310 mm/slub.c:3223 __slab_alloc mm/slub.c:3322 [inline] __slab_alloc_node mm/slub.c:3375 [inline] slab_alloc_node mm/slub.c:3468 [inline] __kmem_cache_alloc_node+0x1af/0x270 mm/slub.c:3517 __do_kmalloc_node mm/slab_common.c:1025 [inline] __kmalloc_node_track_caller+0xa5/0x230 mm/slab_common.c:1046 kmalloc_reserve+0xf3/0x260 net/core/skbuff.c:581 __alloc_skb+0x1b1/0x420 net/core/skbuff.c:650 alloc_skb include/linux/skbuff.h:1286 [inline] netlink_dump+0x20b/0xcc0 net/netlink/af_netlink.c:2233 netlink_recvmsg+0x6b9/0x11d0 net/netlink/af_netlink.c:1992 sock_recvmsg_nosec net/socket.c:1044 [inline] sock_recvmsg net/socket.c:1066 [inline] ____sys_recvmsg+0x2a4/0x580 net/socket.c:2777 ___sys_recvmsg net/socket.c:2819 [inline] __sys_recvmsg+0x2f0/0x3d0 net/socket.c:2849 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd 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+0x8c3/0x9f0 mm/page_alloc.c:2312 free_unref_page+0x37/0x3f0 mm/page_alloc.c:2405 __slab_free+0x2f6/0x390 mm/slub.c:3715 qlink_free mm/kasan/quarantine.c:166 [inline] qlist_free_all+0x75/0xe0 mm/kasan/quarantine.c:185 kasan_quarantine_reduce+0x14b/0x160 mm/kasan/quarantine.c:292 __kasan_slab_alloc+0x23/0x70 mm/kasan/common.c:305 kasan_slab_alloc include/linux/kasan.h:188 [inline] slab_post_alloc_hook+0x67/0x3d0 mm/slab.h:762 slab_alloc_node mm/slub.c:3478 [inline] slab_alloc mm/slub.c:3486 [inline] __kmem_cache_alloc_lru mm/slub.c:3493 [inline] kmem_cache_alloc+0x123/0x300 mm/slub.c:3502 getname_flags+0xbc/0x4f0 fs/namei.c:140 do_sys_openat2+0xd2/0x1d0 fs/open.c:1416 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+0x247/0x290 fs/open.c:1448 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Memory state around the buggy address: ffff888038d48900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888038d48980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888038d48a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888038d48a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888038d48b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess): 0: 9c pushf 1: 8f 44 24 20 pop 0x20(%rsp) 5: 42 80 3c 23 00 cmpb $0x0,(%rbx,%r12,1) a: 74 08 je 0x14 c: 4c 89 f7 mov %r14,%rdi f: e8 be 18 12 f7 call 0xf71218d2 14: f6 44 24 21 02 testb $0x2,0x21(%rsp) 19: 75 4e jne 0x69 1b: 41 f7 c7 00 02 00 00 test $0x200,%r15d 22: 74 01 je 0x25 24: fb sti 25: bf 01 00 00 00 mov $0x1,%edi * 2a: e8 f3 cc 89 f6 call 0xf689cd22 <-- trapping instruction 2f: 65 8b 05 e4 04 2d 75 mov %gs:0x752d04e4(%rip),%eax # 0x752d051a 36: 85 c0 test %eax,%eax 38: 74 3f je 0x79 3a: 48 rex.W 3b: c7 .byte 0xc7 3c: 04 24 add $0x24,%al 3e: 0e (bad) 3f: 36 ss