[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <202501061623.7A617B09@keescook>
Date: Mon, 6 Jan 2025 16:27:26 -0800
From: Kees Cook <kees@...nel.org>
To: Mickaël Salaün <mic@...ikod.net>
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>
Subject: Re: security/landlock/ruleset.c:96:9: warning: 'memcpy' accessing
4294967295 bytes at offsets 20 and 0 overlaps 6442450943 bytes at offset
-2147483648
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));
> > | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> 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?
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