From: Kees Cook <keescook@chromium.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>,
Arnd Bergmann <arnd@kernel.org>,
linux-hardening@vger.kernel.org, Kees Cook <keescook@chomium.org>,
Andrey Ryabinin <ryabinin.a.a@gmail.com>,
Alexander Potapenko <glider@google.com>,
Andrey Konovalov <andreyknvl@gmail.com>,
Dmitry Vyukov <dvyukov@google.com>,
kasan-dev@googlegroups.com, Arnd Bergmann <arnd@arndb.de>,
Marco Elver <elver@google.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Peter Collingbourne <pcc@google.com>,
Patricia Alfonso <trishalfonso@google.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] kasan: test: use underlying string helpers
Date: Thu, 28 Oct 2021 13:42:07 -0700 [thread overview]
Message-ID: <202110281341.8479EC4759@keescook> (raw)
In-Reply-To: <20211028131526.d63d1074a8faa20e1de5e209@linux-foundation.org>
On Thu, Oct 28, 2021 at 01:15:26PM -0700, Andrew Morton wrote:
> On Thu, 14 Oct 2021 19:40:45 -0700 Kees Cook <keescook@chromium.org> wrote:
>
> >
> >
> > On October 14, 2021 1:12:54 AM PDT, Vincenzo Frascino <vincenzo.frascino@arm.com> wrote:
> > >
> > >
> > >On 10/13/21 5:00 PM, Arnd Bergmann wrote:
> > >> From: Arnd Bergmann <arnd@arndb.de>
> > >>
> > >> Calling memcmp() and memchr() with an intentional buffer overflow
> > >> is now caught at compile time:
> > >>
> > >> In function 'memcmp',
> > >> inlined from 'kasan_memcmp' at lib/test_kasan.c:897:2:
> > >> include/linux/fortify-string.h:263:25: error: call to '__read_overflow' declared with attribute error: detected read beyond size of object (1st parameter)
> > >> 263 | __read_overflow();
> > >> | ^~~~~~~~~~~~~~~~~
> > >> In function 'memchr',
> > >> inlined from 'kasan_memchr' at lib/test_kasan.c:872:2:
> > >> include/linux/fortify-string.h:277:17: error: call to '__read_overflow' declared with attribute error: detected read beyond size of object (1st parameter)
> > >> 277 | __read_overflow();
> > >> | ^~~~~~~~~~~~~~~~~
> > >>
> > >> Change the kasan tests to wrap those inside of a noinline function
> > >> to prevent the compiler from noticing the bug and let kasan find
> > >> it at runtime.
> > >>
> > >> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > >
> > >Reviewed-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
> >
> > How about just explicitly making the size invisible to the compiler?
> >
> > I did this for similar issues in the same source:
> >
> > https://lore.kernel.org/linux-hardening/20211006181544.1670992-1-keescook@chromium.org/T/#u
This is already fixed in your tree with:
"kasan: test: consolidate workarounds for unwanted __alloc_size() protection"
which was based on this original patch (and my comments).
--
Kees Cook
next prev parent reply other threads:[~2021-10-28 20:42 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-13 15:00 [PATCH 1/2] kasan: test: use underlying string helpers Arnd Bergmann
2021-10-13 15:00 ` [PATCH 2/2] kasan: use fortified strings for hwaddress sanitizer Arnd Bergmann
2021-10-18 19:57 ` Kees Cook
2021-10-18 20:09 ` Arnd Bergmann
2021-10-14 8:12 ` [PATCH 1/2] kasan: test: use underlying string helpers Vincenzo Frascino
2021-10-15 2:40 ` Kees Cook
2021-10-28 20:15 ` Andrew Morton
2021-10-28 20:42 ` Kees Cook [this message]
2021-10-18 19:47 ` Kees Cook
2021-10-18 19:55 ` Arnd Bergmann
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=202110281341.8479EC4759@keescook \
--to=keescook@chromium.org \
--cc=akpm@linux-foundation.org \
--cc=andreyknvl@gmail.com \
--cc=arnd@arndb.de \
--cc=arnd@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=dvyukov@google.com \
--cc=elver@google.com \
--cc=glider@google.com \
--cc=kasan-dev@googlegroups.com \
--cc=keescook@chomium.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pcc@google.com \
--cc=ryabinin.a.a@gmail.com \
--cc=trishalfonso@google.com \
--cc=vincenzo.frascino@arm.com \
/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.