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:   Thu, 13 Oct 2022 10:00:06 +0800
From:   Herbert Xu <herbert@...dor.apana.org.au>
To:     Robert Elliott <elliott@....com>
Cc:     davem@...emloft.net, tim.c.chen@...ux.intel.com,
        ap420073@...il.com, ardb@...nel.org, linux-crypto@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 05/19] crypto: x86/crc - limit FPU preemption

On Wed, Oct 12, 2022 at 04:59:17PM -0500, Robert Elliott wrote:
>
> @@ -170,9 +179,17 @@ static int __crc32c_pcl_intel_finup(u32 *crcp, const u8 *data, unsigned int len,
>  				u8 *out)
>  {
>  	if (len >= CRC32C_PCL_BREAKEVEN && crypto_simd_usable()) {
> -		kernel_fpu_begin();
> -		*(__le32 *)out = ~cpu_to_le32(crc_pcl(data, len, *crcp));
> -		kernel_fpu_end();
> +		do {
> +			unsigned int chunk = min(len, FPU_BYTES);
> +
> +			kernel_fpu_begin();
> +			*crcp = crc_pcl(data, chunk, *crcp);

How about storing the intermediate result in a local variable
instead of overwriting *crcp?

Thanks,
-- 
Email: Herbert Xu <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ