public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Arnd Bergmann <arnd@arndb.de>,
	Jiri Prchal <jiri.prchal@aksignal.cz>,
	Andy Shevchenko <andy.shevchenko@gmail.com>,
	Ralph Siemsen <ralph.siemsen@linaro.org>,
	Mark Brown <broonie@kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-hardening@vger.kernel.org
Subject: Re: [PATCH 5.17-rc1 v2] eeprom: at25: Restore missing allocation
Date: Tue, 25 Jan 2022 09:43:29 -0800	[thread overview]
Message-ID: <202201250943.A28F4346@keescook> (raw)
In-Reply-To: <CAMuHMdXzEWN7B122ca279t4RPSSWGL29jzTgMdSoJ+Y56jEQYw@mail.gmail.com>

On Tue, Jan 25, 2022 at 04:25:39PM +0100, Geert Uytterhoeven wrote:
> On Tue, Jan 25, 2022 at 3:20 PM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> > On Fri, Jan 21, 2022 at 12:33 AM Kees Cook <keescook@chromium.org> wrote:
> > > The at25 driver regressed in v5.17-rc1 due to a broken conflict
> > > resolution: the allocation of the object was accidentally removed. Restore
> > > it.
> > >
> > > This was found when building under CONFIG_FORTIFY_SOURCE=y and
> > > -Warray-bounds, which complained about strncpy() being used against an
> > > empty object:
> > >
> > > In function 'strncpy',
> > >     inlined from 'at25_fw_to_chip.constprop' at drivers/misc/eeprom/at25.c:312:2:
> > > ./include/linux/fortify-string.h:48:33: warning: '__builtin_strncpy' offset [0, 9] is out of the bounds [0, 0] [-Warray-bounds]
> > >    48 | #define __underlying_strncpy    __builtin_strncpy
> > >       |                                 ^
> > > ./include/linux/fortify-string.h:59:16: note: in expansion of macro '__underlying_strncpy'
> > >    59 |         return __underlying_strncpy(p, q, size);
> > >       |                ^~~~~~~~~~~~~~~~~~~~
> > > In function 'strncpy',
> > >     inlined from 'at25_fram_to_chip' at drivers/misc/eeprom/at25.c:373:2,
> > >     inlined from 'at25_probe' at drivers/misc/eeprom/at25.c:453:10:
> > > ./include/linux/fortify-string.h:48:33: warning: '__builtin_strncpy' offset [0, 9] is out of the bounds [0, 0] [-Warray-bounds]
> > >    48 | #define __underlying_strncpy    __builtin_strncpy
> > >       |                                 ^
> > > ./include/linux/fortify-string.h:59:16: note: in expansion of macro '__underlying_strncpy'
> > >    59 |         return __underlying_strncpy(p, q, size);
> > >       |                ^~~~~~~~~~~~~~~~~~~~
> >
> > On real hardware:
> >
> >     Unable to handle kernel access to user memory outside uaccess
> > routines at virtual address 0000000000000028
> >     ...
> >     pc : __mutex_init+0x20/0x68
> >     lr : at25_probe+0x8c/0x4d8
> 
> To avoid confusion: of course the crash happens only without Kees'
> patch.  I just wanted to point out what happens when you boot on
> real hardware, as it might be worthwhile to add that to the commit
> description.

Okay, whew. :)


-- 
Kees Cook

      reply	other threads:[~2022-01-25 17:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-18 18:20 [PATCH 5.17-rc1 v2] eeprom: at25: Restore missing allocation Kees Cook
2022-01-25 14:20 ` Geert Uytterhoeven
2022-01-25 15:25   ` Geert Uytterhoeven
2022-01-25 17:43     ` Kees Cook [this message]

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=202201250943.A28F4346@keescook \
    --to=keescook@chromium.org \
    --cc=andy.shevchenko@gmail.com \
    --cc=arnd@arndb.de \
    --cc=broonie@kernel.org \
    --cc=geert@linux-m68k.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jiri.prchal@aksignal.cz \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ralph.siemsen@linaro.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