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]
Message-ID: <20250221.ga2OSh6ieZei@digikod.net>
Date: Fri, 21 Feb 2025 17:00:34 +0100
From: Mickaël Salaün <mic@...ikod.net>
To: Kees Cook <kees@...nel.org>, Guo Ren <guoren@...nel.org>
Cc: linux-hardening@...r.kernel.org, kernel test robot <lkp@...el.com>, 
	oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org, 
	James Morris <jamorris@...ux.microsoft.com>, Jann Horn <jannh@...gle.com>, linux-csky@...r.kernel.org, 
	Günther Noack <gnoack@...gle.com>
Subject: Re: security/landlock/ruleset.c:96:9: warning: 'memcpy' accessing
 4294967295 bytes at offsets 20 and 0 overlaps 6442450943 bytes at offset
 -2147483648

Cc csky developers.

See https://lore.kernel.org/r/202501040747.S3LYfvYq-lkp@intel.com

On Mon, Jan 06, 2025 at 04:27:26PM -0800, Kees Cook wrote:
> On Mon, Jan 06, 2025 at 06:04:56PM +0100, Mickaël Salaün wrote:
> > On Sat, Jan 04, 2025 at 07:26:27AM +0800, kernel test robot wrote:
> > >    security/landlock/ruleset.c: In function 'create_rule':
> > > >> security/landlock/ruleset.c:96:9: warning: 'memcpy' accessing 4294967295 bytes at offsets 20 and 0 overlaps 6442450943 bytes at offset -2147483648 [-Wrestrict]
> > >       96 |         memcpy(new_rule->layers, layers,
> > >          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > >       97 |                         flex_array_size(new_rule, layers, num_layers));
> > >          |                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This warning seems to only show with the csky architecture.

> >
> > I guess the GCC warning is a false positive?
> > See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116494
> 
> Does the warning go away if flex_array_size() is open-coded or if the
> create_rule prototype uses "*" instead of "[]" syntax for the "layers"
> argument?

But that would not be correct right?

> 
> The warning is about the "read" part ("accessing"). Using tip-of-tree
> gcc with -fdiagnostics-details might show more details on the calling
> path.
> 
> -Kees
> 
> -- 
> Kees Cook
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ