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]
Date:   Sun, 29 Oct 2023 03:34:33 +0300
From:   Anssi Hannula <anssi.hannula@....fi>
To:     linux-ext4@...r.kernel.org, Theodore Ts'o <tytso@....edu>
Subject: [PATCH] resize2fs: account for META_BG in group descriptor check

The block group descriptor count sanity check added in 21bad2b6797f
("resize2fs: prevent block group descriptors from overflowing the first
bg") prevents enlarging the filesystem when the block group descriptors
would not fit in the first block group.

However, this does not take into account the META_BG feature in which
case not all the descriptors need to be stored in the first block group.

This prevents, for example, enlarging filesystems with 4KiB block size
past 256TiB.

Relax the check to allow resizing META_BG filesystems past the limit.

Also, always allow on-line resizing as the kernel takes care of
converting the filesystem to use META_BG when needed.

Link: https://github.com/tytso/e2fsprogs/issues/117
Fixes: 21bad2b6797f ("resize2fs: prevent block group descriptors from overflowing the first bg")
Signed-off-by: Anssi Hannula <anssi.hannula@....fi>
---
 resize/main.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/resize/main.c b/resize/main.c
index f914c050..8c626202 100644
--- a/resize/main.c
+++ b/resize/main.c
@@ -556,11 +556,13 @@ int main (int argc, char ** argv)
 						 EXT2_BLOCKS_PER_GROUP(fs->super));
 	new_desc_blocks = ext2fs_div_ceil(new_group_desc_count,
 					  EXT2_DESC_PER_BLOCK(fs->super));
-	if ((new_desc_blocks + fs->super->s_first_data_block) >
+	if (!ext2fs_has_feature_meta_bg(fs->super) &&
+	    !(mount_flags & EXT2_MF_MOUNTED) &&
+	    (new_desc_blocks + fs->super->s_first_data_block) >
 	    EXT2_BLOCKS_PER_GROUP(fs->super)) {
 		com_err(program_name, 0,
-			_("New size results in too many block group "
-			  "descriptors.\n"));
+			_("New size requires on-line resizing for meta_bg "
+			  "conversion, please mount the filesystem first\n"));
 		goto errout;
 	}
 
-- 
2.41.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ