2024-04-16 13:25:34

by Sam Sun

[permalink] [raw]
Subject: [Linux kernel bug] WARNING in ext4_iomap_begin

Dear developers and maintainers,

We encountered a kernel warning in function ext4_iomap_begin() using
our modified syzkaller. It was tested against the latest upstream
linux (6.9-rc4). C repro and kernel config are attached to this email.
Kernel dump log is listed below.
```
WARNING: CPU: 0 PID: 8274 at fs/ext4/inode.c:3348
ext4_iomap_begin+0x1ad/0x7a0 fs/ext4/inode.c:3348
Modules linked in:
CPU: 0 PID: 8274 Comm: syz-executor123 Not tainted 6.7.0-rc7 #2
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
RIP: 0010:ext4_iomap_begin+0x1ad/0x7a0 fs/ext4/inode.c:3348
Code: c0 01 38 d0 7c 08 84 d2 0f 85 f2 05 00 00 41 0f b7 9f ba 05 00
00 31 ff 89 de e8 de 45 54 ff 66 85 db 74 5e e8 d4 49 54 ff 90 <0f> 0b
90 41 bd de ff ff ff e8 c5 49 54 ff 48 b8 00 00 00 00 00 fc
RSP: 0018:ffffc90002d8f7d0 EFLAGS: 00010293
RAX: 0000000000000000 RBX: 00000000000000d4 RCX: ffffffff8230cb32
RDX: ffff888017c7a4c0 RSI: ffffffff8230cb3c RDI: 0000000000000003
RBP: 0000000000000000 R08: 0000000000000003 R09: 0000000000000000
R10: 00000000000000d4 R11: 0000000000000000 R12: 000000000000000b
R13: ffff8881149d717a R14: ffffc90002d8fab8 R15: ffff8881149d70b0
FS: 00007f6f999e6640(0000) GS:ffff888063a00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f6f999e5ff8 CR3: 00000001079d3000 CR4: 0000000000750ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
PKRU: 55555554
Call Trace:
<TASK>
iomap_iter+0x482/0x1120 fs/iomap/iter.c:91
__iomap_dio_rw+0x6b8/0x1c00 fs/iomap/direct-io.c:658
iomap_dio_rw+0x40/0xa0 fs/iomap/direct-io.c:748
ext4_dio_write_iter fs/ext4/file.c:577 [inline]
ext4_file_write_iter+0x140a/0x18a0 fs/ext4/file.c:696
call_write_iter include/linux/fs.h:2020 [inline]
new_sync_write fs/read_write.c:491 [inline]
vfs_write+0x96a/0xd80 fs/read_write.c:584
ksys_write+0x122/0x250 fs/read_write.c:637
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0x40/0x110 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x63/0x6b
RIP: 0033:0x7f6f99bf622d
Code: c3 e8 27 23 00 00 0f 1f 80 00 00 00 00 f3 0f 1e fa 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 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f6f999e60d8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007f6f99c8d618 RCX: 00007f6f99bf622d
RDX: 000000000000fdef RSI: 0000000020000980 RDI: 0000000000000006
RBP: 00007f6f99c8d610 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000013 R11: 0000000000000246 R12: 00007f6f99c8d61c
R13: 000000000000006e R14: 00007f6f99bb8790 R15: 00007f6f999c6000
</TASK>
```
We found that syzbot also reported a bug with the same title last year
(https://syzkaller.appspot.com/bug?extid=307da6ca5cb0d01d581a), but it
was fixed by commit ce56d21355cd ("ext4: fix racy may inline data
check in dio write"). So this should be a different bug.

If you have any questions, please contact us.
Reported by: Yue Sun <[email protected]>
Reported by: xingwei lee <[email protected]>

Best Regards,
Yue


Attachments:
config (242.08 kB)
ext4_iomap_begin.c (39.36 kB)
Download all attachments