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] [day] [month] [year] [list]
Date: Fri, 26 Jan 2024 16:58:46 +0800
From: Herbert Xu <herbert@...dor.apana.org.au>
To: Arnd Bergmann <arnd@...nel.org>
Cc: Giovanni Cabiddu <giovanni.cabiddu@...el.com>,
	"David S. Miller" <davem@...emloft.net>,
	Damian Muszynski <damian.muszynski@...el.com>,
	Arnd Bergmann <arnd@...db.de>,
	Tom Zanussi <tom.zanussi@...ux.intel.com>,
	Jie Wang <jie.wang@...el.com>, qat-linux@...el.com,
	linux-crypto@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] crypto: qat - avoid memcpy() overflow warning

On Wed, Jan 03, 2024 at 05:26:02PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@...db.de>
> 
> The use of array_size() leads gcc to assume the memcpy() can have a larger
> limit than actually possible, which triggers a string fortification warning:
> 
> In file included from include/linux/string.h:296,
>                  from include/linux/bitmap.h:12,
>                  from include/linux/cpumask.h:12,
>                  from include/linux/sched.h:16,
>                  from include/linux/delay.h:23,
>                  from include/linux/iopoll.h:12,
>                  from drivers/crypto/intel/qat/qat_common/adf_gen4_hw_data.c:3:
> In function 'fortify_memcpy_chk',
>     inlined from 'adf_gen4_init_thd2arb_map' at drivers/crypto/intel/qat/qat_common/adf_gen4_hw_data.c:401:3:
> include/linux/fortify-string.h:579:4: error: call to '__write_overflow_field' declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Werror=attribute-warning]
>   579 |    __write_overflow_field(p_size_field, size);
>       |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> include/linux/fortify-string.h:588:4: error: call to '__read_overflow2_field' declared with attribute warning: detected read beyond size of field (2nd parameter); maybe use struct_group()? [-Werror=attribute-warning]
>   588 |    __read_overflow2_field(q_size_field, size);
>       |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> Add an explicit range check to avoid this.
> 
> Fixes: 5da6a2d5353e ("crypto: qat - generate dynamically arbiter mappings")
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
> ---
>  drivers/crypto/intel/qat/qat_common/adf_gen4_hw_data.c | 3 +++
>  1 file changed, 3 insertions(+)

Patch applied.  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