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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250113183517.GC6152@frogsfrogsfrogs>
Date: Mon, 13 Jan 2025 10:35:17 -0800
From: "Darrick J. Wong" <djwong@...nel.org>
To: Theodore Ts'o <tytso@....edu>
Cc: Catalin Patulea <cronos586@...il.com>, linux-ext4@...r.kernel.org,
	Kazuya Mio <k-mio@...jp.nec.com>
Subject: Re: e2fsck max blocks for huge non-extent file

On Mon, Jan 13, 2025 at 11:33:45AM -0500, Theodore Ts'o wrote:
> On Mon, Jan 13, 2025 at 12:49:19AM -0500, Catalin Patulea wrote:
> > 
> > I have an ext3 filesystem on which I manually enabled huge_file
> > (files >2 TB) using tune2fs; then created a 3 TB file (backup image
> > of another disk).  Now, I am running e2fsck and it reports errors:
> 
> Hmm, it looks like this has been broken for a while.  I've done a
> quick look, and it appears this has been the case since e2fsprogs
> 1.28 and this commit:
> 
> commit da307041e75bdf3b24c1eb43132a4f9d8a1b3844
> Author: Theodore Ts'o <tytso@....edu>
> Date:   Tue May 21 21:19:14 2002 -0400
> 
>     Check for inodes which are too big (either too many blocks, or
>     would cause i_size to be too big), and offer to truncate the inode.
>     Remove old bogus i_size checks.
>     
>     Add test case which tests e2fsck's handling of large sparse files.
>     Older e2fsck with the old(er) bogus i_size checks didn't handle
>     this correctly.
> 
> I think no one noticed since trying to support files this large on a
> non-extent file is so inefficient and painful that in practice anyone
> trying to use files this large would be using ext4, and not a really
> ancient ext3 file system.
> 
> The fix might be as simple as this, but I haven't had a chance to test
> it and do appropriate regression tests....
> 
> diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c
> index eb73922d3..e460a75f4 100644
> --- a/e2fsck/pass1.c
> +++ b/e2fsck/pass1.c
> @@ -3842,7 +3842,7 @@ static int process_block(ext2_filsys fs,
>  		problem = PR_1_TOOBIG_DIR;
>  	if (p->is_dir && p->num_blocks + 1 >= p->max_blocks)
>  		problem = PR_1_TOOBIG_DIR;
> -	if (p->is_reg && p->num_blocks + 1 >= p->max_blocks)
> +	if (p->is_reg && p->num_blocks + 1 >= 1U << 31)

Hmm -- num_blocks is ... the number of "extent records", right?  And on
a !extents file, each block mapped by an {in,}direct block counts as a
separate "extent record", right?

In that case, I think (1U<<31) isn't quite right, because the very large
file could have an ACL block, or (shudder) a "hurd translator block".
So that's (1U<<31) + 2 for !extents files.

For extents files, shouldn't this be (1U<<48) + 2?  Since you /could/
create a horrifingly large extent tree with a hojillion little
fragments, right?  Even if it took a million years to create such a
monster? :)

--D

>  		problem = PR_1_TOOBIG_REG;
>  	if (!p->is_dir && !p->is_reg && blockcnt > 0)
>  		problem = PR_1_TOOBIG_SYMLINK;
> 
> 
> 						- Ted
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ