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:	Mon, 19 Dec 2011 12:03:04 -0800
From:	"Darrick J. Wong" <djwong@...ibm.com>
To:	Andreas Dilger <aedilger@...il.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 09/51] libext2fs: Create the inode bitmap checksum

On Sun, Dec 18, 2011 at 07:18:20AM -0700, Andreas Dilger wrote:
> On 2011-12-13, at 18:14, "Darrick J. Wong" <djwong@...ibm.com> wrote:
> > Provide a field in the block group descriptor to store inode bitmap checksum,
> > and some helper functions to calculate and verify it.
> > +int ext2fs_inode_bitmap_csum_verify(ext2_filsys fs, dgrp_t group,
> > +                    char *bitmap, int size)
> > +{
> > +    struct ext4_group_desc *gdp = (struct ext4_group_desc *)
> > +            ext2fs_group_desc(fs, fs->group_desc, group);
> > +    __u32 provided, calculated;
> > +
> > +    if (!EXT2_HAS_RO_COMPAT_FEATURE(fs->super,
> > +                    EXT4_FEATURE_RO_COMPAT_METADATA_CSUM))
> > +        return 1;
> > +    provided = gdp->bg_inode_bitmap_csum_lo;
> > +    calculated = ext2fs_crc32c_le(~0, fs->super->s_uuid,
> > +                      sizeof(fs->super->s_uuid));
> 
> It makes sense to precompute the uuid checksum and store it in the
> ext2_filsys struct so that it is accessible everywhere, like is done in the
> kernel.

I wonder how much that'll help compared to the IO overhead, but I suppose every
bit helps.

> > +    calculated = ext2fs_crc32c_le(calculated, (unsigned char *)bitmap,
> > +                      size);
> > +    if (fs->super->s_desc_size >= EXT4_BG_INODE_BITMAP_CSUM_HI_LOCATION)
> > +        provided |= (__u32)gdp->bg_inode_bitmap_csum_hi << 16;
> > +    else
> > +        calculated &= 0xFFFF;
> > +
> > +    return provided == calculated;
> > +}
> > +
> > 
> > +++ b/lib/ext2fs/ext2_fs.h
> > @@ -191,6 +191,10 @@ struct ext4_group_desc
> >    __u32    bg_reserved;
> > };
> > 
> > +#define EXT4_BG_INODE_BITMAP_CSUM_HI_LOCATION    \
> > +    (offsetof(struct ext4_group_desc, bg_inode_bitmap_csum_hi) + \
> > +     sizeof(__u16))
> 
> It is a bit misleading to call this constant the "location" since it is
> actually the end of the csum_hi field.  Either the sizeof(__u16) should be
> moved to the caller, or this should be renamed to
> EXT4_BG_INODE_BITMAP_CSUM_HI_END or similar. 

Ok.

--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