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: <81f0fe3e-4c1a-497d-b20e-1f8d182ed208@oracle.com>
Date: Wed, 16 Apr 2025 11:08:25 +0100
From: John Garry <john.g.garry@...cle.com>
To: "Darrick J. Wong" <djwong@...nel.org>
Cc: brauner@...nel.org, hch@....de, viro@...iv.linux.org.uk, jack@...e.cz,
        cem@...nel.org, linux-fsdevel@...r.kernel.org, dchinner@...hat.com,
        linux-xfs@...r.kernel.org, linux-kernel@...r.kernel.org,
        ojaswin@...ux.ibm.com, ritesh.list@...il.com,
        martin.petersen@...cle.com, linux-ext4@...r.kernel.org,
        linux-block@...r.kernel.org, catherine.hoang@...cle.com,
        linux-api@...r.kernel.org
Subject: Re: [PATCH v7.1 14/14] xfs: allow sysadmins to specify a maximum
 atomic write limit at mount time

On 15/04/2025 23:36, Darrick J. Wong wrote:

Thanks for this, but it still seems to be problematic for me.

In my test, I have agsize=22400, and when I attempt to mount with 
atomic_write_max=8M, it passes when it shouldn't. It should not because 
max_pow_of_two_factor(22400) = 128, and 8MB > 128 FSB.

How about these addition checks:

> +
> +	if (new_max_bytes) {
> +		xfs_extlen_t	max_write_fsbs =
> +			rounddown_pow_of_two(XFS_B_TO_FSB(mp, MAX_RW_COUNT));
> +		xfs_extlen_t	max_group_fsbs =
> +			max(mp->m_groups[XG_TYPE_AG].blocks,
> +			    mp->m_groups[XG_TYPE_RTG].blocks);
> +
> +		ASSERT(max_write_fsbs <= U32_MAX);

		if (!is_power_of_2(new_max_bytes)) {
			xfs_warn(mp,
  "max atomic write size of %llu bytes is not a power-of-2",
					new_max_bytes);
			return -EINVAL;
		}

> +
> +		if (new_max_bytes % mp->m_sb.sb_blocksize > 0) {
> +			xfs_warn(mp,
> + "max atomic write size of %llu bytes not aligned with fsblock",
> +					new_max_bytes);
> +			return -EINVAL;
> +		}
> +
> +		if (new_max_fsbs > max_write_fsbs) {
> +			xfs_warn(mp,
> + "max atomic write size of %lluk cannot be larger than max write size %lluk",
> +					new_max_bytes >> 10,
> +					XFS_FSB_TO_B(mp, max_write_fsbs) >> 10);
> +			return -EINVAL;
> +		}
> +
> +		if (new_max_fsbs > max_group_fsbs) {
> +			xfs_warn(mp,
> + "max atomic write size of %lluk cannot be larger than allocation group size %lluk",
> +					new_max_bytes >> 10,
> +					XFS_FSB_TO_B(mp, max_group_fsbs) >> 10);
> +			return -EINVAL;
> +		}
> +	}
> +

	if (new_max_fsbs > max_pow_of_two_factor(max_group_fsbs)) {
		xfs_warn(mp,
  "max atomic write size of %lluk not aligned with allocation group size 
%lluk",
				new_max_bytes >> 10,
				XFS_FSB_TO_B(mp, max_group_fsbs) >> 10);
		return -EINVAL;
	}

thanks,
John

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ