diff options
| author | Gyokhan Kochmarla <gyokhan@amazon.de> | 2026-10-13 11:48:52 +0000 |
|---|---|---|
| committer | Gao Xiang <xiang@kernel.org> | 2026-10-14 13:22:44 +0200 |
| commit | 9b637385b210cd7c403e309ad9e08ec521cf8848 (patch) | |
| tree | b884982d528a355c3f9542542378b04098a4dc22 /tools/lib/python | |
| parent | 183de86489a3be2acb5e454a88ffe4fbfdbcb3f4 (diff) | |
| download | linux-next-9b637385b210cd7c403e309ad9e08ec521cf8848.tar.gz linux-next-9b637385b210cd7c403e309ad9e08ec521cf8848.zip | |
erofs: use on-disk blkszbits for lz4 max pcluster bound
z_erofs_load_lz4_config() rejects a valid LZ4 image when the kernel's
page size differs from the image's block size. It bounds the on-disk
max_pclusterblks with erofs_blknr(sb, Z_EROFS_PCLUSTER_MAX_SIZE), which
expands to Z_EROFS_PCLUSTER_MAX_SIZE >> sb->s_blocksize_bits.
At the point this runs, sb->s_blocksize_bits still holds PAGE_SHIFT:
erofs_fc_fill_super() seeds s_blocksize_bits to PAGE_SHIFT before
reading the superblock, and only corrects it down to the on-disk
blkszbits after erofs_read_superblock() returns. The LZ4 config is
parsed inside erofs_read_superblock(), before that correction, so the
bound is computed with the wrong shift.
On a 64K-page kernel mounting a 4K-block image (e.g. one built with
mkfs.erofs -C 262144 on a 4K-page host), the bound evaluates to
1 MiB >> 16 = 16 blocks instead of the correct 1 MiB >> 12 = 256
blocks. The image's legitimate max_pclusterblks of 64 then fails the
check, mount returns -EINVAL, and booting from such an image as the
root filesystem panics:
erofs (device dm-0): too large lz4 pclusterblks 64
Kernel panic - not syncing: VFS: Unable to mount root fs
sbi->blkszbits already holds the on-disk block size at this point, so
compute the bound from it directly. This makes the check independent of
the host page size and of superblock-parse ordering.
commit 3acea5fc3354 ("erofs: avoid hardcoded blocksize for subpage block
support") already handled the same ordering hazard for the superblock
checksum path by using sbi->blkszbits in erofs_superblock_csum_verify();
the lz4 config path was missed.
Fixes: 3acea5fc3354 ("erofs: avoid hardcoded blocksize for subpage block support")
Cc: stable@vger.kernel.org
Assisted-by: Kirocrew:gpt-5.6-sol
Signed-off-by: Gyokhan Kochmarla <gyokhan@amazon.de>
Reviewed-by: Gao Xiang <xiang@kernel.org>
Signed-off-by: Gao Xiang <xiang@kernel.org>
Diffstat (limited to 'tools/lib/python')
0 files changed, 0 insertions, 0 deletions
