All of lore.kernel.org
 help / color / mirror / Atom feed
* [syzbot] kernel BUG in ext4_es_cache_extent
@ 2022-02-06 13:49 syzbot
  2022-02-13 18:03 ` Phi Nguyen
  0 siblings, 1 reply; 5+ messages in thread
From: syzbot @ 2022-02-06 13:49 UTC (permalink / raw)
  To: adilger.kernel, linux-ext4, linux-kernel, syzkaller-bugs, tytso

Hello,

syzbot found the following issue on:

HEAD commit:    9f7fb8de5d9b Merge tag 'spi-fix-v5.17-rc2' of git://git.ke..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=148d0304700000
kernel config:  https://syzkaller.appspot.com/x/.config?x=b4a89edfcc8f7c74
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
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=124e0abfb00000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=1758f610700000

Bisection is inconclusive: the issue happens on the oldest tested release.

bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=12758738700000
final oops:     https://syzkaller.appspot.com/x/report.txt?x=11758738700000
console output: https://syzkaller.appspot.com/x/log.txt?x=16758738700000

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

loop0: detected capacity change from 0 to 1051
EXT4-fs (loop0): ext4_check_descriptors: Checksum for group 0 failed (60935!=0)
EXT4-fs (loop0): mounted filesystem without journal. Quota mode: writeback.
------------[ cut here ]------------
kernel BUG at fs/ext4/extents_status.c:899!
invalid opcode: 0000 [#1] PREEMPT SMP KASAN
CPU: 1 PID: 3587 Comm: syz-executor288 Not tainted 5.17.0-rc2-syzkaller-00039-g9f7fb8de5d9b #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:ext4_es_cache_extent+0x4e8/0x550 fs/ext4/extents_status.c:899
Code: 00 48 c7 c7 e0 6c c1 89 c6 05 71 25 6f 0b 01 e8 b0 b6 f6 06 e9 5a ff ff ff e8 94 9d 68 ff 0f 0b e9 d7 fc ff ff e8 88 9d 68 ff <0f> 0b e8 81 9d 68 ff 0f 0b e9 13 fe ff ff e8 25 df af ff e9 c2 fb
RSP: 0018:ffffc90001abee80 EFLAGS: 00010293
RAX: 0000000000000000 RBX: 00000000000013de RCX: 0000000000000000
RDX: ffff88807deb0000 RSI: ffffffff820fd0f8 RDI: 0000000000000003
RBP: ffff888074e6f048 R08: 00000000ffffffff R09: 0000000000000000
R10: ffffffff820fce3c R11: 0000000000000000 R12: 0000000000000001
R13: 00000000ffffffff R14: 1ffff92000357dd1 R15: 00008f1cffffffff
FS:  0000555556ad6300(0000) GS:ffff8880b9d00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f117149e4b0 CR3: 000000007cc1f000 CR4: 0000000000350ee0
Call Trace:
 <TASK>
 ext4_cache_extents+0x13e/0x2d0 fs/ext4/extents.c:518
 ext4_find_extent+0x8f6/0xd10 fs/ext4/extents.c:916
 ext4_ext_map_blocks+0x1e2/0x5f30 fs/ext4/extents.c:4098
 ext4_map_blocks+0x9ca/0x18a0 fs/ext4/inode.c:563
 ext4_getblk+0x553/0x6b0 fs/ext4/inode.c:849
 ext4_bread_batch+0x7c/0x550 fs/ext4/inode.c:923
 __ext4_find_entry+0x482/0x1050 fs/ext4/namei.c:1600
 ext4_lookup_entry fs/ext4/namei.c:1701 [inline]
 ext4_lookup fs/ext4/namei.c:1769 [inline]
 ext4_lookup+0x4fc/0x730 fs/ext4/namei.c:1760
 __lookup_slow+0x24c/0x480 fs/namei.c:1707
 lookup_slow fs/namei.c:1724 [inline]
 walk_component+0x40f/0x6a0 fs/namei.c:2020
 link_path_walk.part.0+0x7ef/0xf70 fs/namei.c:2347
 link_path_walk fs/namei.c:2272 [inline]
 path_openat+0x266/0x2940 fs/namei.c:3605
 do_filp_open+0x1aa/0x400 fs/namei.c:3636
 do_sys_openat2+0x16d/0x4d0 fs/open.c:1214
 do_sys_open fs/open.c:1230 [inline]
 __do_sys_openat fs/open.c:1246 [inline]
 __se_sys_openat fs/open.c:1241 [inline]
 __x64_sys_openat+0x13f/0x1f0 fs/open.c:1241
 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+0x44/0xae
RIP: 0033:0x7f8e44f22f19
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fff98aa3238 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f8e44f22f19
RDX: 000000000000c880 RSI: 0000000020000100 RDI: 0000000000000005
RBP: 00007f8e44ee27b0 R08: 0000000800000015 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f8e44ee2840
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
 </TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:ext4_es_cache_extent+0x4e8/0x550 fs/ext4/extents_status.c:899
Code: 00 48 c7 c7 e0 6c c1 89 c6 05 71 25 6f 0b 01 e8 b0 b6 f6 06 e9 5a ff ff ff e8 94 9d 68 ff 0f 0b e9 d7 fc ff ff e8 88 9d 68 ff <0f> 0b e8 81 9d 68 ff 0f 0b e9 13 fe ff ff e8 25 df af ff e9 c2 fb
RSP: 0018:ffffc90001abee80 EFLAGS: 00010293
RAX: 0000000000000000 RBX: 00000000000013de RCX: 0000000000000000
RDX: ffff88807deb0000 RSI: ffffffff820fd0f8 RDI: 0000000000000003
RBP: ffff888074e6f048 R08: 00000000ffffffff R09: 0000000000000000
R10: ffffffff820fce3c R11: 0000000000000000 R12: 0000000000000001
R13: 00000000ffffffff R14: 1ffff92000357dd1 R15: 00008f1cffffffff
FS:  0000555556ad6300(0000) GS:ffff8880b9d00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f117149e4b0 CR3: 000000007cc1f000 CR4: 0000000000350ee0


---
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 syzkaller@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
For information about bisection process see: https://goo.gl/tpsmEJ#bisection
syzbot can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [syzbot] kernel BUG in ext4_es_cache_extent
  2022-02-06 13:49 [syzbot] kernel BUG in ext4_es_cache_extent syzbot
@ 2022-02-13 18:03 ` Phi Nguyen
  2022-02-13 23:39   ` syzbot
  2022-04-20 12:16   ` Jan Kara
  0 siblings, 2 replies; 5+ messages in thread
From: Phi Nguyen @ 2022-02-13 18:03 UTC (permalink / raw)
  To: syzbot, adilger.kernel, linux-ext4, linux-kernel, tytso

[-- Attachment #1: Type: text/plain, Size: 6088 bytes --]

On 2/6/2022 9:49 PM, syzbot wrote:
> Hello,
> 
> syzbot found the following issue on:
> 
> HEAD commit:    9f7fb8de5d9b Merge tag 'spi-fix-v5.17-rc2' of git://git.ke..
> git tree:       upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=148d0304700000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=b4a89edfcc8f7c74
> 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
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=124e0abfb00000
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=1758f610700000
> 
> Bisection is inconclusive: the issue happens on the oldest tested release.
> 
> bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=12758738700000
> final oops:     https://syzkaller.appspot.com/x/report.txt?x=11758738700000
> console output: https://syzkaller.appspot.com/x/log.txt?x=16758738700000
> 
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+c7358a3cd05ee786eb31@syzkaller.appspotmail.com
> 
> loop0: detected capacity change from 0 to 1051
> EXT4-fs (loop0): ext4_check_descriptors: Checksum for group 0 failed (60935!=0)
> EXT4-fs (loop0): mounted filesystem without journal. Quota mode: writeback.
> ------------[ cut here ]------------
> kernel BUG at fs/ext4/extents_status.c:899!
> invalid opcode: 0000 [#1] PREEMPT SMP KASAN
> CPU: 1 PID: 3587 Comm: syz-executor288 Not tainted 5.17.0-rc2-syzkaller-00039-g9f7fb8de5d9b #0
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
> RIP: 0010:ext4_es_cache_extent+0x4e8/0x550 fs/ext4/extents_status.c:899
> Code: 00 48 c7 c7 e0 6c c1 89 c6 05 71 25 6f 0b 01 e8 b0 b6 f6 06 e9 5a ff ff ff e8 94 9d 68 ff 0f 0b e9 d7 fc ff ff e8 88 9d 68 ff <0f> 0b e8 81 9d 68 ff 0f 0b e9 13 fe ff ff e8 25 df af ff e9 c2 fb
> RSP: 0018:ffffc90001abee80 EFLAGS: 00010293
> RAX: 0000000000000000 RBX: 00000000000013de RCX: 0000000000000000
> RDX: ffff88807deb0000 RSI: ffffffff820fd0f8 RDI: 0000000000000003
> RBP: ffff888074e6f048 R08: 00000000ffffffff R09: 0000000000000000
> R10: ffffffff820fce3c R11: 0000000000000000 R12: 0000000000000001
> R13: 00000000ffffffff R14: 1ffff92000357dd1 R15: 00008f1cffffffff
> FS:  0000555556ad6300(0000) GS:ffff8880b9d00000(0000) knlGS:0000000000000000
> CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> CR2: 00007f117149e4b0 CR3: 000000007cc1f000 CR4: 0000000000350ee0
> Call Trace:
>   <TASK>
>   ext4_cache_extents+0x13e/0x2d0 fs/ext4/extents.c:518
>   ext4_find_extent+0x8f6/0xd10 fs/ext4/extents.c:916
>   ext4_ext_map_blocks+0x1e2/0x5f30 fs/ext4/extents.c:4098
>   ext4_map_blocks+0x9ca/0x18a0 fs/ext4/inode.c:563
>   ext4_getblk+0x553/0x6b0 fs/ext4/inode.c:849
>   ext4_bread_batch+0x7c/0x550 fs/ext4/inode.c:923
>   __ext4_find_entry+0x482/0x1050 fs/ext4/namei.c:1600
>   ext4_lookup_entry fs/ext4/namei.c:1701 [inline]
>   ext4_lookup fs/ext4/namei.c:1769 [inline]
>   ext4_lookup+0x4fc/0x730 fs/ext4/namei.c:1760
>   __lookup_slow+0x24c/0x480 fs/namei.c:1707
>   lookup_slow fs/namei.c:1724 [inline]
>   walk_component+0x40f/0x6a0 fs/namei.c:2020
>   link_path_walk.part.0+0x7ef/0xf70 fs/namei.c:2347
>   link_path_walk fs/namei.c:2272 [inline]
>   path_openat+0x266/0x2940 fs/namei.c:3605
>   do_filp_open+0x1aa/0x400 fs/namei.c:3636
>   do_sys_openat2+0x16d/0x4d0 fs/open.c:1214
>   do_sys_open fs/open.c:1230 [inline]
>   __do_sys_openat fs/open.c:1246 [inline]
>   __se_sys_openat fs/open.c:1241 [inline]
>   __x64_sys_openat+0x13f/0x1f0 fs/open.c:1241
>   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+0x44/0xae
> RIP: 0033:0x7f8e44f22f19
> Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 c0 ff ff ff f7 d8 64 89 01 48
> RSP: 002b:00007fff98aa3238 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
> RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f8e44f22f19
> RDX: 000000000000c880 RSI: 0000000020000100 RDI: 0000000000000005
> RBP: 00007f8e44ee27b0 R08: 0000000800000015 R09: 0000000000000000
> R10: 0000000000000000 R11: 0000000000000246 R12: 00007f8e44ee2840
> R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
>   </TASK>
> Modules linked in:
> ---[ end trace 0000000000000000 ]---
> RIP: 0010:ext4_es_cache_extent+0x4e8/0x550 fs/ext4/extents_status.c:899
> Code: 00 48 c7 c7 e0 6c c1 89 c6 05 71 25 6f 0b 01 e8 b0 b6 f6 06 e9 5a ff ff ff e8 94 9d 68 ff 0f 0b e9 d7 fc ff ff e8 88 9d 68 ff <0f> 0b e8 81 9d 68 ff 0f 0b e9 13 fe ff ff e8 25 df af ff e9 c2 fb
> RSP: 0018:ffffc90001abee80 EFLAGS: 00010293
> RAX: 0000000000000000 RBX: 00000000000013de RCX: 0000000000000000
> RDX: ffff88807deb0000 RSI: ffffffff820fd0f8 RDI: 0000000000000003
> RBP: ffff888074e6f048 R08: 00000000ffffffff R09: 0000000000000000
> R10: ffffffff820fce3c R11: 0000000000000000 R12: 0000000000000001
> R13: 00000000ffffffff R14: 1ffff92000357dd1 R15: 00008f1cffffffff
> FS:  0000555556ad6300(0000) GS:ffff8880b9d00000(0000) knlGS:0000000000000000
> CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> CR2: 00007f117149e4b0 CR3: 000000007cc1f000 CR4: 0000000000350ee0
> 
> 
> ---
> 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 syzkaller@googlegroups.com.
> 
> syzbot will keep track of this issue. See:
> https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
> For information about bisection process see: https://goo.gl/tpsmEJ#bisection
> syzbot can test patches for this issue, for details see:
> https://goo.gl/tpsmEJ#testing-patches
> 

The non-journal mounted fs is corrupted, syzbot was able to mount it 
because a [fast commit] patch exclude its inodes from verification process.

#syz test: 
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master

[-- Attachment #2: ext4_es_cache_extent.patch --]
[-- Type: text/plain, Size: 595 bytes --]

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 01c9e4f743ba..385f4ae71573 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -4912,7 +4912,7 @@ struct inode *__ext4_iget(struct super_block *sb, unsigned long ino,
 		goto bad_inode;
 	} else if (!ext4_has_inline_data(inode)) {
 		/* validate the block references in the inode */
-		if (!(EXT4_SB(sb)->s_mount_state & EXT4_FC_REPLAY) &&
+		if (!(journal && EXT4_SB(sb)->s_mount_state & EXT4_FC_REPLAY) &&
 			(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
 			(S_ISLNK(inode->i_mode) &&
 			!ext4_inode_is_fast_symlink(inode)))) {

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [syzbot] kernel BUG in ext4_es_cache_extent
  2022-02-13 18:03 ` Phi Nguyen
@ 2022-02-13 23:39   ` syzbot
  2022-04-20 12:16   ` Jan Kara
  1 sibling, 0 replies; 5+ messages in thread
From: syzbot @ 2022-02-13 23:39 UTC (permalink / raw)
  To: adilger.kernel, linux-ext4, linux-kernel, phind.uet,
	syzkaller-bugs, tytso

Hello,

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

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

Tested on:

commit:         754e0b0e Linux 5.17-rc4
git tree:       upstream
kernel config:  https://syzkaller.appspot.com/x/.config?x=a78b064590b9f912
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=1434b306700000

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [syzbot] kernel BUG in ext4_es_cache_extent
  2022-02-13 18:03 ` Phi Nguyen
  2022-02-13 23:39   ` syzbot
@ 2022-04-20 12:16   ` Jan Kara
  2022-04-20 13:57     ` Phi Nguyen
  1 sibling, 1 reply; 5+ messages in thread
From: Jan Kara @ 2022-04-20 12:16 UTC (permalink / raw)
  To: Phi Nguyen; +Cc: syzbot, adilger.kernel, linux-ext4, linux-kernel, tytso

On Mon 14-02-22 02:03:37, Phi Nguyen wrote:
> The non-journal mounted fs is corrupted, syzbot was able to mount it because
> a [fast commit] patch exclude its inodes from verification process.
> 
> #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> master

This patch seems to have fallen through the cracks. Phi, care to submit it
properly with your Signed-off-by etc?

								Honza

> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index 01c9e4f743ba..385f4ae71573 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -4912,7 +4912,7 @@ struct inode *__ext4_iget(struct super_block *sb, unsigned long ino,
>  		goto bad_inode;
>  	} else if (!ext4_has_inline_data(inode)) {
>  		/* validate the block references in the inode */
> -		if (!(EXT4_SB(sb)->s_mount_state & EXT4_FC_REPLAY) &&
> +		if (!(journal && EXT4_SB(sb)->s_mount_state & EXT4_FC_REPLAY) &&
>  			(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
>  			(S_ISLNK(inode->i_mode) &&
>  			!ext4_inode_is_fast_symlink(inode)))) {

-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [syzbot] kernel BUG in ext4_es_cache_extent
  2022-04-20 12:16   ` Jan Kara
@ 2022-04-20 13:57     ` Phi Nguyen
  0 siblings, 0 replies; 5+ messages in thread
From: Phi Nguyen @ 2022-04-20 13:57 UTC (permalink / raw)
  To: Jan Kara; +Cc: syzbot, adilger.kernel, linux-ext4, linux-kernel, tytso

On 4/20/2022 8:16 PM, Jan Kara wrote:
> On Mon 14-02-22 02:03:37, Phi Nguyen wrote:
>> The non-journal mounted fs is corrupted, syzbot was able to mount it because
>> a [fast commit] patch exclude its inodes from verification process.
>>
>> #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
>> master
> 
> This patch seems to have fallen through the cracks. Phi, care to submit it
> properly with your Signed-off-by etc?
> 
> 								Honza
> 
>> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
>> index 01c9e4f743ba..385f4ae71573 100644
>> --- a/fs/ext4/inode.c
>> +++ b/fs/ext4/inode.c
>> @@ -4912,7 +4912,7 @@ struct inode *__ext4_iget(struct super_block *sb, unsigned long ino,
>>   		goto bad_inode;
>>   	} else if (!ext4_has_inline_data(inode)) {
>>   		/* validate the block references in the inode */
>> -		if (!(EXT4_SB(sb)->s_mount_state & EXT4_FC_REPLAY) &&
>> +		if (!(journal && EXT4_SB(sb)->s_mount_state & EXT4_FC_REPLAY) &&
>>   			(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
>>   			(S_ISLNK(inode->i_mode) &&
>>   			!ext4_inode_is_fast_symlink(inode)))) {
> 

Okay, I will send a patch.

BR,
Phi

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-04-20 13:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-06 13:49 [syzbot] kernel BUG in ext4_es_cache_extent syzbot
2022-02-13 18:03 ` Phi Nguyen
2022-02-13 23:39   ` syzbot
2022-04-20 12:16   ` Jan Kara
2022-04-20 13:57     ` Phi Nguyen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.