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: <0360c726-c139-345b-a478-82b33a7aa804@universe-factory.net>
Date:   Wed, 8 Aug 2018 00:17:30 +0200
From:   Matthias Schiffer <mschiffer@...verse-factory.net>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-kernel@...r.kernel.org
Cc:     stable@...r.kernel.org, Eric Whitney <enwlinux@...il.com>,
        Theodore Tso <tytso@....edu>
Subject: Re: [PATCH 4.14 222/246] ext4: fix check to prevent initializing
 reserved inodes

On 08/01/2018 06:52 PM, Greg Kroah-Hartman wrote:
> 4.14-stable review patch.  If anyone has any objections, please let me know.

It seems this patch is still missing from the 4.4.y and 4.9.y branches.

Matthias


> 
> ------------------
> 
> From: Theodore Ts'o <tytso@....edu>
> 
> commit 5012284700775a4e6e3fbe7eac4c543c4874b559 upstream.
> 
> Commit 8844618d8aa7: "ext4: only look at the bg_flags field if it is
> valid" will complain if block group zero does not have the
> EXT4_BG_INODE_ZEROED flag set.  Unfortunately, this is not correct,
> since a freshly created file system has this flag cleared.  It gets
> almost immediately after the file system is mounted read-write --- but
> the following somewhat unlikely sequence will end up triggering a
> false positive report of a corrupted file system:
> 
>    mkfs.ext4 /dev/vdc
>    mount -o ro /dev/vdc /vdc
>    mount -o remount,rw /dev/vdc
> 
> Instead, when initializing the inode table for block group zero, test
> to make sure that itable_unused count is not too large, since that is
> the case that will result in some or all of the reserved inodes
> getting cleared.
> 
> This fixes the failures reported by Eric Whiteney when running
> generic/230 and generic/231 in the the nojournal test case.
> 
> Fixes: 8844618d8aa7 ("ext4: only look at the bg_flags field if it is valid")
> Reported-by: Eric Whitney <enwlinux@...il.com>
> Signed-off-by: Theodore Ts'o <tytso@....edu>
> Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> 
> ---
>  fs/ext4/ialloc.c |    5 ++++-
>  fs/ext4/super.c  |    8 +-------
>  2 files changed, 5 insertions(+), 8 deletions(-)
> 
> --- a/fs/ext4/ialloc.c
> +++ b/fs/ext4/ialloc.c
> @@ -1397,7 +1397,10 @@ int ext4_init_inode_table(struct super_b
>  			    ext4_itable_unused_count(sb, gdp)),
>  			    sbi->s_inodes_per_block);
>  
> -	if ((used_blks < 0) || (used_blks > sbi->s_itb_per_group)) {
> +	if ((used_blks < 0) || (used_blks > sbi->s_itb_per_group) ||
> +	    ((group == 0) && ((EXT4_INODES_PER_GROUP(sb) -
> +			       ext4_itable_unused_count(sb, gdp)) <
> +			      EXT4_FIRST_INO(sb)))) {
>  		ext4_error(sb, "Something is wrong with group %u: "
>  			   "used itable blocks: %d; "
>  			   "itable unused count: %u",
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -3103,14 +3103,8 @@ static ext4_group_t ext4_has_uninit_itab
>  		if (!gdp)
>  			continue;
>  
> -		if (gdp->bg_flags & cpu_to_le16(EXT4_BG_INODE_ZEROED))
> -			continue;
> -		if (group != 0)
> +		if (!(gdp->bg_flags & cpu_to_le16(EXT4_BG_INODE_ZEROED)))
>  			break;
> -		ext4_error(sb, "Inode table for bg 0 marked as "
> -			   "needing zeroing");
> -		if (sb_rdonly(sb))
> -			return ngroups;
>  	}
>  
>  	return group;
> 
> 




Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ