2022-09-16 06:24:29

by syzbot

[permalink] [raw]
Subject: [syzbot] WARNING in gfs2_ri_update

Hello,

syzbot found the following issue on:

HEAD commit: a6b443748715 Merge branch 'for-next/core', remote-tracking..
git tree: git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci
console output: https://syzkaller.appspot.com/x/log.txt?x=10340c9f080000
kernel config: https://syzkaller.appspot.com/x/.config?x=e79d82586727c5df
dashboard link: https://syzkaller.appspot.com/bug?extid=f8bc4176e51e87e0928f
compiler: Debian clang version 13.0.1-++20220126092033+75e33f71c2da-1~exp1~20220126212112.63, GNU ld (GNU Binutils for Debian) 2.35.2
userspace arch: arm64

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

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/1436897f0dc0/disk-a6b44374.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/68c4de151fbb/vmlinux-a6b44374.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: [email protected]

gfs2: fsid=syz:syz.0: first mount done, others may mount
------------[ cut here ]------------
WARNING: CPU: 1 PID: 2396 at mm/page_alloc.c:5491 __alloc_pages+0x150/0x1fc mm/page_alloc.c:5491
Modules linked in:
CPU: 1 PID: 2396 Comm: syz-executor.3 Not tainted 6.0.0-rc4-syzkaller-17255-ga6b443748715 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/26/2022
pstate: 20400005 (nzCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : __alloc_pages+0x150/0x1fc mm/page_alloc.c:5491
lr : alloc_pages+0x374/0x484
sp : ffff8000148f3790
x29: ffff8000148f37d0 x28: ffff000109e54000 x27: ffff000109e54000
x26: ffff0001046e6000 x25: ffff000107f24f80 x24: ffff80000eeb3bf0
x23: 0000000000000000 x22: 0000000000000000 x21: 0000000000000000
x20: 0000000000000000 x19: 0000000000000016 x18: ffff000107f24f80
x17: 0000000000000050 x16: 0000000000000000 x15: 0000000000000000
x14: 0000000000000002 x13: 0000000000000005 x12: 0000000000040000
x11: 000000000003ffff x10: ffff80001d524000 x9 : 0000000000000001
x8 : ffff80000d8f7000 x7 : ffff800008188fe8 x6 : 0000000000000000
x5 : 0000000000000080 x4 : 0000000000000001 x3 : 0000000000000000
x2 : 0000000000000000 x1 : 0000000000000016 x0 : 0000000000040d40
Call trace:
__alloc_pages+0x150/0x1fc mm/page_alloc.c:5491
alloc_pages+0x374/0x484
kmalloc_order+0x34/0x104 mm/slab_common.c:930
kmalloc_order_trace+0x2c/0x7c mm/slab_common.c:946
kmalloc_large include/linux/slab.h:529 [inline]
__kmalloc+0x2ec/0x394 mm/slub.c:4413
kmalloc_array include/linux/slab.h:640 [inline]
kcalloc include/linux/slab.h:671 [inline]
compute_bitstructs fs/gfs2/rgrp.c:766 [inline]
read_rindex_entry fs/gfs2/rgrp.c:931 [inline]
gfs2_ri_update+0x1a4/0x7e4 fs/gfs2/rgrp.c:1001
gfs2_rindex_update+0x1b0/0x21c fs/gfs2/rgrp.c:1051
init_inodes+0x11c/0x184 fs/gfs2/ops_fstype.c:910
gfs2_fill_super+0x630/0x874 fs/gfs2/ops_fstype.c:1240
get_tree_bdev+0x1e8/0x2a0 fs/super.c:1323
gfs2_get_tree+0x30/0xc0 fs/gfs2/ops_fstype.c:1323
vfs_get_tree+0x40/0x140 fs/super.c:1530
do_new_mount+0x1dc/0x4e4 fs/namespace.c:3040
path_mount+0x358/0x914 fs/namespace.c:3370
do_mount fs/namespace.c:3383 [inline]
__do_sys_mount fs/namespace.c:3591 [inline]
__se_sys_mount fs/namespace.c:3568 [inline]
__arm64_sys_mount+0x2f8/0x408 fs/namespace.c:3568
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall arch/arm64/kernel/syscall.c:52 [inline]
el0_svc_common+0x138/0x220 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x48/0x164 arch/arm64/kernel/syscall.c:206
el0_svc+0x58/0x150 arch/arm64/kernel/entry-common.c:624
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:642
el0t_64_sync+0x18c/0x190
irq event stamp: 46508
hardirqs last enabled at (46507): [<ffff80000bfd8fbc>] __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:151 [inline]
hardirqs last enabled at (46507): [<ffff80000bfd8fbc>] _raw_spin_unlock_irqrestore+0x48/0x8c kernel/locking/spinlock.c:194
hardirqs last disabled at (46508): [<ffff80000bfc6674>] el1_dbg+0x24/0x5c arch/arm64/kernel/entry-common.c:395
softirqs last enabled at (46504): [<ffff800009272c30>] local_bh_enable+0x10/0x34 include/linux/bottom_half.h:32
softirqs last disabled at (46502): [<ffff800009272bfc>] local_bh_disable+0x10/0x34 include/linux/bottom_half.h:19
---[ end trace 0000000000000000 ]---


---
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 [email protected].

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


2022-10-22 12:10:39

by syzbot

[permalink] [raw]
Subject: Re: [syzbot] WARNING in gfs2_ri_update

syzbot has found a reproducer for the following issue on:

HEAD commit: 440b7895c990 Merge tag 'mm-hotfixes-stable-2022-10-20' of ..
git tree: upstream
console+strace: https://syzkaller.appspot.com/x/log.txt?x=128087a4880000
kernel config: https://syzkaller.appspot.com/x/.config?x=afc317c0f52ce670
dashboard link: https://syzkaller.appspot.com/bug?extid=f8bc4176e51e87e0928f
compiler: Debian clang version 13.0.1-++20220126092033+75e33f71c2da-1~exp1~20220126212112.63, GNU ld (GNU Binutils for Debian) 2.35.2
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=13ed90f2880000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=16717fc2880000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/105038975fc9/disk-440b7895.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/edd7302c8fc8/vmlinux-440b7895.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/95d6d27d2d50/mount_0.gz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: [email protected]

gfs2: fsid=syz:syz: Now mounting FS (format 1801)...
gfs2: fsid=syz:syz.0: journal 0 mapped with 1 extents in 0ms
gfs2: fsid=syz:syz.0: first mount done, others may mount
------------[ cut here ]------------
WARNING: CPU: 0 PID: 3611 at mm/page_alloc.c:5530 __alloc_pages+0x30a/0x560 mm/page_alloc.c:5530
Modules linked in:
CPU: 1 PID: 3611 Comm: syz-executor282 Not tainted 6.1.0-rc1-syzkaller-00158-g440b7895c990 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/11/2022
RIP: 0010:__alloc_pages+0x30a/0x560 mm/page_alloc.c:5530
Code: 5c 24 04 0f 85 f3 00 00 00 44 89 e1 81 e1 7f ff ff ff a9 00 00 04 00 41 0f 44 cc 41 89 cc e9 e3 00 00 00 c6 05 a1 ab 29 0c 01 <0f> 0b 83 fb 0a 0f 86 c8 fd ff ff 31 db 48 c7 44 24 20 0e 36 e0 45
RSP: 0018:ffffc90003c5f4a0 EFLAGS: 00010246
RAX: ffffc90003c5f500 RBX: 0000000000000012 RCX: 0000000000000000
RDX: 0000000000000028 RSI: 0000000000000000 RDI: ffffc90003c5f528
RBP: ffffc90003c5f5b8 R08: dffffc0000000000 R09: ffffc90003c5f500
R10: fffff5200078bea5 R11: 1ffff9200078bea0 R12: 0000000000040d40
R13: 1ffff9200078be9c R14: dffffc0000000000 R15: 1ffff9200078be98
FS: 0000555555781300(0000) GS:ffff8880b9b00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00000000005d84c8 CR3: 0000000079874000 CR4: 00000000003506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
__alloc_pages_node include/linux/gfp.h:223 [inline]
alloc_pages_node include/linux/gfp.h:246 [inline]
__kmalloc_large_node+0x8a/0x1a0 mm/slab_common.c:1098
__do_kmalloc_node mm/slab_common.c:943 [inline]
__kmalloc+0xfe/0x1a0 mm/slab_common.c:968
kmalloc_array include/linux/slab.h:628 [inline]
kcalloc include/linux/slab.h:659 [inline]
compute_bitstructs fs/gfs2/rgrp.c:766 [inline]
read_rindex_entry fs/gfs2/rgrp.c:931 [inline]
gfs2_ri_update+0x537/0x17f0 fs/gfs2/rgrp.c:1001
gfs2_rindex_update+0x313/0x3f0 fs/gfs2/rgrp.c:1051
init_inodes+0x242/0x340 fs/gfs2/ops_fstype.c:917
gfs2_fill_super+0x1bb2/0x2700 fs/gfs2/ops_fstype.c:1247
get_tree_bdev+0x400/0x620 fs/super.c:1323
gfs2_get_tree+0x50/0x210 fs/gfs2/ops_fstype.c:1330
vfs_get_tree+0x88/0x270 fs/super.c:1530
do_new_mount+0x289/0xad0 fs/namespace.c:3040
do_mount fs/namespace.c:3383 [inline]
__do_sys_mount fs/namespace.c:3591 [inline]
__se_sys_mount+0x2d3/0x3c0 fs/namespace.c:3568
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:0x7fb4bd4a797a
Code: 83 c4 08 5b 5d c3 66 2e 0f 1f 84 00 00 00 00 00 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffc73f0a0b8 EFLAGS: 00000282 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007fb4bd4a797a
RDX: 0000000020000000 RSI: 0000000020000100 RDI: 00007ffc73f0a0d0
RBP: 00007ffc73f0a0d0 R08: 00007ffc73f0a110 R09: 00005555557812c0
R10: 0000000000000000 R11: 0000000000000282 R12: 0000000000000004
R13: 00007ffc73f0a110 R14: 000000000000091b R15: 000000002000dc88
</TASK>

2022-10-25 10:28:08

by Andrew Price

[permalink] [raw]
Subject: Re: [Cluster-devel] [syzbot] WARNING in gfs2_ri_update

On 22/10/2022 12:11, syzbot wrote:
> syzbot has found a reproducer for the following issue on:
>
> HEAD commit: 440b7895c990 Merge tag 'mm-hotfixes-stable-2022-10-20' of ..
> git tree: upstream
> console+strace: https://syzkaller.appspot.com/x/log.txt?x=128087a4880000
> kernel config: https://syzkaller.appspot.com/x/.config?x=afc317c0f52ce670
> dashboard link: https://syzkaller.appspot.com/bug?extid=f8bc4176e51e87e0928f
> compiler: Debian clang version 13.0.1-++20220126092033+75e33f71c2da-1~exp1~20220126212112.63, GNU ld (GNU Binutils for Debian) 2.35.2
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=13ed90f2880000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=16717fc2880000
>
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/105038975fc9/disk-440b7895.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/edd7302c8fc8/vmlinux-440b7895.xz
> mounted in repro: https://storage.googleapis.com/syzbot-assets/95d6d27d2d50/mount_0.gz
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: [email protected]
>
> gfs2: fsid=syz:syz: Now mounting FS (format 1801)...
> gfs2: fsid=syz:syz.0: journal 0 mapped with 1 extents in 0ms
> gfs2: fsid=syz:syz.0: first mount done, others may mount
> ------------[ cut here ]------------
> WARNING: CPU: 0 PID: 3611 at mm/page_alloc.c:5530 __alloc_pages+0x30a/0x560 mm/page_alloc.c:5530
> Modules linked in:
> CPU: 1 PID: 3611 Comm: syz-executor282 Not tainted 6.1.0-rc1-syzkaller-00158-g440b7895c990 #0
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/11/2022
> RIP: 0010:__alloc_pages+0x30a/0x560 mm/page_alloc.c:5530
> Code: 5c 24 04 0f 85 f3 00 00 00 44 89 e1 81 e1 7f ff ff ff a9 00 00 04 00 41 0f 44 cc 41 89 cc e9 e3 00 00 00 c6 05 a1 ab 29 0c 01 <0f> 0b 83 fb 0a 0f 86 c8 fd ff ff 31 db 48 c7 44 24 20 0e 36 e0 45
> RSP: 0018:ffffc90003c5f4a0 EFLAGS: 00010246
> RAX: ffffc90003c5f500 RBX: 0000000000000012 RCX: 0000000000000000
> RDX: 0000000000000028 RSI: 0000000000000000 RDI: ffffc90003c5f528
> RBP: ffffc90003c5f5b8 R08: dffffc0000000000 R09: ffffc90003c5f500
> R10: fffff5200078bea5 R11: 1ffff9200078bea0 R12: 0000000000040d40
> R13: 1ffff9200078be9c R14: dffffc0000000000 R15: 1ffff9200078be98
> FS: 0000555555781300(0000) GS:ffff8880b9b00000(0000) knlGS:0000000000000000
> CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> CR2: 00000000005d84c8 CR3: 0000000079874000 CR4: 00000000003506e0
> DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
> Call Trace:
> <TASK>
> __alloc_pages_node include/linux/gfp.h:223 [inline]
> alloc_pages_node include/linux/gfp.h:246 [inline]
> __kmalloc_large_node+0x8a/0x1a0 mm/slab_common.c:1098
> __do_kmalloc_node mm/slab_common.c:943 [inline]
> __kmalloc+0xfe/0x1a0 mm/slab_common.c:968
> kmalloc_array include/linux/slab.h:628 [inline]
> kcalloc include/linux/slab.h:659 [inline]
> compute_bitstructs fs/gfs2/rgrp.c:766 [inline]
> read_rindex_entry fs/gfs2/rgrp.c:931 [inline]

The fuzzer is writing 16777217 to an rindex entry's ri_length field so
compute_bitstructs() is asking kmalloc for (16777217 * 40) bytes of
memory, to which it says nope and dumps a warning.

Simpler version:
# mkfs.gfs2 -p lock_nolock -o align=0 /dev/vdc
# printf '\x01\x00\x00\x01' | dd of=/dev/vdc bs=1 seek=135676008 count=4
# mount /dev/vdc /mnt/test

I have some experimental code to add integrity checking to rindex
entries[0] that would catch this but it would require an sb_fs_format
bump before it can treat ri_crc == 0 usefully.

0.
https://gitlab.com/andyprice/linux/-/commit/4e0557916733e59b2e6795775e94c9b733b51f6b

Andy

> gfs2_ri_update+0x537/0x17f0 fs/gfs2/rgrp.c:1001
> gfs2_rindex_update+0x313/0x3f0 fs/gfs2/rgrp.c:1051
> init_inodes+0x242/0x340 fs/gfs2/ops_fstype.c:917
> gfs2_fill_super+0x1bb2/0x2700 fs/gfs2/ops_fstype.c:1247
> get_tree_bdev+0x400/0x620 fs/super.c:1323
> gfs2_get_tree+0x50/0x210 fs/gfs2/ops_fstype.c:1330
> vfs_get_tree+0x88/0x270 fs/super.c:1530
> do_new_mount+0x289/0xad0 fs/namespace.c:3040
> do_mount fs/namespace.c:3383 [inline]
> __do_sys_mount fs/namespace.c:3591 [inline]
> __se_sys_mount+0x2d3/0x3c0 fs/namespace.c:3568
> 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:0x7fb4bd4a797a
> Code: 83 c4 08 5b 5d c3 66 2e 0f 1f 84 00 00 00 00 00 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 c0 ff ff ff f7 d8 64 89 01 48
> RSP: 002b:00007ffc73f0a0b8 EFLAGS: 00000282 ORIG_RAX: 00000000000000a5
> RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007fb4bd4a797a
> RDX: 0000000020000000 RSI: 0000000020000100 RDI: 00007ffc73f0a0d0
> RBP: 00007ffc73f0a0d0 R08: 00007ffc73f0a110 R09: 00005555557812c0
> R10: 0000000000000000 R11: 0000000000000282 R12: 0000000000000004
> R13: 00007ffc73f0a110 R14: 000000000000091b R15: 000000002000dc88
> </TASK>
>