* [syzbot] [iomap?] [erofs?] WARNING in iomap_iter (5)
@ 2025-06-13 23:30 syzbot
2025-06-14 3:06 ` Edward Adam Davis
` (4 more replies)
0 siblings, 5 replies; 13+ messages in thread
From: syzbot @ 2025-06-13 23:30 UTC (permalink / raw)
To: brauner, chao, djwong, linux-erofs, linux-fsdevel, linux-kernel,
linux-xfs, syzkaller-bugs, xiang
Hello,
syzbot found the following issue on:
HEAD commit: 27605c8c0f69 Merge tag 'net-6.16-rc2' of git://git.kernel...
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=171079d4580000
kernel config: https://syzkaller.appspot.com/x/.config?x=3a936e3316f9e2dc
dashboard link: https://syzkaller.appspot.com/bug?extid=d8f000c609f05f52d9b5
compiler: Debian clang version 20.1.6 (++20250514063057+1e4d39e07757-1~exp1~20250514183223.118), Debian LLD 20.1.6
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1725310c580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=115e0e82580000
Downloadable assets:
disk image (non-bootable): https://storage.googleapis.com/syzbot-assets/d900f083ada3/non_bootable_disk-27605c8c.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/c55edb669703/vmlinux-27605c8c.xz
kernel image: https://storage.googleapis.com/syzbot-assets/e12830584492/bzImage-27605c8c.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/36391cabb242/mount_2.gz
fsck result: failed (log: https://syzkaller.appspot.com/x/fsck.log?x=165e0e82580000)
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+d8f000c609f05f52d9b5@syzkaller.appspotmail.com
erofs (device loop0): EXPERIMENTAL EROFS subpage compressed block support in use. Use at your own risk!
erofs (device loop0): mounted with root inode @ nid 36.
------------[ cut here ]------------
WARNING: CPU: 0 PID: 5317 at fs/iomap/iter.c:33 iomap_iter_done fs/iomap/iter.c:33 [inline]
WARNING: CPU: 0 PID: 5317 at fs/iomap/iter.c:33 iomap_iter+0x87c/0xdf0 fs/iomap/iter.c:113
Modules linked in:
CPU: 0 UID: 0 PID: 5317 Comm: syz-executor245 Not tainted 6.16.0-rc1-syzkaller-00101-g27605c8c0f69 #0 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
RIP: 0010:iomap_iter_done fs/iomap/iter.c:33 [inline]
RIP: 0010:iomap_iter+0x87c/0xdf0 fs/iomap/iter.c:113
Code: cc cc cc e8 a6 eb 6b ff 90 0f 0b 90 e9 31 f8 ff ff e8 98 eb 6b ff 90 0f 0b 90 bd fb ff ff ff e9 ad fb ff ff e8 85 eb 6b ff 90 <0f> 0b 90 e9 22 fd ff ff e8 77 eb 6b ff 90 0f 0b 90 e9 53 fd ff ff
RSP: 0018:ffffc9000d08f808 EFLAGS: 00010293
RAX: ffffffff8254736b RBX: ffffc9000d08f920 RCX: ffff88803a692440
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000074
RBP: 1ffff92001a11f2a R08: ffffea00010c5277 R09: 1ffffd4000218a4e
R10: dffffc0000000000 R11: fffff94000218a4f R12: 0000000000000074
R13: 0000000000000000 R14: ffffc9000d08f950 R15: 1ffff92001a11f25
FS: 0000555562dab380(0000) GS:ffff88808d252000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007ffeb97cc968 CR3: 0000000043323000 CR4: 0000000000352ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
iomap_fiemap+0x117/0x530 fs/iomap/fiemap.c:79
ioctl_fiemap fs/ioctl.c:220 [inline]
do_vfs_ioctl+0x16d3/0x1990 fs/ioctl.c:841
__do_sys_ioctl fs/ioctl.c:905 [inline]
__se_sys_ioctl+0x82/0x170 fs/ioctl.c:893
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fbc6028fe59
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 17 00 00 90 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffccc462b68 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fbc6028fe59
RDX: 0000200000000580 RSI: 00000000c020660b RDI: 0000000000000005
RBP: 00007fbc603045f0 R08: 0000555562dac4c0 R09: 0000555562dac4c0
R10: 00000000000001ca R11: 0000000000000246 R12: 00007ffccc462b90
R13: 00007ffccc462db8 R14: 431bde82d7b634db R15: 00007fbc602d903b
</TASK>
---
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.
If the report is already addressed, 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 report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)
If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report
If you want to undo deduplication, reply with:
#syz undup
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [syzbot] [iomap?] [erofs?] WARNING in iomap_iter (5)
2025-06-13 23:30 [syzbot] [iomap?] [erofs?] WARNING in iomap_iter (5) syzbot
@ 2025-06-14 3:06 ` Edward Adam Davis
2025-06-14 3:54 ` syzbot
2025-06-14 9:46 ` syzbot
` (3 subsequent siblings)
4 siblings, 1 reply; 13+ messages in thread
From: Edward Adam Davis @ 2025-06-14 3:06 UTC (permalink / raw)
To: syzbot+d8f000c609f05f52d9b5; +Cc: linux-kernel, syzkaller-bugs
#syz test
diff --git a/fs/iomap/iter.c b/fs/iomap/iter.c
index 6ffc6a7b9ba5..e53591538643 100644
--- a/fs/iomap/iter.c
+++ b/fs/iomap/iter.c
@@ -30,7 +30,8 @@ int iomap_iter_advance(struct iomap_iter *iter, u64 *count)
static inline void iomap_iter_done(struct iomap_iter *iter)
{
- WARN_ON_ONCE(iter->iomap.offset > iter->pos);
+ WARN_ON_ONCE(iter->iomap.type != IOMAP_HOLE &&
+ iter->iomap.offset > iter->pos);
WARN_ON_ONCE(iter->iomap.length == 0);
WARN_ON_ONCE(iter->iomap.offset + iter->iomap.length <= iter->pos);
WARN_ON_ONCE(iter->iomap.flags & IOMAP_F_STALE);
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [syzbot] [iomap?] [erofs?] WARNING in iomap_iter (5)
2025-06-14 3:06 ` Edward Adam Davis
@ 2025-06-14 3:54 ` syzbot
0 siblings, 0 replies; 13+ messages in thread
From: syzbot @ 2025-06-14 3:54 UTC (permalink / raw)
To: eadavis, linux-kernel, syzkaller-bugs
Hello,
syzbot has tested the proposed patch and the reproducer did not trigger any issue:
Reported-by: syzbot+d8f000c609f05f52d9b5@syzkaller.appspotmail.com
Tested-by: syzbot+d8f000c609f05f52d9b5@syzkaller.appspotmail.com
Tested on:
commit: 4774cfe3 Merge tag 'scsi-fixes' of git://git.kernel.or..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=10a48e82580000
kernel config: https://syzkaller.appspot.com/x/.config?x=162faeb2d1eaefb4
dashboard link: https://syzkaller.appspot.com/bug?extid=d8f000c609f05f52d9b5
compiler: Debian clang version 20.1.6 (++20250514063057+1e4d39e07757-1~exp1~20250514183223.118), Debian LLD 20.1.6
patch: https://syzkaller.appspot.com/x/patch.diff?x=13c88e82580000
Note: testing is done by a robot and is best-effort only.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [syzbot] [iomap?] [erofs?] WARNING in iomap_iter (5)
2025-06-13 23:30 [syzbot] [iomap?] [erofs?] WARNING in iomap_iter (5) syzbot
2025-06-14 3:06 ` Edward Adam Davis
@ 2025-06-14 9:46 ` syzbot
2025-06-15 5:05 ` [PATCH] erofs: confirm big pcluster before setting extents Edward Adam Davis
2025-06-19 3:53 ` [syzbot] [iomap?] [erofs?] WARNING in iomap_iter (5) Gao Xiang
2025-06-15 3:26 ` Edward Adam Davis
` (2 subsequent siblings)
4 siblings, 2 replies; 13+ messages in thread
From: syzbot @ 2025-06-14 9:46 UTC (permalink / raw)
To: brauner, chao, djwong, eadavis, hsiangkao, linux-erofs,
linux-fsdevel, linux-kernel, linux-xfs, syzkaller-bugs, xiang
syzbot has bisected this issue to:
commit 1d191b4ca51d73699cb127386b95ac152af2b930
Author: Gao Xiang <hsiangkao@linux.alibaba.com>
Date: Mon Mar 10 09:54:58 2025 +0000
erofs: implement encoded extent metadata
bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=1352dd70580000
start commit: 02adc1490e6d Merge tag 'spi-fix-v6.16-rc1' of git://git.ke..
git tree: upstream
final oops: https://syzkaller.appspot.com/x/report.txt?x=10d2dd70580000
console output: https://syzkaller.appspot.com/x/log.txt?x=1752dd70580000
kernel config: https://syzkaller.appspot.com/x/.config?x=162faeb2d1eaefb4
dashboard link: https://syzkaller.appspot.com/bug?extid=d8f000c609f05f52d9b5
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=115f9e0c580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1688b10c580000
Reported-by: syzbot+d8f000c609f05f52d9b5@syzkaller.appspotmail.com
Fixes: 1d191b4ca51d ("erofs: implement encoded extent metadata")
For information about bisection process see: https://goo.gl/tpsmEJ#bisection
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [syzbot] [iomap?] [erofs?] WARNING in iomap_iter (5)
2025-06-13 23:30 [syzbot] [iomap?] [erofs?] WARNING in iomap_iter (5) syzbot
2025-06-14 3:06 ` Edward Adam Davis
2025-06-14 9:46 ` syzbot
@ 2025-06-15 3:26 ` Edward Adam Davis
2025-06-15 4:02 ` syzbot
2025-06-15 3:56 ` Edward Adam Davis
2025-06-19 3:28 ` [PATCH] erofs: refuse crafted out-of-file-range encoded extents Gao Xiang
4 siblings, 1 reply; 13+ messages in thread
From: Edward Adam Davis @ 2025-06-15 3:26 UTC (permalink / raw)
To: syzbot+d8f000c609f05f52d9b5; +Cc: linux-kernel, syzkaller-bugs
#syz test
diff --git a/fs/erofs/zmap.c b/fs/erofs/zmap.c
index 14ea47f954f5..c96907850c56 100644
--- a/fs/erofs/zmap.c
+++ b/fs/erofs/zmap.c
@@ -686,6 +686,16 @@ static int z_erofs_fill_inode_lazy(struct inode *inode)
vi->z_tailextent_headlcn = 0;
goto done;
}
+
+ if (!erofs_sb_has_big_pcluster(EROFS_SB(sb)) &&
+ vi->z_advise & (Z_EROFS_ADVISE_BIG_PCLUSTER_1 |
+ Z_EROFS_ADVISE_BIG_PCLUSTER_2)) {
+ erofs_err(sb, "per-inode big pcluster without sb feature for nid %llu",
+ vi->nid);
+ err = -EFSCORRUPTED;
+ goto out_put_metabuf;
+ }
+
vi->z_advise = le16_to_cpu(h->h_advise);
vi->z_lclusterbits = sb->s_blocksize_bits + (h->h_clusterbits & 15);
if (vi->datalayout == EROFS_INODE_COMPRESSED_FULL &&
@@ -711,14 +721,6 @@ static int z_erofs_fill_inode_lazy(struct inode *inode)
goto out_put_metabuf;
}
- if (!erofs_sb_has_big_pcluster(EROFS_SB(sb)) &&
- vi->z_advise & (Z_EROFS_ADVISE_BIG_PCLUSTER_1 |
- Z_EROFS_ADVISE_BIG_PCLUSTER_2)) {
- erofs_err(sb, "per-inode big pcluster without sb feature for nid %llu",
- vi->nid);
- err = -EFSCORRUPTED;
- goto out_put_metabuf;
- }
if (vi->datalayout == EROFS_INODE_COMPRESSED_COMPACT &&
!(vi->z_advise & Z_EROFS_ADVISE_BIG_PCLUSTER_1) ^
!(vi->z_advise & Z_EROFS_ADVISE_BIG_PCLUSTER_2)) {
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [syzbot] [iomap?] [erofs?] WARNING in iomap_iter (5)
2025-06-13 23:30 [syzbot] [iomap?] [erofs?] WARNING in iomap_iter (5) syzbot
` (2 preceding siblings ...)
2025-06-15 3:26 ` Edward Adam Davis
@ 2025-06-15 3:56 ` Edward Adam Davis
2025-06-15 4:24 ` syzbot
2025-06-19 3:28 ` [PATCH] erofs: refuse crafted out-of-file-range encoded extents Gao Xiang
4 siblings, 1 reply; 13+ messages in thread
From: Edward Adam Davis @ 2025-06-15 3:56 UTC (permalink / raw)
To: syzbot+d8f000c609f05f52d9b5; +Cc: linux-kernel, syzkaller-bugs
#syz test
diff --git a/fs/erofs/zmap.c b/fs/erofs/zmap.c
index 14ea47f954f5..664611cca689 100644
--- a/fs/erofs/zmap.c
+++ b/fs/erofs/zmap.c
@@ -686,7 +686,17 @@ static int z_erofs_fill_inode_lazy(struct inode *inode)
vi->z_tailextent_headlcn = 0;
goto done;
}
+
vi->z_advise = le16_to_cpu(h->h_advise);
+ if (!erofs_sb_has_big_pcluster(EROFS_SB(sb)) &&
+ vi->z_advise & (Z_EROFS_ADVISE_BIG_PCLUSTER_1 |
+ Z_EROFS_ADVISE_BIG_PCLUSTER_2)) {
+ erofs_err(sb, "per-inode big pcluster without sb feature for nid %llu",
+ vi->nid);
+ err = -EFSCORRUPTED;
+ goto out_put_metabuf;
+ }
+
vi->z_lclusterbits = sb->s_blocksize_bits + (h->h_clusterbits & 15);
if (vi->datalayout == EROFS_INODE_COMPRESSED_FULL &&
(vi->z_advise & Z_EROFS_ADVISE_EXTENTS)) {
@@ -711,14 +721,6 @@ static int z_erofs_fill_inode_lazy(struct inode *inode)
goto out_put_metabuf;
}
- if (!erofs_sb_has_big_pcluster(EROFS_SB(sb)) &&
- vi->z_advise & (Z_EROFS_ADVISE_BIG_PCLUSTER_1 |
- Z_EROFS_ADVISE_BIG_PCLUSTER_2)) {
- erofs_err(sb, "per-inode big pcluster without sb feature for nid %llu",
- vi->nid);
- err = -EFSCORRUPTED;
- goto out_put_metabuf;
- }
if (vi->datalayout == EROFS_INODE_COMPRESSED_COMPACT &&
!(vi->z_advise & Z_EROFS_ADVISE_BIG_PCLUSTER_1) ^
!(vi->z_advise & Z_EROFS_ADVISE_BIG_PCLUSTER_2)) {
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [syzbot] [iomap?] [erofs?] WARNING in iomap_iter (5)
2025-06-15 3:26 ` Edward Adam Davis
@ 2025-06-15 4:02 ` syzbot
0 siblings, 0 replies; 13+ messages in thread
From: syzbot @ 2025-06-15 4:02 UTC (permalink / raw)
To: eadavis, linux-kernel, syzkaller-bugs
Hello,
syzbot has tested the proposed patch and the reproducer did not trigger any issue:
Reported-by: syzbot+d8f000c609f05f52d9b5@syzkaller.appspotmail.com
Tested-by: syzbot+d8f000c609f05f52d9b5@syzkaller.appspotmail.com
Tested on:
commit: 8c6bc74c Merge tag 'v6.16-rc1-smb3-client-fixes' of gi..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=169cbd70580000
kernel config: https://syzkaller.appspot.com/x/.config?x=162faeb2d1eaefb4
dashboard link: https://syzkaller.appspot.com/bug?extid=d8f000c609f05f52d9b5
compiler: Debian clang version 20.1.6 (++20250514063057+1e4d39e07757-1~exp1~20250514183223.118), Debian LLD 20.1.6
patch: https://syzkaller.appspot.com/x/patch.diff?x=16b5f10c580000
Note: testing is done by a robot and is best-effort only.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [syzbot] [iomap?] [erofs?] WARNING in iomap_iter (5)
2025-06-15 3:56 ` Edward Adam Davis
@ 2025-06-15 4:24 ` syzbot
0 siblings, 0 replies; 13+ messages in thread
From: syzbot @ 2025-06-15 4:24 UTC (permalink / raw)
To: eadavis, linux-kernel, syzkaller-bugs
Hello,
syzbot has tested the proposed patch and the reproducer did not trigger any issue:
Reported-by: syzbot+d8f000c609f05f52d9b5@syzkaller.appspotmail.com
Tested-by: syzbot+d8f000c609f05f52d9b5@syzkaller.appspotmail.com
Tested on:
commit: 8c6bc74c Merge tag 'v6.16-rc1-smb3-client-fixes' of gi..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=10c2bd70580000
kernel config: https://syzkaller.appspot.com/x/.config?x=162faeb2d1eaefb4
dashboard link: https://syzkaller.appspot.com/bug?extid=d8f000c609f05f52d9b5
compiler: Debian clang version 20.1.6 (++20250514063057+1e4d39e07757-1~exp1~20250514183223.118), Debian LLD 20.1.6
patch: https://syzkaller.appspot.com/x/patch.diff?x=1282290c580000
Note: testing is done by a robot and is best-effort only.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH] erofs: confirm big pcluster before setting extents
2025-06-14 9:46 ` syzbot
@ 2025-06-15 5:05 ` Edward Adam Davis
2025-06-15 5:49 ` Gao Xiang
2025-06-19 3:53 ` [syzbot] [iomap?] [erofs?] WARNING in iomap_iter (5) Gao Xiang
1 sibling, 1 reply; 13+ messages in thread
From: Edward Adam Davis @ 2025-06-15 5:05 UTC (permalink / raw)
To: syzbot+d8f000c609f05f52d9b5
Cc: brauner, chao, djwong, eadavis, hsiangkao, linux-erofs,
linux-fsdevel, linux-kernel, linux-xfs, syzkaller-bugs, xiang
In this case, advise contains Z_EROFS_ADVISE_EXTENTS,
Z_EROFS_ADVISE_BIG_PCLUSTER_1, Z_EROFS_ADVISE_BIG_PCLUSTER_2 at the same
time, and following 1 and 2 are met, WARN_ON_ONCE(iter->iomap.offset >
iter->pos) in iomap_iter_done() is triggered.
1. When Z_EROFS_ADVISE_EXTENTS exists, z_erofs_fill_inode_lazy() is exited
after z_extents is set, which skips the check of big pcluster;
2. When the condition "lstart < lend" is met in z_erofs_map_blocks_ext(),
m_la is updated, and m_la is used to update iomap->offset in
z_erofs_iomap_begin_report();
Fixes: 1d191b4ca51d ("erofs: implement encoded extent metadata")
Reported-by: syzbot+d8f000c609f05f52d9b5@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=d8f000c609f05f52d9b5
Tested-by: syzbot+d8f000c609f05f52d9b5@syzkaller.appspotmail.com
Signed-off-by: Edward Adam Davis <eadavis@qq.com>
---
fs/erofs/zmap.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/fs/erofs/zmap.c b/fs/erofs/zmap.c
index 14ea47f954f5..664611cca689 100644
--- a/fs/erofs/zmap.c
+++ b/fs/erofs/zmap.c
@@ -686,7 +686,17 @@ static int z_erofs_fill_inode_lazy(struct inode *inode)
vi->z_tailextent_headlcn = 0;
goto done;
}
+
vi->z_advise = le16_to_cpu(h->h_advise);
+ if (!erofs_sb_has_big_pcluster(EROFS_SB(sb)) &&
+ vi->z_advise & (Z_EROFS_ADVISE_BIG_PCLUSTER_1 |
+ Z_EROFS_ADVISE_BIG_PCLUSTER_2)) {
+ erofs_err(sb, "per-inode big pcluster without sb feature for nid %llu",
+ vi->nid);
+ err = -EFSCORRUPTED;
+ goto out_put_metabuf;
+ }
+
vi->z_lclusterbits = sb->s_blocksize_bits + (h->h_clusterbits & 15);
if (vi->datalayout == EROFS_INODE_COMPRESSED_FULL &&
(vi->z_advise & Z_EROFS_ADVISE_EXTENTS)) {
@@ -711,14 +721,6 @@ static int z_erofs_fill_inode_lazy(struct inode *inode)
goto out_put_metabuf;
}
- if (!erofs_sb_has_big_pcluster(EROFS_SB(sb)) &&
- vi->z_advise & (Z_EROFS_ADVISE_BIG_PCLUSTER_1 |
- Z_EROFS_ADVISE_BIG_PCLUSTER_2)) {
- erofs_err(sb, "per-inode big pcluster without sb feature for nid %llu",
- vi->nid);
- err = -EFSCORRUPTED;
- goto out_put_metabuf;
- }
if (vi->datalayout == EROFS_INODE_COMPRESSED_COMPACT &&
!(vi->z_advise & Z_EROFS_ADVISE_BIG_PCLUSTER_1) ^
!(vi->z_advise & Z_EROFS_ADVISE_BIG_PCLUSTER_2)) {
--
2.43.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH] erofs: confirm big pcluster before setting extents
2025-06-15 5:05 ` [PATCH] erofs: confirm big pcluster before setting extents Edward Adam Davis
@ 2025-06-15 5:49 ` Gao Xiang
0 siblings, 0 replies; 13+ messages in thread
From: Gao Xiang @ 2025-06-15 5:49 UTC (permalink / raw)
To: Edward Adam Davis, syzbot+d8f000c609f05f52d9b5
Cc: brauner, chao, djwong, linux-erofs, linux-fsdevel, linux-kernel,
linux-xfs, syzkaller-bugs, xiang
Hi Edward,
On 2025/6/15 13:05, Edward Adam Davis wrote:
> In this case, advise contains Z_EROFS_ADVISE_EXTENTS,
> Z_EROFS_ADVISE_BIG_PCLUSTER_1, Z_EROFS_ADVISE_BIG_PCLUSTER_2 at the same
> time, and following 1 and 2 are met, WARN_ON_ONCE(iter->iomap.offset >
> iter->pos) in iomap_iter_done() is triggered.
>
> 1. When Z_EROFS_ADVISE_EXTENTS exists, z_erofs_fill_inode_lazy() is exited
> after z_extents is set, which skips the check of big pcluster;
> 2. When the condition "lstart < lend" is met in z_erofs_map_blocks_ext(),
> m_la is updated, and m_la is used to update iomap->offset in
> z_erofs_iomap_begin_report();
>
> Fixes: 1d191b4ca51d ("erofs: implement encoded extent metadata")
> Reported-by: syzbot+d8f000c609f05f52d9b5@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=d8f000c609f05f52d9b5
> Tested-by: syzbot+d8f000c609f05f52d9b5@syzkaller.appspotmail.com
> Signed-off-by: Edward Adam Davis <eadavis@qq.com>
Z_EROFS_ADVISE_BIG_PCLUSTER_1 and Z_EROFS_ADVISE_BIG_PCLUSTER_2 are
valid only for !Z_EROFS_ADVISE_EXTENTS, so I don't think this change
is a proper solution.
From the commit message above, I don't get the root cause either.
Anyway, I will seek time to look into this issue later.
Thanks,
Gao Xiang
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH] erofs: refuse crafted out-of-file-range encoded extents
2025-06-13 23:30 [syzbot] [iomap?] [erofs?] WARNING in iomap_iter (5) syzbot
` (3 preceding siblings ...)
2025-06-15 3:56 ` Edward Adam Davis
@ 2025-06-19 3:28 ` Gao Xiang
4 siblings, 0 replies; 13+ messages in thread
From: Gao Xiang @ 2025-06-19 3:28 UTC (permalink / raw)
To: linux-erofs; +Cc: LKML, Gao Xiang, syzbot+d8f000c609f05f52d9b5
Crafted encoded extents could record out-of-range `lstart`, which should
not happen in normal cases.
It caused an iomap_iter_done() complaint [1] reported by syzbot.
[1] https://lore.kernel.org/r/684cb499.a00a0220.c6bd7.0010.GAE@google.com
Fixes: 1d191b4ca51d ("erofs: implement encoded extent metadata")
Reported-by: syzbot+d8f000c609f05f52d9b5@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=d8f000c609f05f52d9b5
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
---
fs/erofs/zmap.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/fs/erofs/zmap.c b/fs/erofs/zmap.c
index 14ea47f954f5..6afcb054780d 100644
--- a/fs/erofs/zmap.c
+++ b/fs/erofs/zmap.c
@@ -597,6 +597,10 @@ static int z_erofs_map_blocks_ext(struct inode *inode,
if (la > map->m_la) {
r = mid;
+ if (la > lend) {
+ DBG_BUGON(1);
+ return -EFSCORRUPTED;
+ }
lend = la;
} else {
l = mid + 1;
--
2.43.5
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [syzbot] [iomap?] [erofs?] WARNING in iomap_iter (5)
2025-06-14 9:46 ` syzbot
2025-06-15 5:05 ` [PATCH] erofs: confirm big pcluster before setting extents Edward Adam Davis
@ 2025-06-19 3:53 ` Gao Xiang
2025-06-19 4:29 ` syzbot
1 sibling, 1 reply; 13+ messages in thread
From: Gao Xiang @ 2025-06-19 3:53 UTC (permalink / raw)
To: syzbot, linux-erofs, linux-kernel, syzkaller-bugs
#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git dev-test
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [syzbot] [iomap?] [erofs?] WARNING in iomap_iter (5)
2025-06-19 3:53 ` [syzbot] [iomap?] [erofs?] WARNING in iomap_iter (5) Gao Xiang
@ 2025-06-19 4:29 ` syzbot
0 siblings, 0 replies; 13+ messages in thread
From: syzbot @ 2025-06-19 4:29 UTC (permalink / raw)
To: hsiangkao, linux-erofs, linux-kernel, syzkaller-bugs
Hello,
syzbot has tested the proposed patch and the reproducer did not trigger any issue:
Reported-by: syzbot+d8f000c609f05f52d9b5@syzkaller.appspotmail.com
Tested-by: syzbot+d8f000c609f05f52d9b5@syzkaller.appspotmail.com
Tested on:
commit: 0097d266 erofs: refuse crafted out-of-file-range encod..
git tree: git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git dev-test
console output: https://syzkaller.appspot.com/x/log.txt?x=1732b5d4580000
kernel config: https://syzkaller.appspot.com/x/.config?x=162faeb2d1eaefb4
dashboard link: https://syzkaller.appspot.com/bug?extid=d8f000c609f05f52d9b5
compiler: Debian clang version 20.1.6 (++20250514063057+1e4d39e07757-1~exp1~20250514183223.118), Debian LLD 20.1.6
Note: no patches were applied.
Note: testing is done by a robot and is best-effort only.
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2025-06-19 4:29 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-13 23:30 [syzbot] [iomap?] [erofs?] WARNING in iomap_iter (5) syzbot
2025-06-14 3:06 ` Edward Adam Davis
2025-06-14 3:54 ` syzbot
2025-06-14 9:46 ` syzbot
2025-06-15 5:05 ` [PATCH] erofs: confirm big pcluster before setting extents Edward Adam Davis
2025-06-15 5:49 ` Gao Xiang
2025-06-19 3:53 ` [syzbot] [iomap?] [erofs?] WARNING in iomap_iter (5) Gao Xiang
2025-06-19 4:29 ` syzbot
2025-06-15 3:26 ` Edward Adam Davis
2025-06-15 4:02 ` syzbot
2025-06-15 3:56 ` Edward Adam Davis
2025-06-15 4:24 ` syzbot
2025-06-19 3:28 ` [PATCH] erofs: refuse crafted out-of-file-range encoded extents Gao Xiang
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.