From: Kees Cook <kees@kernel.org>
To: "Mickaël Salaün" <mic@digikod.net>
Cc: linux-hardening@vger.kernel.org,
kernel test robot <lkp@intel.com>,
oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
James Morris <jamorris@linux.microsoft.com>,
Jann Horn <jannh@google.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
Date: Mon, 6 Jan 2025 16:27:26 -0800 [thread overview]
Message-ID: <202501061623.7A617B09@keescook> (raw)
In-Reply-To: <20250106.uu8as0Ha6pof@digikod.net>
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
next prev parent reply other threads:[~2025-01-07 0:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-03 23:26 security/landlock/ruleset.c:96:9: warning: 'memcpy' accessing 4294967295 bytes at offsets 20 and 0 overlaps 6442450943 bytes at offset -2147483648 kernel test robot
2025-01-06 17:04 ` Mickaël Salaün
2025-01-07 0:27 ` Kees Cook [this message]
2025-02-21 16:00 ` Mickaël Salaün
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202501061623.7A617B09@keescook \
--to=kees@kernel.org \
--cc=jamorris@linux.microsoft.com \
--cc=jannh@google.com \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=mic@digikod.net \
--cc=oe-kbuild-all@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.