[v6.1] KASAN: stack-out-of-bounds Read in gfs2_dump_glock

0 views
Skip to first unread message

syzbot

unread,
May 2, 2023, 7:39:57 AM5/2/23
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: ca48fc16c493 Linux 6.1.27
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=12b3ee54280000
kernel config: https://syzkaller.appspot.com/x/.config?x=47d3bbfdb3b1ddd2
dashboard link: https://syzkaller.appspot.com/bug?extid=40ad3ff8aa43131f14c1
compiler: Debian clang version 15.0.7, GNU ld (GNU Binutils for Debian) 2.35.2

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

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/658765c915fa/disk-ca48fc16.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/d69e8a1aff2d/vmlinux-ca48fc16.xz
kernel image: https://storage.googleapis.com/syzbot-assets/0317a9546209/bzImage-ca48fc16.xz

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

gfs2: fsid=syz:syz.0: H: s:SH f:H e:0 p:9201 [syz-executor.1] iterate_dir+0x224/0x560
==================================================================
BUG: KASAN: stack-out-of-bounds in gfs2_dump_glock+0x1537/0x1b70
Read of size 8 at addr ffffc9000ad67cc0 by task syz-executor.1/9217

CPU: 1 PID: 9217 Comm: syz-executor.1 Not tainted 6.1.27-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/14/2023
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
print_address_description mm/kasan/report.c:284 [inline]
print_report+0x15f/0x4f0 mm/kasan/report.c:395
kasan_report+0x136/0x160 mm/kasan/report.c:495
gfs2_dump_glock+0x1537/0x1b70
gfs2_consist_inode_i+0xf1/0x110 fs/gfs2/util.c:465
gfs2_dirent_scan+0x512/0x640 fs/gfs2/dir.c:602
gfs2_dirent_search+0x30a/0x8c0 fs/gfs2/dir.c:850
gfs2_dir_search+0xae/0x2f0 fs/gfs2/dir.c:1650
gfs2_lookupi+0x45f/0x5e0 fs/gfs2/inode.c:323
__gfs2_lookup+0xa0/0x270 fs/gfs2/inode.c:870
gfs2_atomic_open+0x9a/0x220 fs/gfs2/inode.c:1274
atomic_open fs/namei.c:3276 [inline]
lookup_open fs/namei.c:3384 [inline]
open_last_lookups fs/namei.c:3481 [inline]
path_openat+0xf4e/0x2e60 fs/namei.c:3711
do_filp_open+0x230/0x480 fs/namei.c:3741
do_sys_openat2+0x13b/0x500 fs/open.c:1310
do_sys_open fs/open.c:1326 [inline]
__do_sys_open fs/open.c:1334 [inline]
__se_sys_open fs/open.c:1330 [inline]
__x64_sys_open+0x221/0x270 fs/open.c:1330
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f940cc8c169
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f940d9a3168 EFLAGS: 00000246 ORIG_RAX: 0000000000000002
RAX: ffffffffffffffda RBX: 00007f940cdac050 RCX: 00007f940cc8c169
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 00000000200025c0
RBP: 00007f940cce7ca1 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffdd840d49f R14: 00007f940d9a3300 R15: 0000000000022000
</TASK>

The buggy address belongs to the virtual mapping at
[ffffc9000ad60000, ffffc9000ad69000) created by:
copy_process+0x637/0x4020 kernel/fork.c:2090

The buggy address belongs to the physical page:
page:ffffea00008e7800 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x239e0
memcg:ffff888078a8c102
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000000 0000000000000000 dead000000000122 0000000000000000
raw: 0000000000000000 0000000000000000 00000001ffffffff ffff888078a8c102
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x102dc2(GFP_HIGHUSER|__GFP_NOWARN|__GFP_ZERO), pid 9185, tgid 9185 (syz-executor.4), ts 546971742061, free_ts 546775494766
set_page_owner include/linux/page_owner.h:31 [inline]
post_alloc_hook+0x18d/0x1b0 mm/page_alloc.c:2533
prep_new_page mm/page_alloc.c:2540 [inline]
get_page_from_freelist+0x32ed/0x3480 mm/page_alloc.c:4292
__alloc_pages+0x28d/0x770 mm/page_alloc.c:5559
vm_area_alloc_pages mm/vmalloc.c:2979 [inline]
__vmalloc_area_node mm/vmalloc.c:3047 [inline]
__vmalloc_node_range+0x96c/0x1460 mm/vmalloc.c:3219
alloc_thread_stack_node kernel/fork.c:311 [inline]
dup_task_struct+0x3e5/0x6d0 kernel/fork.c:980
copy_process+0x637/0x4020 kernel/fork.c:2090
kernel_clone+0x222/0x920 kernel/fork.c:2679
__do_sys_clone kernel/fork.c:2820 [inline]
__se_sys_clone kernel/fork.c:2804 [inline]
__x64_sys_clone+0x231/0x280 kernel/fork.c:2804
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 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:1460 [inline]
free_pcp_prepare mm/page_alloc.c:1510 [inline]
free_unref_page_prepare+0xf63/0x1120 mm/page_alloc.c:3388
free_unref_page_list+0x107/0x810 mm/page_alloc.c:3530
release_pages+0x2836/0x2b40 mm/swap.c:1055
tlb_batch_pages_flush mm/mmu_gather.c:59 [inline]
tlb_flush_mmu_free mm/mmu_gather.c:254 [inline]
tlb_flush_mmu+0xfc/0x210 mm/mmu_gather.c:261
tlb_finish_mmu+0xce/0x1f0 mm/mmu_gather.c:361
exit_mmap+0x3c3/0x9f0 mm/mmap.c:3139
__mmput+0x115/0x3c0 kernel/fork.c:1191
exit_mm+0x226/0x300 kernel/exit.c:563
do_exit+0x67e/0x2300 kernel/exit.c:856
do_group_exit+0x202/0x2b0 kernel/exit.c:1019
__do_sys_exit_group kernel/exit.c:1030 [inline]
__se_sys_exit_group kernel/exit.c:1028 [inline]
__x64_sys_exit_group+0x3b/0x40 kernel/exit.c:1028
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd

Memory state around the buggy address:
ffffc9000ad67b80: 00 00 00 00 f1 f1 f1 f1 00 00 00 00 00 00 00 00
ffffc9000ad67c00: 00 f2 f2 f2 f2 f2 00 f2 f2 f2 00 00 00 00 00 00
>ffffc9000ad67c80: 00 00 00 00 00 00 00 00 f3 f3 f3 f3 00 00 00 00
^
ffffc9000ad67d00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffffc9000ad67d80: f1 f1 f1 f1 04 f3 f3 f3 00 00 00 00 00 00 00 00
==================================================================


---
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 bug is already fixed, let syzbot know by replying with:
#syz fix: exact-commit-title

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

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

If you want to undo deduplication, reply with:
#syz undup

syzbot

unread,
May 30, 2023, 8:45:47 AM5/30/23
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: a343b0dd87b4 Linux 6.1.30
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=11e9f3bd280000
kernel config: https://syzkaller.appspot.com/x/.config?x=5265a3c898f3cbbb
dashboard link: https://syzkaller.appspot.com/bug?extid=40ad3ff8aa43131f14c1
compiler: Debian clang version 15.0.7, GNU ld (GNU Binutils for Debian) 2.35.2
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=17ac993e280000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=15d7be5d280000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/195d974b1f1c/disk-a343b0dd.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/ea41850547fb/vmlinux-a343b0dd.xz
kernel image: https://storage.googleapis.com/syzbot-assets/13ec9e70ad28/bzImage-a343b0dd.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/16804cc52acd/mount_0.gz

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

==================================================================
BUG: KASAN: stack-out-of-bounds in gfs2_dump_glock+0x1537/0x1b70
Read of size 8 at addr ffffc900058afcc0 by task syz-executor269/4534

CPU: 0 PID: 4534 Comm: syz-executor269 Not tainted 6.1.30-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/25/2023
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
print_address_description mm/kasan/report.c:284 [inline]
print_report+0x15f/0x4f0 mm/kasan/report.c:395
kasan_report+0x136/0x160 mm/kasan/report.c:495
gfs2_dump_glock+0x1537/0x1b70
gfs2_consist_inode_i+0xf1/0x110 fs/gfs2/util.c:465
gfs2_dirent_scan+0x512/0x640 fs/gfs2/dir.c:602
gfs2_dirent_search+0x30a/0x8c0 fs/gfs2/dir.c:850
gfs2_dir_search+0xae/0x2f0 fs/gfs2/dir.c:1650
gfs2_lookupi+0x45f/0x5e0 fs/gfs2/inode.c:323
__gfs2_lookup+0xa0/0x270 fs/gfs2/inode.c:870
gfs2_atomic_open+0x9a/0x220 fs/gfs2/inode.c:1274
atomic_open fs/namei.c:3276 [inline]
lookup_open fs/namei.c:3384 [inline]
open_last_lookups fs/namei.c:3481 [inline]
path_openat+0xf4e/0x2e60 fs/namei.c:3711
do_filp_open+0x230/0x480 fs/namei.c:3741
do_sys_openat2+0x13b/0x500 fs/open.c:1318
do_sys_open fs/open.c:1334 [inline]
__do_sys_open fs/open.c:1342 [inline]
__se_sys_open fs/open.c:1338 [inline]
__x64_sys_open+0x221/0x270 fs/open.c:1338
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7fa45eb22179
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 d1 15 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fa456eab318 EFLAGS: 00000246 ORIG_RAX: 0000000000000002
RAX: ffffffffffffffda RBX: 00007fa45ebb97b8 RCX: 00007fa45eb22179
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 00000000200025c0
RBP: 00007fa45ebb97b0 R08: 00007fa456eab700 R09: 0000000000000000
R10: 00007fa456eab700 R11: 0000000000000246 R12: 0030656c69662f2e
R13: 00007ffe069d65af R14: 00007fa456eab400 R15: 0000000000022000
</TASK>

The buggy address belongs to the virtual mapping at
[ffffc900058a8000, ffffc900058b1000) created by:
copy_process+0x637/0x4020 kernel/fork.c:2090

The buggy address belongs to the physical page:
page:ffffea0000a1df00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x2877c
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000000 0000000000000000 dead000000000122 0000000000000000
raw: 0000000000000000 0000000000000000 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x2dc2(GFP_KERNEL|__GFP_HIGHMEM|__GFP_NOWARN|__GFP_ZERO), pid 4526, tgid 4526 (syz-executor269), ts 780897127472, free_ts 780846560151
__pagevec_release+0x80/0xf0 mm/swap.c:1075
pagevec_release include/linux/pagevec.h:71 [inline]
folio_batch_release include/linux/pagevec.h:135 [inline]
truncate_inode_pages_range+0x48a/0x1340 mm/truncate.c:373
kill_bdev block/bdev.c:76 [inline]
blkdev_flush_mapping+0x154/0x2b0 block/bdev.c:662
blkdev_put_whole block/bdev.c:693 [inline]
blkdev_put+0x4c0/0x750 block/bdev.c:953
deactivate_locked_super+0xa0/0x110 fs/super.c:332
cleanup_mnt+0x490/0x520 fs/namespace.c:1186
task_work_run+0x246/0x300 kernel/task_work.c:179
resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
exit_to_user_mode_loop+0xd9/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:286 [inline]
syscall_exit_to_user_mode+0x60/0x270 kernel/entry/common.c:297
do_syscall_64+0x49/0xb0 arch/x86/entry/common.c:86
entry_SYSCALL_64_after_hwframe+0x63/0xcd

Memory state around the buggy address:
ffffc900058afb80: 00 00 00 00 f1 f1 f1 f1 00 00 00 00 00 00 00 00
ffffc900058afc00: 00 f2 f2 f2 f2 f2 00 f2 f2 f2 00 00 00 00 00 00
>ffffc900058afc80: 00 00 00 00 00 00 00 00 f3 f3 f3 f3 00 00 00 00
^
ffffc900058afd00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffffc900058afd80: f1 f1 f1 f1 04 f3 f3 f3 00 00 00 00 00 00 00 00
==================================================================


---
If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.
Reply all
Reply to author
Forward
0 new messages