[v6.1] KASAN: use-after-free Write in gfs2_qd_shrink_scan

1 view
Skip to first unread message

syzbot

unread,
Apr 18, 2024, 7:10:25 PMApr 18
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 6741e066ec76 Linux 6.1.87
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=1261431b180000
kernel config: https://syzkaller.appspot.com/x/.config?x=5d37120947ebed5a
dashboard link: https://syzkaller.appspot.com/bug?extid=93b5db0d83591b8aff90
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
userspace arch: arm64

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/e09aa9dab3c8/disk-6741e066.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/4176a4f5a4d5/vmlinux-6741e066.xz
kernel image: https://storage.googleapis.com/syzbot-assets/970367753980/Image-6741e066.gz.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+93b5db...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: use-after-free in instrument_atomic_read_write include/linux/instrumented.h:102 [inline]
BUG: KASAN: use-after-free in atomic_dec include/linux/atomic/atomic-instrumented.h:257 [inline]
BUG: KASAN: use-after-free in gfs2_qd_dispose fs/gfs2/quota.c:137 [inline]
BUG: KASAN: use-after-free in gfs2_qd_shrink_scan+0x580/0x7b8 fs/gfs2/quota.c:175
Write of size 4 at addr ffff0000ef5d0a70 by task syz-executor.1/5542

CPU: 0 PID: 5542 Comm: syz-executor.1 Not tainted 6.1.87-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
Call trace:
dump_backtrace+0x1c8/0x1f4 arch/arm64/kernel/stacktrace.c:158
show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:165
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
print_address_description mm/kasan/report.c:284 [inline]
print_report+0x174/0x4c0 mm/kasan/report.c:395
kasan_report+0xd4/0x130 mm/kasan/report.c:495
kasan_check_range+0x264/0x2a4 mm/kasan/generic.c:189
__kasan_check_write+0x2c/0x3c mm/kasan/shadow.c:37
instrument_atomic_read_write include/linux/instrumented.h:102 [inline]
atomic_dec include/linux/atomic/atomic-instrumented.h:257 [inline]
gfs2_qd_dispose fs/gfs2/quota.c:137 [inline]
gfs2_qd_shrink_scan+0x580/0x7b8 fs/gfs2/quota.c:175
do_shrink_slab+0x4f4/0x11d8 mm/vmscan.c:846
shrink_slab+0x1e0/0x7f0 mm/vmscan.c:1006
drop_slab_node mm/vmscan.c:1041 [inline]
drop_slab+0x11c/0x25c mm/vmscan.c:1051
drop_caches_sysctl_handler+0x178/0x394 fs/drop_caches.c:66
proc_sys_call_handler+0x4cc/0x7cc fs/proc/proc_sysctl.c:604
proc_sys_write+0x2c/0x3c fs/proc/proc_sysctl.c:630
do_iter_write+0x534/0x964 fs/read_write.c:861
vfs_iter_write+0x88/0xac fs/read_write.c:902
iter_file_splice_write+0x62c/0xc5c fs/splice.c:685
do_splice_from fs/splice.c:763 [inline]
direct_splice_actor+0xe4/0x1c0 fs/splice.c:950
splice_direct_to_actor+0x3c4/0x9b4 fs/splice.c:896
do_splice_direct+0x20c/0x348 fs/splice.c:1002
do_sendfile+0x4bc/0xc70 fs/read_write.c:1255
__do_sys_sendfile64 fs/read_write.c:1317 [inline]
__se_sys_sendfile64 fs/read_write.c:1309 [inline]
__arm64_sys_sendfile64+0x23c/0x3b4 fs/read_write.c:1309
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:206
el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585

Allocated by task 5484:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4c/0x80 mm/kasan/common.c:52
kasan_save_alloc_info+0x24/0x30 mm/kasan/generic.c:505
____kasan_kmalloc mm/kasan/common.c:374 [inline]
__kasan_kmalloc+0xac/0xc4 mm/kasan/common.c:383
kasan_kmalloc include/linux/kasan.h:211 [inline]
kmalloc_trace+0x7c/0x94 mm/slab_common.c:1050
kmalloc include/linux/slab.h:556 [inline]
kzalloc include/linux/slab.h:692 [inline]
init_sbd fs/gfs2/ops_fstype.c:77 [inline]
gfs2_fill_super+0x140/0x1f9c fs/gfs2/ops_fstype.c:1149
get_tree_bdev+0x360/0x54c fs/super.c:1355
gfs2_get_tree+0x54/0x1b4 fs/gfs2/ops_fstype.c:1330
vfs_get_tree+0x90/0x274 fs/super.c:1562
do_new_mount+0x278/0x8fc fs/namespace.c:3051
path_mount+0x590/0xe5c fs/namespace.c:3381
do_mount fs/namespace.c:3394 [inline]
__do_sys_mount fs/namespace.c:3602 [inline]
__se_sys_mount fs/namespace.c:3579 [inline]
__arm64_sys_mount+0x45c/0x594 fs/namespace.c:3579
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:206
el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585

Freed by task 4244:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4c/0x80 mm/kasan/common.c:52
kasan_save_free_info+0x38/0x5c mm/kasan/generic.c:516
____kasan_slab_free+0x144/0x1c0 mm/kasan/common.c:236
__kasan_slab_free+0x18/0x28 mm/kasan/common.c:244
kasan_slab_free include/linux/kasan.h:177 [inline]
slab_free_hook mm/slub.c:1724 [inline]
slab_free_freelist_hook mm/slub.c:1750 [inline]
slab_free mm/slub.c:3661 [inline]
__kmem_cache_free+0x2c0/0x4b4 mm/slub.c:3674
kfree+0xcc/0x1b8 mm/slab_common.c:1007
free_sbd+0x5c/0x6c fs/gfs2/ops_fstype.c:69
gfs2_put_super+0x668/0x6d4 fs/gfs2/super.c:633
generic_shutdown_super+0x130/0x328 fs/super.c:501
kill_block_super+0x70/0xdc fs/super.c:1459
gfs2_kill_sb+0xc0/0xd4
deactivate_locked_super+0xac/0x124 fs/super.c:332
deactivate_super+0xf0/0x110 fs/super.c:363
cleanup_mnt+0x394/0x41c fs/namespace.c:1186
__cleanup_mnt+0x20/0x30 fs/namespace.c:1193
task_work_run+0x240/0x2f0 kernel/task_work.c:179
resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
do_notify_resume+0x2148/0x3474 arch/arm64/kernel/signal.c:1132
prepare_exit_to_user_mode arch/arm64/kernel/entry-common.c:137 [inline]
exit_to_user_mode arch/arm64/kernel/entry-common.c:142 [inline]
el0_svc+0x9c/0x168 arch/arm64/kernel/entry-common.c:638
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585

The buggy address belongs to the object at ffff0000ef5d0000
which belongs to the cache kmalloc-8k of size 8192
The buggy address is located 2672 bytes inside of
8192-byte region [ffff0000ef5d0000, ffff0000ef5d2000)

The buggy address belongs to the physical page:
page:0000000029d6a818 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x12f5d0
head:0000000029d6a818 order:3 compound_mapcount:0 compound_pincount:0
flags: 0x5ffe00000010200(slab|head|node=0|zone=2|lastcpupid=0xfff)
raw: 05ffe00000010200 fffffc0003bd7600 dead000000000005 ffff0000c0002c00
raw: 0000000000000000 0000000080020002 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff0000ef5d0900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff0000ef5d0980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff0000ef5d0a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff0000ef5d0a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff0000ef5d0b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
syz-executor.1 (5542): drop_caches: 2
syz-executor.1 (5542): drop_caches: 2


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup
Reply all
Reply to author
Forward
0 new messages