From: Brian Norris <briannorris@chromium.org>
To: Guenter Roeck <groeck@google.com>
Cc: Julius Werner <jwerner@chromium.org>,
Paul Menzel <pmenzel@molgen.mpg.de>,
LKML <linux-kernel@vger.kernel.org>,
Greg KH <gregkh@linuxfoundation.org>,
Guenter Roeck <groeck@chromium.org>,
Stephen Boyd <swboyd@chromium.org>,
Jack Rosenthal <jrosenth@chromium.org>,
coreboot@coreboot.org, Kees Cook <keescook@chromium.org>
Subject: Re: memcpy: detected field-spanning write (size 168) of single field "&device->entry" at drivers/firmware/google/coreboot_table.c:103 (size 8)
Date: Tue, 3 Jan 2023 11:31:02 -0800 [thread overview]
Message-ID: <Y7SCdrL+xZm5CSjy@google.com> (raw)
In-Reply-To: <CABXOdTcvBe5PzO6RrUDC-NcYpWYuabZkN1qXA=gSqbhPHLxqsw@mail.gmail.com>
On Thu, Dec 29, 2022 at 12:28:14PM -0800, Guenter Roeck wrote:
> On Thu, Dec 29, 2022 at 6:43 AM Julius Werner <jwerner@chromium.org> wrote:
> >
> > I can confirm that this warning is a false positive, at least. We're
> > intentionally copying bytes from beyond the end of the header
> > structure in this case.
> >
> > I don't know what kind of kernel system detects this stuff at runtime
> > and how to silence it. Probably need to add a void pointer cast or
> > something?
> >
>
> This is part of kernel hardening code. Kees Cook might know what to do about it.
One could probably throw in casts, like this example did:
0d043351e5ba ext4: fix fortify warning in fs/ext4/fast_commit.c:1551
Or one could probably imitate this example, and insert an appropriate
flexible array (possibly with yet another union?):
b43088f30db1 s390/zcrypt: fix warning about field-spanning write
Side mostly-unrelated note: coreboot_table_populate() doesn't do any
bounds checking that the individual entry copies don't overflow the
table buffer size. We're _probably_ not that interested in recovering
from a malicious (or even buggy) Coreboot, but it does seem like an area
of improvement.
Brian
>
> Guenter
>
> > On Thu, Dec 29, 2022 at 11:46 AM Paul Menzel <pmenzel@molgen.mpg.de> wrote:
> > >
> > > Dear Linux folks,
> > >
> > >
> > > Running Linux v6.2-rc1+ on a motherboard using coreboot as firmware, the
> > > warning below is shown.
> > >
> > > ```
> > > [ 1.630244] ------------[ cut here ]------------
> > > [ 1.630249] memcpy: detected field-spanning write (size 168) of
> > > single field "&device->entry" at
> > > drivers/firmware/google/coreboot_table.c:103 (size 8)
> > > [ 1.630299] WARNING: CPU: 1 PID: 150 at
> > > drivers/firmware/google/coreboot_table.c:103
> > > coreboot_table_probe+0x1ea/0x210 [coreboot_table]
[...]
next prev parent reply other threads:[~2023-01-03 19:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-29 10:46 memcpy: detected field-spanning write (size 168) of single field "&device->entry" at drivers/firmware/google/coreboot_table.c:103 (size 8) Paul Menzel
2022-12-29 14:43 ` Julius Werner
2022-12-29 20:28 ` Guenter Roeck
2023-01-03 19:31 ` Brian Norris [this message]
2023-01-03 22:56 ` Kees Cook
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=Y7SCdrL+xZm5CSjy@google.com \
--to=briannorris@chromium.org \
--cc=coreboot@coreboot.org \
--cc=gregkh@linuxfoundation.org \
--cc=groeck@chromium.org \
--cc=groeck@google.com \
--cc=jrosenth@chromium.org \
--cc=jwerner@chromium.org \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pmenzel@molgen.mpg.de \
--cc=swboyd@chromium.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox