linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [syzbot] [ext4?] general protection fault in utf8nlookup
@ 2023-09-20  5:25 syzbot
  2023-09-20  7:36 ` Eric Biggers
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: syzbot @ 2023-09-20  5:25 UTC (permalink / raw)
  To: adilger.kernel, ebiggers, krisman, linux-ext4, linux-fsdevel,
	linux-kernel, syzkaller-bugs, tytso

Hello,

syzbot found the following issue on:

HEAD commit:    e42bebf6db29 Merge tag 'efi-fixes-for-v6.6-1' of git://git..
git tree:       upstream
console+strace: https://syzkaller.appspot.com/x/log.txt?x=179f4a38680000
kernel config:  https://syzkaller.appspot.com/x/.config?x=df91a3034fe3f122
dashboard link: https://syzkaller.appspot.com/bug?extid=9cf75dc581fb4307d6dd
compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=1374a174680000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=12b12928680000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/14a6a5d23944/disk-e42bebf6.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/98cc4c220388/vmlinux-e42bebf6.xz
kernel image: https://storage.googleapis.com/syzbot-assets/6a1d09cf21bf/bzImage-e42bebf6.xz
mounted in repro #1: https://storage.googleapis.com/syzbot-assets/37e5beb24789/mount_0.gz
mounted in repro #2: https://storage.googleapis.com/syzbot-assets/f219a9e665e9/mount_8.gz

The issue was bisected to:

commit b81427939590450172716093dafdda8ef52e020f
Author: Eric Biggers <ebiggers@google.com>
Date:   Mon Aug 14 18:29:02 2023 +0000

    ext4: remove redundant checks of s_encoding

bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=10852352680000
final oops:     https://syzkaller.appspot.com/x/report.txt?x=12852352680000
console output: https://syzkaller.appspot.com/x/log.txt?x=14852352680000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+9cf75dc581fb4307d6dd@syzkaller.appspotmail.com
Fixes: b81427939590 ("ext4: remove redundant checks of s_encoding")

EXT4-fs error (device loop0): ext4_do_update_inode:5097: inode #2: comm syz-executor379: corrupted inode contents
EXT4-fs error (device loop0): __ext4_ext_dirty:202: inode #2: comm syz-executor379: mark_inode_dirty error
general protection fault, probably for non-canonical address 0xdffffc0000000003: 0000 [#1] PREEMPT SMP KASAN
KASAN: null-ptr-deref in range [0x0000000000000018-0x000000000000001f]
CPU: 1 PID: 5031 Comm: syz-executor379 Not tainted 6.6.0-rc1-syzkaller-00125-ge42bebf6db29 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/04/2023
RIP: 0010:utf8nlookup+0x39/0xaa0 fs/unicode/utf8-norm.c:306
Code: 89 c4 48 89 4c 24 08 48 89 14 24 89 f5 49 89 fd 49 be 00 00 00 00 00 fc ff df e8 22 a5 ea fe 49 8d 5d 18 48 89 d8 48 c1 e8 03 <42> 80 3c 30 00 74 08 48 89 df e8 c8 93 44 ff 48 8b 1b 48 83 c3 30
RSP: 0018:ffffc90003e0f800 EFLAGS: 00010206
RAX: 0000000000000003 RBX: 0000000000000018 RCX: ffff88801be79dc0
RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000000
RBP: 0000000000000001 R08: 0000000000000005 R09: 0000000000000000
R10: ffffc90003e0f998 R11: fffff520007c1f36 R12: 0000000000000005
R13: 0000000000000000 R14: dffffc0000000000 R15: ffff8880792de070
FS:  0000555556220480(0000) GS:ffff8880b9900000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fa9b1ff3870 CR3: 000000002a7f4000 CR4: 00000000003506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 utf8byte+0x334/0x1350
 utf8_casefold+0x125/0x220 fs/unicode/utf8-core.c:109
 ext4_fname_setup_ci_filename+0x1b0/0x430 fs/ext4/namei.c:1458
 ext4_fname_prepare_lookup+0x2f7/0x4e0 fs/ext4/crypto.c:55
 ext4_lookup_entry fs/ext4/namei.c:1760 [inline]
 ext4_lookup+0x121/0x750 fs/ext4/namei.c:1835
 lookup_one_qstr_excl+0x11b/0x250 fs/namei.c:1608
 filename_create+0x297/0x530 fs/namei.c:3890
 do_mkdirat+0xb7/0x520 fs/namei.c:4135
 __do_sys_mkdir fs/namei.c:4163 [inline]
 __se_sys_mkdir fs/namei.c:4161 [inline]
 __x64_sys_mkdir+0x6e/0x80 fs/namei.c:4161
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f4bdc54d557
Code: ff ff 77 07 31 c0 c3 0f 1f 40 00 48 c7 c2 b8 ff ff ff f7 d8 64 89 02 b8 ff ff ff ff c3 66 0f 1f 44 00 00 b8 53 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:00007fffbf49c838 EFLAGS: 00000286 ORIG_RAX: 0000000000000053
RAX: ffffffffffffffda RBX: 00000000ffffffff RCX: 00007f4bdc54d557
RDX: 0000000000000040 RSI: 00000000000001ff RDI: 0000000020000540
RBP: 00007fffbf49c8d0 R08: 00000000000000fd R09: 0000000000000000
R10: 0000000000000249 R11: 0000000000000286 R12: 0000000020000540
R13: 00000000200000c0 R14: 0000000000000000 R15: 0000000000000000
 </TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:utf8nlookup+0x39/0xaa0 fs/unicode/utf8-norm.c:306
Code: 89 c4 48 89 4c 24 08 48 89 14 24 89 f5 49 89 fd 49 be 00 00 00 00 00 fc ff df e8 22 a5 ea fe 49 8d 5d 18 48 89 d8 48 c1 e8 03 <42> 80 3c 30 00 74 08 48 89 df e8 c8 93 44 ff 48 8b 1b 48 83 c3 30
RSP: 0018:ffffc90003e0f800 EFLAGS: 00010206
RAX: 0000000000000003 RBX: 0000000000000018 RCX: ffff88801be79dc0
RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000000
RBP: 0000000000000001 R08: 0000000000000005 R09: 0000000000000000
R10: ffffc90003e0f998 R11: fffff520007c1f36 R12: 0000000000000005
R13: 0000000000000000 R14: dffffc0000000000 R15: ffff8880792de070
FS:  0000555556220480(0000) GS:ffff8880b9800000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00005650cf4460b8 CR3: 000000002a7f4000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess):
   0:	89 c4                	mov    %eax,%esp
   2:	48 89 4c 24 08       	mov    %rcx,0x8(%rsp)
   7:	48 89 14 24          	mov    %rdx,(%rsp)
   b:	89 f5                	mov    %esi,%ebp
   d:	49 89 fd             	mov    %rdi,%r13
  10:	49 be 00 00 00 00 00 	movabs $0xdffffc0000000000,%r14
  17:	fc ff df
  1a:	e8 22 a5 ea fe       	call   0xfeeaa541
  1f:	49 8d 5d 18          	lea    0x18(%r13),%rbx
  23:	48 89 d8             	mov    %rbx,%rax
  26:	48 c1 e8 03          	shr    $0x3,%rax
* 2a:	42 80 3c 30 00       	cmpb   $0x0,(%rax,%r14,1) <-- trapping instruction
  2f:	74 08                	je     0x39
  31:	48 89 df             	mov    %rbx,%rdi
  34:	e8 c8 93 44 ff       	call   0xff449401
  39:	48 8b 1b             	mov    (%rbx),%rbx
  3c:	48 83 c3 30          	add    $0x30,%rbx


---
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

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

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.

If you want to overwrite 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

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

* Re: [syzbot] [ext4?] general protection fault in utf8nlookup
  2023-09-20  5:25 [syzbot] [ext4?] general protection fault in utf8nlookup syzbot
@ 2023-09-20  7:36 ` Eric Biggers
  2023-09-20 11:20 ` [PATCH] unicode: add s_encoding null ptr check in utf8ncursor Edward AD
  2024-02-13  0:24 ` [syzbot] [ext4?] general protection fault in utf8nlookup syzbot
  2 siblings, 0 replies; 6+ messages in thread
From: Eric Biggers @ 2023-09-20  7:36 UTC (permalink / raw)
  To: syzbot
  Cc: adilger.kernel, krisman, linux-ext4, linux-fsdevel, linux-kernel,
	syzkaller-bugs, tytso

On Tue, Sep 19, 2023 at 10:25:22PM -0700, syzbot wrote:
> Hello,
> 
> syzbot found the following issue on:
> 
> HEAD commit:    e42bebf6db29 Merge tag 'efi-fixes-for-v6.6-1' of git://git..
> git tree:       upstream
> console+strace: https://syzkaller.appspot.com/x/log.txt?x=179f4a38680000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=df91a3034fe3f122
> dashboard link: https://syzkaller.appspot.com/bug?extid=9cf75dc581fb4307d6dd
> compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=1374a174680000
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=12b12928680000
> 
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/14a6a5d23944/disk-e42bebf6.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/98cc4c220388/vmlinux-e42bebf6.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/6a1d09cf21bf/bzImage-e42bebf6.xz
> mounted in repro #1: https://storage.googleapis.com/syzbot-assets/37e5beb24789/mount_0.gz
> mounted in repro #2: https://storage.googleapis.com/syzbot-assets/f219a9e665e9/mount_8.gz
> 
> The issue was bisected to:
> 
> commit b81427939590450172716093dafdda8ef52e020f
> Author: Eric Biggers <ebiggers@google.com>
> Date:   Mon Aug 14 18:29:02 2023 +0000
> 
>     ext4: remove redundant checks of s_encoding
> 
> bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=10852352680000
> final oops:     https://syzkaller.appspot.com/x/report.txt?x=12852352680000
> console output: https://syzkaller.appspot.com/x/log.txt?x=14852352680000

This report is expected for now, since the repro involves writing to the page
cache of a mounted block device.  For more information see
https://lore.kernel.org/linux-fsdevel/20230813001202.GE41642@sol.localdomain and
https://lore.kernel.org/linux-fsdevel/20230814182903.37267-2-ebiggers@kernel.org.
Also https://lore.kernel.org/linux-fsdevel/20230704122727.17096-1-jack@suse.cz
which will ultimately be the fix for this class of issue.

Note: the repro that syzkaller generated for this is very strange (even moreso
than usual for syzkaller repros...) because it replaces its "scratch space" at
address 0x20000000 with a different mapping, specifically a mapping for a file
that is mounted as a filesystem via loopback.  That makes "syscalls" have weird
side effects as a result of the repro writing parameters to the address that is
supposed to contain its scratch space.  I don't think this should be happening,
so I've opened https://github.com/google/syzkaller/issues/4216 for it.

- Eric

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

* [PATCH] unicode: add s_encoding null ptr check in utf8ncursor
  2023-09-20  5:25 [syzbot] [ext4?] general protection fault in utf8nlookup syzbot
  2023-09-20  7:36 ` Eric Biggers
@ 2023-09-20 11:20 ` Edward AD
  2023-09-20 19:37   ` Eric Biggers
  2024-02-13  0:24 ` [syzbot] [ext4?] general protection fault in utf8nlookup syzbot
  2 siblings, 1 reply; 6+ messages in thread
From: Edward AD @ 2023-09-20 11:20 UTC (permalink / raw)
  To: syzbot+9cf75dc581fb4307d6dd
  Cc: adilger.kernel, ebiggers, krisman, linux-ext4, linux-fsdevel,
	linux-kernel, syzkaller-bugs, tytso

When init struct utf8cursor *u8c in utf8ncursor(), we need check um is
valid.

Reported-and-tested-by: syzbot+9cf75dc581fb4307d6dd@syzkaller.appspotmail.com
Fixes: b81427939590 ("ext4: remove redundant checks of s_encoding")
Signed-off-by: Edward AD <twuufnxlz@gmail.com>
---
 fs/unicode/utf8-norm.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/unicode/utf8-norm.c b/fs/unicode/utf8-norm.c
index 768f8ab448b8..906b639b2f38 100644
--- a/fs/unicode/utf8-norm.c
+++ b/fs/unicode/utf8-norm.c
@@ -422,6 +422,10 @@ int utf8ncursor(struct utf8cursor *u8c, const struct unicode_map *um,
 {
 	if (!s)
 		return -1;
+
+	if (IS_ERR_OR_NULL(um))
+		return -1;
+
 	u8c->um = um;
 	u8c->n = n;
 	u8c->s = s;
-- 
2.25.1


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

* Re: [PATCH] unicode: add s_encoding null ptr check in utf8ncursor
  2023-09-20 11:20 ` [PATCH] unicode: add s_encoding null ptr check in utf8ncursor Edward AD
@ 2023-09-20 19:37   ` Eric Biggers
  0 siblings, 0 replies; 6+ messages in thread
From: Eric Biggers @ 2023-09-20 19:37 UTC (permalink / raw)
  To: Edward AD
  Cc: syzbot+9cf75dc581fb4307d6dd, adilger.kernel, krisman, linux-ext4,
	linux-fsdevel, linux-kernel, syzkaller-bugs, tytso

On Wed, Sep 20, 2023 at 07:20:16PM +0800, Edward AD wrote:
> When init struct utf8cursor *u8c in utf8ncursor(), we need check um is
> valid.
> 
> Reported-and-tested-by: syzbot+9cf75dc581fb4307d6dd@syzkaller.appspotmail.com
> Fixes: b81427939590 ("ext4: remove redundant checks of s_encoding")
> Signed-off-by: Edward AD <twuufnxlz@gmail.com>
> ---
>  fs/unicode/utf8-norm.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/fs/unicode/utf8-norm.c b/fs/unicode/utf8-norm.c
> index 768f8ab448b8..906b639b2f38 100644
> --- a/fs/unicode/utf8-norm.c
> +++ b/fs/unicode/utf8-norm.c
> @@ -422,6 +422,10 @@ int utf8ncursor(struct utf8cursor *u8c, const struct unicode_map *um,
>  {
>  	if (!s)
>  		return -1;
> +
> +	if (IS_ERR_OR_NULL(um))
> +		return -1;
> +
>  	u8c->um = um;
>  	u8c->n = n;
>  	u8c->s = s;
> -- 

See https://lore.kernel.org/linux-fsdevel/20230920073659.GC2739@sol.localdomain/

- Eric

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

* Re: [syzbot] [ext4?] general protection fault in utf8nlookup
  2023-09-20  5:25 [syzbot] [ext4?] general protection fault in utf8nlookup syzbot
  2023-09-20  7:36 ` Eric Biggers
  2023-09-20 11:20 ` [PATCH] unicode: add s_encoding null ptr check in utf8ncursor Edward AD
@ 2024-02-13  0:24 ` syzbot
  2024-02-13 10:42   ` Jan Kara
  2 siblings, 1 reply; 6+ messages in thread
From: syzbot @ 2024-02-13  0:24 UTC (permalink / raw)
  To: adilger.kernel, axboe, brauner, ebiggers, ebiggers, jack, krisman,
	linux-ext4, linux-fsdevel, linux-kernel, syzkaller-bugs,
	twuufnxlz, tytso

syzbot suspects this issue was fixed by commit:

commit 6f861765464f43a71462d52026fbddfc858239a5
Author: Jan Kara <jack@suse.cz>
Date:   Wed Nov 1 17:43:10 2023 +0000

    fs: Block writes to mounted block devices

bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=17547fd4180000
start commit:   e42bebf6db29 Merge tag 'efi-fixes-for-v6.6-1' of git://git..
git tree:       upstream
kernel config:  https://syzkaller.appspot.com/x/.config?x=df91a3034fe3f122
dashboard link: https://syzkaller.appspot.com/bug?extid=9cf75dc581fb4307d6dd
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=1374a174680000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=12b12928680000

If the result looks correct, please mark the issue as fixed by replying with:

#syz fix: fs: Block writes to mounted block devices

For information about bisection process see: https://goo.gl/tpsmEJ#bisection

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

* Re: [syzbot] [ext4?] general protection fault in utf8nlookup
  2024-02-13  0:24 ` [syzbot] [ext4?] general protection fault in utf8nlookup syzbot
@ 2024-02-13 10:42   ` Jan Kara
  0 siblings, 0 replies; 6+ messages in thread
From: Jan Kara @ 2024-02-13 10:42 UTC (permalink / raw)
  To: syzbot
  Cc: adilger.kernel, axboe, brauner, ebiggers, ebiggers, jack, krisman,
	linux-ext4, linux-fsdevel, linux-kernel, syzkaller-bugs,
	twuufnxlz, tytso

On Mon 12-02-24 16:24:03, syzbot wrote:
> syzbot suspects this issue was fixed by commit:
> 
> commit 6f861765464f43a71462d52026fbddfc858239a5
> Author: Jan Kara <jack@suse.cz>
> Date:   Wed Nov 1 17:43:10 2023 +0000
> 
>     fs: Block writes to mounted block devices
> 
> bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=17547fd4180000
> start commit:   e42bebf6db29 Merge tag 'efi-fixes-for-v6.6-1' of git://git..
> git tree:       upstream
> kernel config:  https://syzkaller.appspot.com/x/.config?x=df91a3034fe3f122
> dashboard link: https://syzkaller.appspot.com/bug?extid=9cf75dc581fb4307d6dd
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=1374a174680000
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=12b12928680000
> 
> If the result looks correct, please mark the issue as fixed by replying with:

The reproducer definitely does weird stuff like mmapping the loop device.
So makes sense:

#syz fix: fs: Block writes to mounted block devices

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

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

end of thread, other threads:[~2024-02-13 10:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-20  5:25 [syzbot] [ext4?] general protection fault in utf8nlookup syzbot
2023-09-20  7:36 ` Eric Biggers
2023-09-20 11:20 ` [PATCH] unicode: add s_encoding null ptr check in utf8ncursor Edward AD
2023-09-20 19:37   ` Eric Biggers
2024-02-13  0:24 ` [syzbot] [ext4?] general protection fault in utf8nlookup syzbot
2024-02-13 10:42   ` Jan Kara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).