[PATCH] ext4: fix extend check syz test:

1 view
Skip to first unread message

Tadeusz Struk

unread,
Sep 30, 2022, 2:30:49 PM9/30/22
to syzbot+c7358a...@syzkaller.appspotmail.com, syzkaller-a...@googlegroups.com, tadeus...@linaro.org
#syz test: https://android.googlesource.com/kernel/common android12-5.10-lts

diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 5235974126bd..c7b5a11e1abc 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -897,6 +897,12 @@ ext4_find_extent(struct inode *inode, ext4_lblk_t block,
goto err;
}

+ ret = ext4_ext_check_inode(inode);
+ if (ret) {
+ EXT4_ERROR_INODE(inode, "inode has invalid extent");
+ goto err;
+ }
+
if (path) {
ext4_ext_drop_refs(path);
if (depth > path[0].p_maxdepth) {
--
2.37.3

Tadeusz Struk

unread,
Sep 30, 2022, 2:32:10 PM9/30/22
to syzbot+c7358a...@syzkaller.appspotmail.com, syzkaller-a...@googlegroups.com, tadeus...@linaro.org

syzbot

unread,
Sep 30, 2022, 3:02:29 PM9/30/22
to syzkaller-a...@googlegroups.com, syzkall...@googlegroups.com, tadeus...@linaro.org
Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-and-tested-by: syzbot+c7358a...@syzkaller.appspotmail.com

Tested on:

commit: 39171669 Revert "usb: dwc3: gadget: Avoid starting DWC..
git tree: https://android.googlesource.com/kernel/common android12-5.10-lts
console output: https://syzkaller.appspot.com/x/log.txt?x=10f21def080000
kernel config: https://syzkaller.appspot.com/x/.config?x=29d7a7468749e460
dashboard link: https://syzkaller.appspot.com/bug?extid=c7358a3cd05ee786eb31
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
patch: https://syzkaller.appspot.com/x/patch.diff?x=161adabc880000

Note: testing is done by a robot and is best-effort only.

syzbot

unread,
Sep 30, 2022, 3:18:23 PM9/30/22
to syzkaller-a...@googlegroups.com, syzkall...@googlegroups.com, tadeus...@linaro.org
Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-and-tested-by: syzbot+c7358a...@syzkaller.appspotmail.com

Tested on:

commit: 70575e77 Merge tag 'for_linus' of git://git.kernel.org..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=13f7b374880000
kernel config: https://syzkaller.appspot.com/x/.config?x=c8291dab1aca731a
dashboard link: https://syzkaller.appspot.com/bug?extid=c7358a3cd05ee786eb31
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
patch: https://syzkaller.appspot.com/x/patch.diff?x=136ac9e4880000

Tadeusz Struk

unread,
Sep 30, 2022, 3:20:14 PM9/30/22
to syzbot+c7358a...@syzkaller.appspotmail.com, syzkaller-a...@googlegroups.com

Tadeusz Struk

unread,
Sep 30, 2022, 3:20:28 PM9/30/22
to syzbot+c7358a...@syzkaller.appspotmail.com, syzkaller-a...@googlegroups.com

syzbot

unread,
Sep 30, 2022, 3:34:24 PM9/30/22
to syzkaller-a...@googlegroups.com, syzkall...@googlegroups.com, tadeus...@linaro.org
Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
kernel BUG in ext4_es_cache_extent

EXT4-fs (loop0): ext4_check_descriptors: Inode bitmap for group 0 overlaps block group descriptors
EXT4-fs (loop0): orphan cleanup on readonly fs
EXT4-fs error (device loop0): ext4_quota_enable:6779: inode #5: comm syz-executor.0: casefold flag without casefold feature
------------[ cut here ]------------
kernel BUG at fs/ext4/extents_status.c:899!
invalid opcode: 0000 [#1] PREEMPT SMP KASAN
CPU: 0 PID: 4090 Comm: syz-executor.0 Not tainted 6.0.0-rc7-syzkaller-00180-g70575e77839f #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/22/2022
RIP: 0010:ext4_es_cache_extent+0x4e3/0x540 fs/ext4/extents_status.c:899
Code: 00 48 c7 c7 60 a2 02 8a c6 05 14 d5 b2 0b 01 e8 68 5c 24 07 e9 5a ff ff ff e8 69 39 65 ff 0f 0b e9 d7 fc ff ff e8 5d 39 65 ff <0f> 0b e8 56 39 65 ff 0f 0b e9 13 fe ff ff e8 ca 9f b1 ff e9 c7 fb
RSP: 0018:ffffc90005887020 EFLAGS: 00010293
RAX: 0000000000000000 RBX: 00000000000033de RCX: 0000000000000000
RDX: ffff888076ea3b00 RSI: ffffffff8216cec3 RDI: 0000000000000004
RBP: ffff8880742f0cb8 R08: 0000000000000004 R09: 00000000ffffffff
R10: 00000000000033de R11: 000000000000000e R12: 0000000000000001
R13: 00000000ffffffff R14: 1ffff92000b10e05 R15: 00008f51ffffffff
FS: 00007fa9fdc2a700(0000) GS:ffff8880b9a00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fa9fdc2b000 CR3: 000000006ed12000 CR4: 0000000000350ef0
Call Trace:
<TASK>
ext4_cache_extents+0x13e/0x2d0 fs/ext4/extents.c:522
ext4_find_extent+0x8f6/0xd10 fs/ext4/extents.c:920
ext4_ext_map_blocks+0x1dd/0x5f50 fs/ext4/extents.c:4101
ext4_map_blocks+0xa7b/0x18d0 fs/ext4/inode.c:570
ext4_getblk+0x167/0x7a0 fs/ext4/inode.c:858
ext4_bread+0x2a/0x190 fs/ext4/inode.c:914
ext4_quota_read+0x246/0x320 fs/ext4/super.c:6910
v2_read_header+0x73/0x100 fs/quota/quota_v2.c:62
v2_check_quota_file+0x6f/0x1c0 fs/quota/quota_v2.c:81
dquot_load_quota_sb+0x573/0xef0 fs/quota/dquot.c:2400
dquot_load_quota_inode fs/quota/dquot.c:2443 [inline]
dquot_load_quota_inode+0x200/0x390 fs/quota/dquot.c:2435
ext4_quota_enable fs/ext4/super.c:6788 [inline]
ext4_enable_quotas+0x5a1/0xb70 fs/ext4/super.c:6814
ext4_orphan_cleanup+0xde1/0x10f0 fs/ext4/orphan.c:432
__ext4_fill_super fs/ext4/super.c:5378 [inline]
ext4_fill_super+0xab06/0xe8d0 fs/ext4/super.c:5517
get_tree_bdev+0x440/0x760 fs/super.c:1323
vfs_get_tree+0x89/0x2f0 fs/super.c:1530
do_new_mount fs/namespace.c:3040 [inline]
path_mount+0x1326/0x1e20 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]
__x64_sys_mount+0x27f/0x300 fs/namespace.c:3568
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7fa9fca8a7aa
Code: 48 c7 c2 b8 ff ff ff f7 d8 64 89 02 b8 ff ff ff ff eb d2 e8 b8 04 00 00 0f 1f 84 00 00 00 00 00 49 89 ca b8 a5 00 00 00 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:00007fa9fdc29f88 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 0000000020000540 RCX: 00007fa9fca8a7aa
RDX: 0000000020000000 RSI: 0000000020000040 RDI: 00007fa9fdc29fe0
RBP: 00007fa9fdc2a020 R08: 00007fa9fdc2a020 R09: 0000000020000000
R10: 0000000000000081 R11: 0000000000000246 R12: 0000000020000000
R13: 0000000020000040 R14: 00007fa9fdc29fe0 R15: 0000000020000740
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:ext4_es_cache_extent+0x4e3/0x540 fs/ext4/extents_status.c:899
Code: 00 48 c7 c7 60 a2 02 8a c6 05 14 d5 b2 0b 01 e8 68 5c 24 07 e9 5a ff ff ff e8 69 39 65 ff 0f 0b e9 d7 fc ff ff e8 5d 39 65 ff <0f> 0b e8 56 39 65 ff 0f 0b e9 13 fe ff ff e8 ca 9f b1 ff e9 c7 fb
RSP: 0018:ffffc90005887020 EFLAGS: 00010293
RAX: 0000000000000000 RBX: 00000000000033de RCX: 0000000000000000
RDX: ffff888076ea3b00 RSI: ffffffff8216cec3 RDI: 0000000000000004
RBP: ffff8880742f0cb8 R08: 0000000000000004 R09: 00000000ffffffff
R10: 00000000000033de R11: 000000000000000e R12: 0000000000000001
R13: 00000000ffffffff R14: 1ffff92000b10e05 R15: 00008f51ffffffff
FS: 00007fa9fdc2a700(0000) GS:ffff8880b9b00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007ffcc85c6608 CR3: 000000006ed12000 CR4: 0000000000350ee0


Tested on:

commit: 70575e77 Merge tag 'for_linus' of git://git.kernel.org..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=107fcd70880000
kernel config: https://syzkaller.appspot.com/x/.config?x=c8291dab1aca731a
dashboard link: https://syzkaller.appspot.com/bug?extid=c7358a3cd05ee786eb31
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2

Note: no patches were applied.

syzbot

unread,
Sep 30, 2022, 3:43:23 PM9/30/22
to syzkaller-a...@googlegroups.com, syzkall...@googlegroups.com, tadeus...@linaro.org
Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
kernel BUG in ext4_es_cache_extent

EXT4-fs (loop0): ext4_check_descriptors: Inode bitmap for group 0 overlaps block group descriptors
EXT4-fs (loop0): orphan cleanup on readonly fs
EXT4-fs error (device loop0): ext4_quota_enable:6398: inode #5: comm syz-executor.0: casefold flag without casefold feature
------------[ cut here ]------------
kernel BUG at fs/ext4/extents_status.c:899!
invalid opcode: 0000 [#1] PREEMPT SMP KASAN
CPU: 0 PID: 5910 Comm: syz-executor.0 Not tainted 5.10.146-syzkaller-10610-g391716695e71 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/22/2022
RIP: 0010:ext4_es_cache_extent+0x4e8/0x550 fs/ext4/extents_status.c:899
Code: 00 48 c7 c7 a0 08 5f 89 c6 05 e9 a1 e5 0a 01 e8 14 22 ae 06 e9 5a ff ff ff e8 24 d9 6d ff 0f 0b e9 d7 fc ff ff e8 18 d9 6d ff <0f> 0b e8 11 d9 6d ff 0f 0b e9 13 fe ff ff e8 d5 75 b0 ff e9 c2 fb
RSP: 0018:ffffc900018bf160 EFLAGS: 00010293
RAX: 0000000000000000 RBX: 000000000000623e RCX: ffffffff8203c70c
RDX: ffff888018909ac0 RSI: ffffffff8203c9c8 RDI: 0000000000000004
RBP: ffff88802eb53f38 R08: 0000000000000000 R09: ffffffff8cfd710f
R10: 00000000ffffffff R11: 0000000000000001 R12: 0000000000000001
R13: 00000000ffffffff R14: 1ffff92000317e2d R15: 00008e6fffffffff
FS: 00007ff13ca55700(0000) GS:ffff8880b9c00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007ff13ca56000 CR3: 00000000161e5000 CR4: 0000000000350ef0
Call Trace:
ext4_cache_extents+0x13e/0x2d0 fs/ext4/extents.c:521
ext4_find_extent+0x8f6/0xd10 fs/ext4/extents.c:917
ext4_ext_map_blocks+0x1e2/0x5f50 fs/ext4/extents.c:4097
ext4_map_blocks+0x9ca/0x18a0 fs/ext4/inode.c:563
ext4_getblk+0x51a/0x670 fs/ext4/inode.c:849
ext4_bread+0x29/0x1f0 fs/ext4/inode.c:901
ext4_quota_read+0x246/0x320 fs/ext4/super.c:6529
v2_read_header+0x73/0x100 fs/quota/quota_v2.c:62
v2_check_quota_file+0x6f/0x1c0 fs/quota/quota_v2.c:81
dquot_load_quota_sb+0x572/0xf10 fs/quota/dquot.c:2395
dquot_load_quota_inode fs/quota/dquot.c:2438 [inline]
dquot_load_quota_inode+0x200/0x390 fs/quota/dquot.c:2430
ext4_quota_enable fs/ext4/super.c:6407 [inline]
ext4_enable_quotas+0x5b9/0xba0 fs/ext4/super.c:6433
ext4_orphan_cleanup fs/ext4/super.c:3067 [inline]
ext4_fill_super+0xa7e0/0xdbf0 fs/ext4/super.c:5092
mount_bdev+0x34d/0x410 fs/super.c:1419
legacy_get_tree+0x105/0x220 fs/fs_context.c:592
vfs_get_tree+0x89/0x2f0 fs/super.c:1549
do_new_mount fs/namespace.c:2899 [inline]
path_mount+0x13cd/0x20e0 fs/namespace.c:3229
do_mount fs/namespace.c:3242 [inline]
__do_sys_mount fs/namespace.c:3450 [inline]
__se_sys_mount fs/namespace.c:3427 [inline]
__x64_sys_mount+0x27f/0x300 fs/namespace.c:3427
do_syscall_64+0x2d/0x40 arch/x86/entry/common.c:46
entry_SYSCALL_64_after_hwframe+0x61/0xc6
RIP: 0033:0x7ff13d2e17aa
Code: 48 c7 c2 b8 ff ff ff f7 d8 64 89 02 b8 ff ff ff ff eb d2 e8 b8 04 00 00 0f 1f 84 00 00 00 00 00 49 89 ca b8 a5 00 00 00 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:00007ff13ca54f88 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 0000000020000540 RCX: 00007ff13d2e17aa
RDX: 0000000020000000 RSI: 0000000020000040 RDI: 00007ff13ca54fe0
RBP: 00007ff13ca55020 R08: 00007ff13ca55020 R09: 0000000020000000
R10: 0000000000000081 R11: 0000000000000246 R12: 0000000020000000
R13: 0000000020000040 R14: 00007ff13ca54fe0 R15: 0000000020000740
Modules linked in:
---[ end trace 6aadebf6db7540d7 ]---
RIP: 0010:ext4_es_cache_extent+0x4e8/0x550 fs/ext4/extents_status.c:899
Code: 00 48 c7 c7 a0 08 5f 89 c6 05 e9 a1 e5 0a 01 e8 14 22 ae 06 e9 5a ff ff ff e8 24 d9 6d ff 0f 0b e9 d7 fc ff ff e8 18 d9 6d ff <0f> 0b e8 11 d9 6d ff 0f 0b e9 13 fe ff ff e8 d5 75 b0 ff e9 c2 fb
RSP: 0018:ffffc900018bf160 EFLAGS: 00010293
RAX: 0000000000000000 RBX: 000000000000623e RCX: ffffffff8203c70c
RDX: ffff888018909ac0 RSI: ffffffff8203c9c8 RDI: 0000000000000004
RBP: ffff88802eb53f38 R08: 0000000000000000 R09: ffffffff8cfd710f
R10: 00000000ffffffff R11: 0000000000000001 R12: 0000000000000001
R13: 00000000ffffffff R14: 1ffff92000317e2d R15: 00008e6fffffffff
FS: 00007ff13ca55700(0000) GS:ffff8880b9c00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007ff13ca56000 CR3: 00000000161e5000 CR4: 0000000000350ef0


Tested on:

commit: 39171669 Revert "usb: dwc3: gadget: Avoid starting DWC..
git tree: https://android.googlesource.com/kernel/common android12-5.10-lts
console output: https://syzkaller.appspot.com/x/log.txt?x=14391ad0880000
kernel config: https://syzkaller.appspot.com/x/.config?x=29d7a7468749e460
Reply all
Reply to author
Forward
0 new messages