lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20251113090122.2385797-1-libaokun@huaweicloud.com>
Date: Thu, 13 Nov 2025 17:01:22 +0800
From: libaokun@...weicloud.com
To: linux-ext4@...r.kernel.org
Cc: tytso@....edu,
	adilger.kernel@...ger.ca,
	jack@...e.cz,
	djwong@...nel.org,
	yangerkun@...wei.com,
	libaokun1@...wei.com,
	libaokun@...weicloud.com
Subject: [PATCH e2fsprogs v2] libext2fs: fix orphan file size > kernel limit with large blocksize

From: Baokun Li <libaokun1@...wei.com>

Kernel commit 0a6ce20c1564 ("ext4: verify orphan file size is not too big")
limits the maximum supported orphan file size to 8 << 20.

However, in e2fsprogs, the orphan file size is set to 32–512 filesystem
blocks when creating a filesystem.

With 64k block size, formatting an ext4 fs >32G gives an orphan file bigger
than the kernel allows, so mount prints an error and fails:

    EXT4-fs (vdb): orphan file too big: 8650752
    EXT4-fs (vdb): mount failed

Therefore, synchronize the kernel change to e2fsprogs to avoid creating
orphan files larger than the kernel limit.

Signed-off-by: Baokun Li <libaokun1@...wei.com>
---
v1->v2:
 * Revert the changes in ext2fs_default_orphan_file_blocks()

v1: https://lore.kernel.org/r/20251112122157.1990595-1-libaokun@huaweicloud.com

 lib/ext2fs/orphan.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lib/ext2fs/orphan.c b/lib/ext2fs/orphan.c
index 14ac3569..6124a59a 100644
--- a/lib/ext2fs/orphan.c
+++ b/lib/ext2fs/orphan.c
@@ -164,6 +164,12 @@ errcode_t ext2fs_create_orphan_file(ext2_filsys fs, blk_t num_blocks)
 	memset(zerobuf, 0, fs->blocksize);
 	ob_tail = ext2fs_orphan_block_tail(fs, buf);
 	ob_tail->ob_magic = ext2fs_cpu_to_le32(EXT4_ORPHAN_BLOCK_MAGIC);
+	/*
+	 * Kernel commit 0a6ce20c1564 ("ext4: verify orphan file size is not
+	 * too big") limits the maximum supported orphan file size to 8 << 20.
+	 */
+	if (num_blocks * fs->blocksize > (8 << 20))
+		num_blocks = (8 << 20) / fs->blocksize;
 	oi.num_blocks = num_blocks;
 	oi.alloc_blocks = 0;
 	oi.last_blk = 0;
-- 
2.46.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ