================================================================== BUG: KASAN: slab-use-after-free in instrument_atomic_read include/linux/instrumented.h:68 [inline] BUG: KASAN: slab-use-after-free in atomic_read include/linux/atomic/atomic-instrumented.h:32 [inline] BUG: KASAN: slab-use-after-free in gfs2_qd_dealloc+0x85/0xf0 fs/gfs2/quota.c:115 Read of size 4 at addr ffff88807d22ca78 by task syz-executor.0/5384 CPU: 0 PID: 5384 Comm: syz-executor.0 Not tainted 6.6.0-rc3-syzkaller-dirty #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/06/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 include/linux/instrumented.h:68 [inline] atomic_read include/linux/atomic/atomic-instrumented.h:32 [inline] gfs2_qd_dealloc+0x85/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:check_kcov_mode kernel/kcov.c:175 [inline] RIP: 0010:write_comp_data kernel/kcov.c:236 [inline] RIP: 0010:__sanitizer_cov_trace_switch+0xbb/0x110 kernel/kcov.c:341 Code: c2 49 39 d2 74 71 4c 8b 74 d6 10 65 8b 05 f5 a8 75 7e a9 00 01 ff 00 74 11 a9 00 01 00 00 74 de 41 83 bb 04 16 00 00 00 74 d4 <41> 8b 83 e0 15 00 00 83 f8 03 75 c8 49 8b 8b e8 15 00 00 45 8b bb RSP: 0018:ffffc900052c71c0 EFLAGS: 00000246 RAX: 0000000080000001 RBX: 0000000000000000 RCX: ffff888028ef5940 RDX: 0000000000000006 RSI: ffffffff8d19cdc0 RDI: 0000000000000005 RBP: 0000000000000005 R08: 0000000000000005 R09: ffffffff813da5e3 R10: 0000000000000008 R11: ffff888028ef5940 R12: ffffffff8eb2ad10 R13: dffffc0000000000 R14: 0000000000000008 R15: 1ffff92000a58e58 unwind_next_frame+0x7c3/0x29e0 arch/x86/kernel/unwind_orc.c:515 arch_stack_walk+0x146/0x1a0 arch/x86/kernel/stacktrace.c:25 stack_trace_save+0x117/0x1c0 kernel/stacktrace.c:122 save_stack+0xfa/0x1e0 mm/page_owner.c:128 __reset_page_owner+0x4f/0x190 mm/page_owner.c:149 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_list+0x596/0x830 mm/page_alloc.c:2451 release_pages+0x2113/0x23f0 mm/swap.c:1042 __folio_batch_release+0x84/0x100 mm/swap.c:1062 folio_batch_release include/linux/pagevec.h:83 [inline] shmem_undo_range+0x6ad/0x19c0 mm/shmem.c:1022 shmem_truncate_range mm/shmem.c:1114 [inline] shmem_evict_inode+0x29e/0xa80 mm/shmem.c:1243 evict+0x2a4/0x620 fs/inode.c:664 __dentry_kill+0x436/0x650 fs/dcache.c:607 dentry_kill+0xbb/0x290 dput+0x21e/0x470 fs/dcache.c:913 __fput+0x60d/0x910 fs/file_table.c:392 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 RIP: 0033:0x7f821e47de17 Code: b0 ff ff ff f7 d8 64 89 01 48 83 c8 ff c3 0f 1f 44 00 00 31 f6 e9 09 00 00 00 66 0f 1f 84 00 00 00 00 00 b8 a6 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 01 c3 48 c7 c2 b0 ff ff ff f7 d8 64 89 02 b8 RSP: 002b:00007ffd4757b2e8 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6 RAX: 0000000000000000 RBX: 0000000000000000 RCX: 00007f821e47de17 RDX: 0000000000000000 RSI: 000000000000000a RDI: 00007ffd4757b3a0 RBP: 00007ffd4757b3a0 R08: 0000000000000000 R09: 0000000000000000 R10: 00000000ffffffff R11: 0000000000000246 R12: 00007ffd4757c460 R13: 00007f821e4c73b9 R14: 0000000000018554 R15: 0000000000000003 Allocated by task 5819: 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 5384: 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 The buggy address belongs to the object at ffff88807d22c000 which belongs to the cache kmalloc-8k of size 8192 The buggy address is located 2680 bytes inside of freed 8192-byte region [ffff88807d22c000, ffff88807d22e000) The buggy address belongs to the physical page: page:ffffea0001f48a00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7d228 head:ffffea0001f48a00 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 ffffea0001f4e600 dead000000000004 raw: 0000000000000000 0000000080020002 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 0xd2040(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 4863, tgid 4863 (dhcpcd-run-hook), ts 42490715685, free_ts 42477574008 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 kmalloc_trace+0x2a/0xe0 mm/slab_common.c:1114 kmalloc include/linux/slab.h:599 [inline] kzalloc include/linux/slab.h:720 [inline] tomoyo_print_bprm security/tomoyo/audit.c:26 [inline] tomoyo_init_log+0x11cd/0x2040 security/tomoyo/audit.c:264 tomoyo_supervisor+0x386/0x11f0 security/tomoyo/common.c:2089 tomoyo_audit_env_log security/tomoyo/environ.c:36 [inline] tomoyo_env_perm+0x178/0x210 security/tomoyo/environ.c:63 tomoyo_environ security/tomoyo/domain.c:672 [inline] tomoyo_find_next_domain+0x1383/0x1cf0 security/tomoyo/domain.c:878 tomoyo_bprm_check_security+0x114/0x170 security/tomoyo/tomoyo.c:101 security_bprm_check+0x63/0xa0 security/security.c:1103 search_binary_handler fs/exec.c:1727 [inline] exec_binprm fs/exec.c:1781 [inline] bprm_execve+0x8c7/0x17c0 fs/exec.c:1856 do_execveat_common+0x580/0x720 fs/exec.c:1964 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 discard_slab mm/slub.c:2116 [inline] __unfreeze_partials+0x1dc/0x220 mm/slub.c:2655 put_cpu_partial+0x17b/0x250 mm/slub.c:2731 __slab_free+0x2b6/0x390 mm/slub.c:3679 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] __kmem_cache_alloc_node+0x141/0x270 mm/slub.c:3517 __do_kmalloc_node mm/slab_common.c:1022 [inline] __kmalloc+0xa8/0x230 mm/slab_common.c:1036 kmalloc include/linux/slab.h:603 [inline] tomoyo_realpath_from_path+0xcf/0x5e0 security/tomoyo/realpath.c:251 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_path_perm+0x2b7/0x730 security/tomoyo/file.c:822 security_inode_getattr+0xd3/0x120 security/security.c:2153 vfs_getattr+0x2a/0x3a0 fs/stat.c:169 vfs_fstat fs/stat.c:194 [inline] vfs_fstatat+0xd6/0x190 fs/stat.c:291 Memory state around the buggy address: ffff88807d22c900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88807d22c980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88807d22ca00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88807d22ca80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88807d22cb00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess): 0: c2 49 39 ret $0x3949 3: d2 74 71 4c shlb %cl,0x4c(%rcx,%rsi,2) 7: 8b 74 d6 10 mov 0x10(%rsi,%rdx,8),%esi b: 65 8b 05 f5 a8 75 7e mov %gs:0x7e75a8f5(%rip),%eax # 0x7e75a907 12: a9 00 01 ff 00 test $0xff0100,%eax 17: 74 11 je 0x2a 19: a9 00 01 00 00 test $0x100,%eax 1e: 74 de je 0xfffffffe 20: 41 83 bb 04 16 00 00 cmpl $0x0,0x1604(%r11) 27: 00 28: 74 d4 je 0xfffffffe * 2a: 41 8b 83 e0 15 00 00 mov 0x15e0(%r11),%eax <-- trapping instruction 31: 83 f8 03 cmp $0x3,%eax 34: 75 c8 jne 0xfffffffe 36: 49 8b 8b e8 15 00 00 mov 0x15e8(%r11),%rcx 3d: 45 rex.RB 3e: 8b .byte 0x8b 3f: bb .byte 0xbb