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]
Date:	Mon, 19 Dec 2011 11:46:21 -0800
From:	"Darrick J. Wong" <djwong@...ibm.com>
To:	Andreas Dilger <adilger@...mcloud.com>
Cc:	Andreas Dilger <adilger.kernel@...ger.ca>,
	Theodore Tso <tytso@....edu>,
	Sunil Mushran <sunil.mushran@...cle.com>,
	Amir Goldstein <amir73il@...il.com>,
	Andi Kleen <andi@...stfloor.org>,
	Mingming Cao <cmm@...ibm.com>,
	Joel Becker <jlbec@...lplan.org>,
	"linux-ext4@...r.kernel.org" <linux-ext4@...r.kernel.org>,
	Coly Li <colyli@...il.com>
Subject: Re: [PATCH 23/51] e2fsck: Verify htree root/node checksums

On Mon, Dec 19, 2011 at 07:57:21AM +0100, Andreas Dilger wrote:
> On 2011-12-14, at 2:15, "Darrick J. Wong" <djwong@...ibm.com> wrote:
> 
> > Check htree internal node checksums.  If broken, ask user to clear the htree
> > index and recreate it later.
> > 
> > @@ -560,8 +572,12 @@ static void parse_int_node(ext2_filsys fs,
> > #endif
> > 
> >    count = ext2fs_le16_to_cpu(limit->count);
> > -    expect_limit = (fs->blocksize - ((char *) ent - block_buf)) /
> > -        sizeof(struct ext2_dx_entry);
> > +    if (EXT2_HAS_RO_COMPAT_FEATURE(fs->super,
> > +                       EXT4_FEATURE_RO_COMPAT_METADATA_CSUM))
> > +        csum_size = sizeof(struct ext2_dx_tail);
> > +    expect_limit = (fs->blocksize -
> > +            (csum_size + ((char *) ent - block_buf))) /
> > +               sizeof(struct ext2_dx_entry);
> 
> How does this handle the case where the METADATA_CSUM feature is newly
> enabled but there is a dirent usinf the end of the leaf block?  It definitely
> shouldn't cause the last entry to be considered invalid. 

For htree nodes, tune2fs decrements limit if count < limit.  If count == limit,
then fsck is run to rebuild the htree index.  For its part, e2fsck will notice
that count == limit, zero the htree node, and add the directory inode to the
pass3 rebuild list.

> > @@ -829,7 +850,7 @@ static int check_dir_block(ext2_filsys fs,
> >               (rec_len == fs->blocksize) &&
> >               (dirent->name_len == 0) &&
> >               (ext2fs_le16_to_cpu(limit->limit) ==
> > -                ((fs->blocksize-8) /
> > +                ((fs->blocksize - (8 + csum_size)) /
> >                 sizeof(struct ext2_dx_entry))))
> >            dx_db->type = DX_DIRBLOCK_NODE;
> 
> Same here.  
> 
> > diff --git a/e2fsck/problem.c b/e2fsck/problem.c
> > index 96b0de5..2e9ab7f 100644
> > --- a/e2fsck/problem.c
> > +++ b/e2fsck/problem.c
> > @@ -1374,6 +1374,16 @@ static struct e2fsck_problem problem_table[] = {
> >      N_("i_file_acl_hi @F %N, @s zero.\n"),
> >      PROMPT_CLEAR, PR_PREEN_OK },
> > 
> > +    /* htree root node fails checksum */
> > +    { PR_2_HTREE_ROOT_CSUM_INVALID,
> > +      N_("@p @h %d: root node fails checksum\n"),
> > +      PROMPT_CLEAR_HTREE, PR_PREEN_OK },
> > +
> > +    /* htree internal node fails checksum */
> > +    { PR_2_HTREE_NODE_CSUM_INVALID,
> > +      N_("@p @h %d: node fails checksum\n"),
> 
> This error message should include "internal" in the printed message. 

How about "htree node"?  I wondered why the other PR_*_HTREE messages don't say
"htree" -- is there a particular reason for this?

--D

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ