TITLE: KASAN: slab-use-after-free Write in xfs_group_put
CORRUPTED: false ()
SUPPRESSED: false
MAINTAINERS (TO): [cem@kernel.org linux-xfs@vger.kernel.org]
MAINTAINERS (CC): [djwong@kernel.org]
==================================================================
BUG: KASAN: slab-use-after-free in instrument_atomic_read_write include/linux/instrumented.h:112 [inline]
BUG: KASAN: slab-use-after-free in atomic_dec include/linux/atomic/atomic-instrumented.h:592 [inline]
BUG: KASAN: slab-use-after-free in xfs_group_put+0xa2/0x220 fs/xfs/libxfs/xfs_group.c:69
Write of size 4 at addr ffff888020d0c810 by task repro.out/9467
CPU: 1 UID: 0 PID: 9467 Comm: repro.out Not tainted 7.4.0-rc5 #62 PREEMPT(full)
Hardware name: QEMU Ubuntu 24.04 PC v2 (i440FX + PIIX, arch_caps fix, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
Call Trace:
__dump_stack lib/dump_stack.c:94 [inline]
dump_stack_lvl+0x10e/0x190 lib/dump_stack.c:120
print_address_description mm/kasan/report.c:378 [inline]
print_report+0x153/0x7e0 mm/kasan/report.c:482
kasan_report+0x147/0x180 mm/kasan/report.c:595
check_region_inline mm/kasan/generic.c:-1 [inline]
kasan_check_range+0x2b0/0x2c0 mm/kasan/generic.c:200
instrument_atomic_read_write include/linux/instrumented.h:112 [inline]
atomic_dec include/linux/atomic/atomic-instrumented.h:592 [inline]
xfs_group_put+0xa2/0x220 fs/xfs/libxfs/xfs_group.c:69
xfs_perag_put fs/xfs/libxfs/xfs_ag.h:162 [inline]
xfs_buf_destroy fs/xfs/xfs_buf.c:870 [inline]
xfs_buftarg_shrink_scan+0x262/0x300 fs/xfs/xfs_buf.c:1621
do_shrink_slab+0x6e7/0x1100 mm/shrinker.c:452
shrink_slab+0xe19/0x1170 mm/shrinker.c:683
drop_slab_node mm/vmscan.c:488 [inline]
drop_slab+0x14b/0x290 mm/vmscan.c:506
drop_caches_sysctl_handler+0xc7/0x170 fs/drop_caches.c:68
proc_sys_call_handler+0x501/0x730 fs/proc/proc_sysctl.c:602
new_sync_write fs/read_write.c:575 [inline]
vfs_write+0x5d2/0xb40 fs/read_write.c:667
ksys_write+0x149/0x250 fs/read_write.c:719
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x17b/0x560 arch/x86/entry/syscall_64.c:89
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x415c7d
Code: e5 48 83 ec 20 48 89 55 e8 48 89 75 f0 89 7d f8 e8 98 82 01 00 48 8b 55 e8 48 8b 75 f0 41 89 c0 8b 7d f8 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 33 44 89 c7 48 89 45 f8 e8 ef 82 01 00 48 8b
RSP: 002b:00007f06ee850160 EFLAGS: 00000293 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 0000000000000004 RCX: 0000000000415c7d
RDX: 0000000000000002 RSI: 0000000000499041 RDI: 0000000000000004
RBP: 00007f06ee850180 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000293 R12: 00007f06ee8506c0
R13: ffffffffffffffb8 R14: 0000000000000002 R15: 00007ffefc0c8400
Allocated by task 9453:
kasan_save_stack mm/kasan/common.c:57 [inline]
kasan_save_track+0x3f/0x90 mm/kasan/common.c:79
poison_kmalloc_redzone mm/kasan/common.c:412 [inline]
__kasan_kmalloc+0x93/0xb0 mm/kasan/common.c:429
kasan_kmalloc include/linux/kasan.h:267 [inline]
__kmalloc_cache_noprof+0x325/0x620 mm/slub.c:5680
_kmalloc_noprof include/linux/slab.h:991 [inline]
_kzalloc_noprof include/linux/slab.h:1312 [inline]
xfs_perag_alloc fs/xfs/libxfs/xfs_ag.c:224 [inline]
xfs_initialize_perag+0xd5/0x5f0 fs/xfs/libxfs/xfs_ag.c:270
xfs_mountfs+0xb0f/0x2320 fs/xfs/xfs_mount.c:1015
xfs_fs_fill_super+0x1178/0x15c0 fs/xfs/xfs_super.c:1987
get_tree_bdev_flags+0x411/0x4d0 fs/super.c:1821
vfs_get_tree+0x92/0x2a0 fs/super.c:1881
fc_mount fs/namespace.c:1282 [inline]
do_new_mount_fc fs/namespace.c:3910 [inline]
do_new_mount+0x2f2/0x700 fs/namespace.c:3986
do_mount fs/namespace.c:4350 [inline]
__do_sys_mount fs/namespace.c:4563 [inline]
__se_sys_mount+0x313/0x410 fs/namespace.c:4540
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x17b/0x560 arch/x86/entry/syscall_64.c:89
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Freed by task 16:
kasan_save_stack mm/kasan/common.c:57 [inline]
kasan_save_track+0x3f/0x90 mm/kasan/common.c:79
kasan_save_free_info+0x46/0x50 mm/kasan/generic.c:599
poison_slab_object mm/kasan/common.c:267 [inline]
__kasan_slab_free+0x6c/0x90 mm/kasan/common.c:299
kasan_slab_free include/linux/kasan.h:239 [inline]
slab_free_hook mm/slub.c:2780 [inline]
__rcu_free_sheaf_prepare+0x135/0x2b0 mm/slub.c:3041
rcu_free_sheaf+0x31/0x210 mm/slub.c:6182
rcu_do_batch kernel/rcu/tree.c:2650 [inline]
rcu_core+0x950/0x11d0 kernel/rcu/tree.c:2919
handle_softirqs+0x26b/0x8e0 kernel/softirq.c:669
run_ksoftirqd+0x36/0x60 kernel/softirq.c:1133
smpboot_thread_fn+0x5f5/0xb40 kernel/smpboot.c:162
kthread+0x38c/0x480 kernel/kthread.c:436
ret_from_fork+0x509/0xb70 arch/x86/kernel/process.c:158
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
Last potentially related work creation:
kasan_save_stack+0x3e/0x60 mm/kasan/common.c:57
__kasan_record_aux_stack+0xc5/0xe0 mm/kasan/generic.c:561
__kfree_rcu_sheaf+0x140/0x720 mm/slub.c:6306
kfree_rcu_sheaf mm/slab_common.c:1689 [inline]
kvfree_call_rcu+0x9c/0x410 mm/slab_common.c:2044
xfs_free_perag_range+0x36/0x60 fs/xfs/libxfs/xfs_ag.c:130
xfs_unmountfs+0x2db/0x320 fs/xfs/xfs_mount.c:1391
xfs_fs_put_super+0x65/0x160 fs/xfs/xfs_super.c:1275
generic_shutdown_super+0x140/0x2d0 fs/super.c:723
kill_block_super+0x44/0xa0 fs/super.c:1852
xfs_kill_sb+0x25f/0x280 fs/xfs/xfs_super.c:2338
deactivate_locked_super+0xbe/0x110 fs/super.c:558
cleanup_mnt+0x1ff/0x290 fs/namespace.c:1396
task_work_run+0x1d4/0x260 kernel/task_work.c:233
resume_user_mode_work include/linux/resume_user_mode.h:50 [inline]
__exit_to_user_mode_loop kernel/entry/common.c:70 [inline]
exit_to_user_mode_loop+0x211/0x800 kernel/entry/common.c:101
__exit_to_user_mode_prepare include/linux/irq-entry-common.h:207 [inline]
syscall_exit_to_user_mode_prepare include/linux/irq-entry-common.h:230 [inline]
syscall_exit_to_user_mode include/linux/entry-common.h:343 [inline]
do_syscall_64+0x340/0x560 arch/x86/entry/syscall_64.c:107
entry_SYSCALL_64_after_hwframe+0x77/0x7f
The buggy address belongs to the object at ffff888020d0c800
which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 16 bytes inside of
freed 1024-byte region [ffff888020d0c800, ffff888020d0cc00)
The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x20d08
head: order:3 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 ffff88801ac41dc0 dead000000000100 dead000000000122
raw: 0000000000000000 0000000000100010 00000000f5000000 0000000000000000
head: 00fff00000000040 ffff88801ac41dc0 dead000000000100 dead000000000122
head: 0000000000000000 0000000000100010 00000000f5000000 0000000000000000
head: 00fff00000000003 fffffffffffffe01 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 0xd2040(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 4980, tgid 4980 ((exec-inner)), ts 13363873979
set_page_owner include/linux/page_owner.h:33 [inline]
post_alloc_hook+0x205/0x260 mm/page_alloc.c:1873
prep_new_page+0x22/0xc0 mm/page_alloc.c:1881
get_page_from_freelist+0x2413/0x2450 mm/page_alloc.c:3963
__alloc_frozen_pages_noprof+0x20e/0x450 mm/page_alloc.c:5505
alloc_slab_page mm/slub.c:3384 [inline]
allocate_slab+0x7d/0x5f0 mm/slub.c:3499
new_slab mm/slub.c:3550 [inline]
refill_objects+0x301/0x380 mm/slub.c:7546
refill_sheaf mm/slub.c:2917 [inline]
__pcs_replace_empty_main+0x2cb/0x6c0 mm/slub.c:4811
alloc_from_pcs mm/slub.c:4887 [inline]
slab_alloc_node mm/slub.c:5021 [inline]
__do_kmalloc_node mm/slub.c:5530 [inline]
__kmalloc_noprof+0x47d/0x720 mm/slub.c:5556
_kmalloc_noprof include/linux/slab.h:995 [inline]
_kzalloc_noprof include/linux/slab.h:1312 [inline]
tomoyo_init_log+0x19d5/0x1ed0 security/tomoyo/audit.c:273
tomoyo_supervisor+0x340/0x1490 security/tomoyo/common.c:2232
tomoyo_audit_env_log security/tomoyo/environ.c:37 [inline]
tomoyo_env_perm+0x149/0x1e0 security/tomoyo/environ.c:64
tomoyo_environ security/tomoyo/domain.c:673 [inline]
tomoyo_find_next_domain+0x15ce/0x1aa0 security/tomoyo/domain.c:889
tomoyo_bprm_check_security+0x11c/0x180 security/tomoyo/tomoyo.c:102
security_bprm_check+0x89/0x270 security/security.c:834
search_binary_handler fs/exec.c:1767 [inline]
exec_binprm fs/exec.c:1809 [inline]
bprm_execve+0x88d/0x15c0 fs/exec.c:1865
do_execveat_common+0x51d/0x6a0 fs/exec.c:1963
page last free pid 4980 tgid 4980 ts 13363563802 stack trace:
reset_page_owner include/linux/page_owner.h:26 [inline]
__free_pages_prepare mm/page_alloc.c:1415 [inline]
__free_frozen_pages+0xcfb/0xde0 mm/page_alloc.c:2971
__slab_free+0x28e/0x2e0 mm/slub.c:5926
qlink_free mm/kasan/quarantine.c:163 [inline]
qlist_free_all+0x99/0x100 mm/kasan/quarantine.c:179
kasan_quarantine_reduce+0x148/0x160 mm/kasan/quarantine.c:286
__kasan_slab_alloc+0x22/0x80 mm/kasan/common.c:364
kasan_slab_alloc include/linux/kasan.h:257 [inline]
slab_post_alloc_hook mm/slub.c:4720 [inline]
slab_alloc_node mm/slub.c:5033 [inline]
__do_kmalloc_node mm/slub.c:5530 [inline]
__kmalloc_noprof+0x303/0x720 mm/slub.c:5556
_kmalloc_noprof include/linux/slab.h:995 [inline]
tomoyo_add_entry security/tomoyo/common.c:2166 [inline]
tomoyo_supervisor+0xbcb/0x1490 security/tomoyo/common.c:2238
tomoyo_audit_env_log security/tomoyo/environ.c:37 [inline]
tomoyo_env_perm+0x149/0x1e0 security/tomoyo/environ.c:64
tomoyo_environ security/tomoyo/domain.c:673 [inline]
tomoyo_find_next_domain+0x15ce/0x1aa0 security/tomoyo/domain.c:889
tomoyo_bprm_check_security+0x11c/0x180 security/tomoyo/tomoyo.c:102
security_bprm_check+0x89/0x270 security/security.c:834
search_binary_handler fs/exec.c:1767 [inline]
exec_binprm fs/exec.c:1809 [inline]
bprm_execve+0x88d/0x15c0 fs/exec.c:1865
do_execveat_common+0x51d/0x6a0 fs/exec.c:1963
__do_sys_execve fs/exec.c:2036 [inline]
__se_sys_execve fs/exec.c:2030 [inline]
__x64_sys_execve+0x97/0xc0 fs/exec.c:2030
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x17b/0x560 arch/x86/entry/syscall_64.c:89
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Memory state around the buggy address:
ffff888020d0c700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff888020d0c780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888020d0c800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888020d0c880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888020d0c900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
TITLE: kernel panic: KASAN: panic_on_warn set ...
CORRUPTED: false ()
SUPPRESSED: false
MAINTAINERS (TO): [cem@kernel.org linux-xfs@vger.kernel.org]
MAINTAINERS (CC): [djwong@kernel.org]
raw: 0000000000000000 0000000000100010 00000000f5000000 0000000000000000
head: 00fff00000000040 ffff88801ac41dc0 dead000000000100 dead000000000122
head: 0000000000000000 0000000000100010 00000000f5000000 0000000000000000
head: 00fff00000000003 fffffffffffffe01 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 0xd2040(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 4980, tgid 4980 ((exec-inner)), ts 13363873979
set_page_owner include/linux/page_owner.h:33 [inline]
post_alloc_hook+0x205/0x260 mm/page_alloc.c:1873
prep_new_page+0x22/0xc0 mm/page_alloc.c:1881
get_page_from_freelist+0x2413/0x2450 mm/page_alloc.c:3963
__alloc_frozen_pages_noprof+0x20e/0x450 mm/page_alloc.c:5505
alloc_slab_page mm/slub.c:3384 [inline]
allocate_slab+0x7d/0x5f0 mm/slub.c:3499
new_slab mm/slub.c:3550 [inline]
refill_objects+0x301/0x380 mm/slub.c:7546
refill_sheaf mm/slub.c:2917 [inline]
__pcs_replace_empty_main+0x2cb/0x6c0 mm/slub.c:4811
alloc_from_pcs mm/slub.c:4887 [inline]
slab_alloc_node mm/slub.c:5021 [inline]
__do_kmalloc_node mm/slub.c:5530 [inline]
__kmalloc_noprof+0x47d/0x720 mm/slub.c:5556
_kmalloc_noprof include/linux/slab.h:995 [inline]
_kzalloc_noprof include/linux/slab.h:1312 [inline]
tomoyo_init_log+0x19d5/0x1ed0 security/tomoyo/audit.c:273
tomoyo_supervisor+0x340/0x1490 security/tomoyo/common.c:2232
tomoyo_audit_env_log security/tomoyo/environ.c:37 [inline]
tomoyo_env_perm+0x149/0x1e0 security/tomoyo/environ.c:64
tomoyo_environ security/tomoyo/domain.c:673 [inline]
tomoyo_find_next_domain+0x15ce/0x1aa0 security/tomoyo/domain.c:889
tomoyo_bprm_check_security+0x11c/0x180 security/tomoyo/tomoyo.c:102
security_bprm_check+0x89/0x270 security/security.c:834
search_binary_handler fs/exec.c:1767 [inline]
exec_binprm fs/exec.c:1809 [inline]
bprm_execve+0x88d/0x15c0 fs/exec.c:1865
do_execveat_common+0x51d/0x6a0 fs/exec.c:1963
page last free pid 4980 tgid 4980 ts 13363563802 stack trace:
reset_page_owner include/linux/page_owner.h:26 [inline]
__free_pages_prepare mm/page_alloc.c:1415 [inline]
__free_frozen_pages+0xcfb/0xde0 mm/page_alloc.c:2971
__slab_free+0x28e/0x2e0 mm/slub.c:5926
qlink_free mm/kasan/quarantine.c:163 [inline]
qlist_free_all+0x99/0x100 mm/kasan/quarantine.c:179
kasan_quarantine_reduce+0x148/0x160 mm/kasan/quarantine.c:286
__kasan_slab_alloc+0x22/0x80 mm/kasan/common.c:364
kasan_slab_alloc include/linux/kasan.h:257 [inline]
slab_post_alloc_hook mm/slub.c:4720 [inline]
slab_alloc_node mm/slub.c:5033 [inline]
__do_kmalloc_node mm/slub.c:5530 [inline]
__kmalloc_noprof+0x303/0x720 mm/slub.c:5556
_kmalloc_noprof include/linux/slab.h:995 [inline]
tomoyo_add_entry security/tomoyo/common.c:2166 [inline]
tomoyo_supervisor+0xbcb/0x1490 security/tomoyo/common.c:2238
tomoyo_audit_env_log security/tomoyo/environ.c:37 [inline]
tomoyo_env_perm+0x149/0x1e0 security/tomoyo/environ.c:64
tomoyo_environ security/tomoyo/domain.c:673 [inline]
tomoyo_find_next_domain+0x15ce/0x1aa0 security/tomoyo/domain.c:889
tomoyo_bprm_check_security+0x11c/0x180 security/tomoyo/tomoyo.c:102
security_bprm_check+0x89/0x270 security/security.c:834
search_binary_handler fs/exec.c:1767 [inline]
exec_binprm fs/exec.c:1809 [inline]
bprm_execve+0x88d/0x15c0 fs/exec.c:1865
do_execveat_common+0x51d/0x6a0 fs/exec.c:1963
__do_sys_execve fs/exec.c:2036 [inline]
__se_sys_execve fs/exec.c:2030 [inline]
__x64_sys_execve+0x97/0xc0 fs/exec.c:2030
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x17b/0x560 arch/x86/entry/syscall_64.c:89
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Memory state around the buggy address:
ffff888020d0c700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff888020d0c780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888020d0c800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888020d0c880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888020d0c900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
Kernel panic - not syncing: KASAN: panic_on_warn set ...
CPU: 1 UID: 0 PID: 9467 Comm: repro.out Not tainted 7.4.0-rc5 #62 PREEMPT(full)
Hardware name: QEMU Ubuntu 24.04 PC v2 (i440FX + PIIX, arch_caps fix, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
Call Trace:
__dump_stack lib/dump_stack.c:94 [inline]
dump_stack_lvl+0x10e/0x190 lib/dump_stack.c:120
vpanic+0x26f/0x710 kernel/panic.c:661
panic+0xb9/0xc0 kernel/panic.c:787
check_panic_on_warn+0x89/0xb0 kernel/panic.c:533
end_report+0x73/0x170 mm/kasan/report.c:227
kasan_report+0x158/0x180 mm/kasan/report.c:597
check_region_inline mm/kasan/generic.c:-1 [inline]
kasan_check_range+0x2b0/0x2c0 mm/kasan/generic.c:200
instrument_atomic_read_write include/linux/instrumented.h:112 [inline]
atomic_dec include/linux/atomic/atomic-instrumented.h:592 [inline]
xfs_group_put+0xa2/0x220 fs/xfs/libxfs/xfs_group.c:69
xfs_perag_put fs/xfs/libxfs/xfs_ag.h:162 [inline]
xfs_buf_destroy fs/xfs/xfs_buf.c:870 [inline]
xfs_buftarg_shrink_scan+0x262/0x300 fs/xfs/xfs_buf.c:1621
do_shrink_slab+0x6e7/0x1100 mm/shrinker.c:452
shrink_slab+0xe19/0x1170 mm/shrinker.c:683
drop_slab_node mm/vmscan.c:488 [inline]
drop_slab+0x14b/0x290 mm/vmscan.c:506
drop_caches_sysctl_handler+0xc7/0x170 fs/drop_caches.c:68
proc_sys_call_handler+0x501/0x730 fs/proc/proc_sysctl.c:602
new_sync_write fs/read_write.c:575 [inline]
vfs_write+0x5d2/0xb40 fs/read_write.c:667
ksys_write+0x149/0x250 fs/read_write.c:719
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x17b/0x560 arch/x86/entry/syscall_64.c:89
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x415c7d
Code: e5 48 83 ec 20 48 89 55 e8 48 89 75 f0 89 7d f8 e8 98 82 01 00 48 8b 55 e8 48 8b 75 f0 41 89 c0 8b 7d f8 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 33 44 89 c7 48 89 45 f8 e8 ef 82 01 00 48 8b
RSP: 002b:00007f06ee850160 EFLAGS: 00000293 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 0000000000000004 RCX: 0000000000415c7d
RDX: 0000000000000002 RSI: 0000000000499041 RDI: 0000000000000004
RBP: 00007f06ee850180 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000293 R12: 00007f06ee8506c0
R13: ffffffffffffffb8 R14: 0000000000000002 R15: 00007ffefc0c8400
Dumping ftrace buffer:
(ftrace buffer empty)
Kernel Offset: disabled
Rebooting in 86400 seconds..