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]
Message-Id: <FB8C02E3-15F9-413B-97AE-2F433CA9A213@dilger.ca>
Date:   Fri, 27 Oct 2017 17:59:35 -0600
From:   Andreas Dilger <adilger@...ger.ca>
To:     Artem Blagodarenko <artem.blagodarenko@...il.com>
Cc:     linux-ext4 <linux-ext4@...r.kernel.org>,
        Alexey Lyashkov <alexey.lyashkov@...il.com>,
        Artem Blagodarenko <artem.blagodarenko@...gate.com>
Subject: Re: [RFC PATCH 8/8] quota: quota 64bit inode number cleanup

On Oct 27, 2017, at 11:22 AM, Artem Blagodarenko <artem.blagodarenko@...il.com> wrote:
> 
> Quota stores inodes numbers and beed to be fixed
> to store 64bit inodes.
> 
> This patch makes quota 64bit inode ready.
> 
> Signed-off-by: Artem Blagodarenko <artem.blagodarenko@...gate.com>
> ---
> debugfs/set_fields.c        |  3 +++
> e2fsck/pass1.c              |  3 ++-
> e2fsck/quota.c              |  8 ++++----
> e2fsck/unix.c               |  2 +-
> lib/e2p/ls.c                |  4 ++--
> lib/ext2fs/swapfs.c         |  3 +++
> lib/ext2fs/tst_super_size.c |  5 ++++-
> lib/support/mkquota.c       | 10 +++-------
> lib/support/quotaio.c       |  2 +-
> lib/support/quotaio.h       | 47 +++++++++++++++++++++++++++++++++++++--------
> misc/tune2fs.c              |  4 ++--
> 11 files changed, 64 insertions(+), 27 deletions(-)
> 
> diff --git a/debugfs/set_fields.c b/debugfs/set_fields.c
> index 9aa8feca..521f8483 100644
> --- a/debugfs/set_fields.c
> +++ b/debugfs/set_fields.c
> @@ -153,8 +153,11 @@ static struct field_set_info super_fields[] = {
> 	{ "snapshot_list", &set_sb.s_snapshot_list, NULL, 4, parse_uint },
> 	{ "mount_opts",  &set_sb.s_mount_opts, NULL, 64, parse_string },
> 	{ "usr_quota_inum", &set_sb.s_usr_quota_inum, NULL, 4, parse_uint },
> +	{ "usr_quota_inum_hi", &set_sb.s_usr_quota_inum_hi, NULL, 4, parse_uint },
> 	{ "grp_quota_inum", &set_sb.s_grp_quota_inum, NULL, 4, parse_uint },
> +	{ "grp_quota_inum_hi", &set_sb.s_grp_quota_inum_hi, NULL, 4, parse_uint },
> 	{ "prj_quota_inum", &set_sb.s_prj_quota_inum, NULL, 4, parse_uint },
> +	{ "prj_quota_inum_hi", &set_sb.s_prj_quota_inum_hi, NULL, 4, parse_uint },

As with the other code, the "inum_hi" handling should be moved into the previous
line for all cases, replacing "NULL" with "&set_sb.s_{usr,grp,prj}_quota_inum_hi".

> diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c
> index 2eedbcfb..a70ce071 100644
> --- a/e2fsck/pass1.c
> +++ b/e2fsck/pass1.c
> @@ -1130,7 +1130,8 @@ static int quota_inum_is_super(struct ext2_super_block *sb, ext2_ino_t ino)
> 	enum quota_type qtype;
> 
> 	for (qtype = 0; qtype < MAXQUOTAS; qtype++)
> -		if (*quota_sb_inump(sb, qtype) == ino)
> +		if (quota_sb_inump(sb, qtype) == ino)
> +
> 			return 1;

Remove extra blank line here.

Also, this function should no longer be named "inump", since that meant
"inum pointer", which it no longer returns.

> diff --git a/lib/ext2fs/tst_super_size.c b/lib/ext2fs/tst_super_size.c
> index 2858af9f..7972d24f 100644
> --- a/lib/ext2fs/tst_super_size.c
> +++ b/lib/ext2fs/tst_super_size.c
> @@ -53,7 +53,7 @@ int main(int argc, char **argv)
> 
> 	printf("%8s %-30s %3s\n", "offset", "field", "size");
> 	check_field(s_inodes_count, 4);
> -	check_field(s_inodes_count_hi, 4;
> +	check_field(s_inodes_count_hi, 4);
> 	check_field(s_blocks_count, 4);
> 	check_field(s_r_blocks_count, 4);
> 	check_field(s_free_blocks_count, 4);

This should be in the previous patch.

> @@ -136,13 +136,16 @@ int main(int argc, char **argv)
> 	check_field(s_last_error_func, 32);
> 	check_field(s_mount_opts, 64);
> 	check_field(s_usr_quota_inum, 4);
> +	check_field(s_usr_quota_inum_hi, 4);
> 	check_field(s_grp_quota_inum, 4);
> +	check_field(s_grp_quota_inum_hi, 4);
> 	check_field(s_overhead_blocks, 4);
> 	check_field(s_backup_bgs, 8);
> 	check_field(s_encrypt_algos, 4);
> 	check_field(s_encrypt_pw_salt, 16);
> 	check_field(s_lpf_ino, 4);
> 	check_field(s_prj_quota_inum, 4);
> +	check_field(s_prj_quota_inum_hi, 4);
> 	check_field(s_checksum_seed, 4);
> 	check_field(s_reserved, 98 * 4);
> 	check_field(s_checksum, 4);

These new fields should all be checked in struct order, rather than after
the non-"_hi" field of the same name.

> diff --git a/lib/support/quotaio.h b/lib/support/quotaio.h
> index f89536eb..eb667eb1 100644
> --- a/lib/support/quotaio.h
> +++ b/lib/support/quotaio.h
> @@ -245,21 +245,52 @@ int parse_quota_types(const char *in_str, unsigned int *qtype_bits,
>  * This allows the caller to get or set the quota inode by type without the
>  * need for the quota array to be contiguous in the superbock.
>  */
> -static inline ext2_ino_t *quota_sb_inump(struct ext2_super_block *sb,
> -					 enum quota_type qtype)
> +static inline ext2_ino_t quota_sb_inump(struct ext2_super_block *sb,
> +					enum quota_type qtype)
> {
> +	ext2_ino_t quota_inum = 0;
> +
> 	switch (qtype) {
> 	case USRQUOTA:
> -		return &sb->s_usr_quota_inum;
> +		quota_inum = sb->s_usr_quota_inum;
> +		if(sb->s_feature_incompat & EXT4_FEATURE_INCOMPAT_64INODE)
> +			quota_inum |= (unsigned long)sb->s_usr_quota_inum_hi <<
>  32;

(style) space after "if", for cases below as well
(style) use "u64" instead of unsigned long to fit within 80 columns

> +		break;
> 	case GRPQUOTA:
> -		return &sb->s_grp_quota_inum;
> +		quota_inum = sb->s_grp_quota_inum;
> +		if(sb->s_feature_incompat & EXT4_FEATURE_INCOMPAT_64INODE)
> +			quota_inum |= (unsigned long)sb->s_grp_quota_inum_hi << 32;
> +		break;
> 	case PRJQUOTA:
> -		return &sb->s_prj_quota_inum;
> -	default:
> -		return NULL;
> +		quota_inum = sb->s_prj_quota_inum;
> +		if(sb->s_feature_incompat & EXT4_FEATURE_INCOMPAT_64INODE)
> +			quota_inum |= (unsigned long)sb->s_prj_quota_inum_hi << 32;
> +		break;
> 

Cheers, Andreas






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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ