lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANpmjNOf94nQL8YVr94L=9qXA6eHcm-AxbS+vz+Sm1aHJT2iAQ@mail.gmail.com>
Date: Tue, 22 Oct 2024 23:42:40 +0200
From: Marco Elver <elver@...gle.com>
To: Andrew Pinski <pinskia@...il.com>
Cc: Will Deacon <will@...nel.org>, Andrey Ryabinin <ryabinin.a.a@...il.com>, 
	Alexander Potapenko <glider@...gle.com>, Andrey Konovalov <andreyknvl@...il.com>, 
	Dmitry Vyukov <dvyukov@...gle.com>, Vincenzo Frascino <vincenzo.frascino@....com>, 
	Mark Rutland <mark.rutland@....com>, linux-kernel@...r.kernel.org, 
	kasan-dev@...glegroups.com, llvm@...ts.linux.dev, 
	syzbot+908886656a02769af987@...kaller.appspotmail.com, 
	"Andrew Pinski (QUIC)" <quic_apinski@...cinc.com>
Subject: Re: [PATCH 1/2] kasan: Fix Software Tag-Based KASAN with GCC

On Mon, 21 Oct 2024 at 19:29, Andrew Pinski <pinskia@...il.com> wrote:
>
> On Mon, Oct 21, 2024 at 10:21 AM Will Deacon <will@...nel.org> wrote:
> >
> > On Mon, Oct 21, 2024 at 02:00:10PM +0200, Marco Elver wrote:
> > > Per [1], -fsanitize=kernel-hwaddress with GCC currently does not disable
> > > instrumentation in functions with __attribute__((no_sanitize_address)).
> > >
> > > However, __attribute__((no_sanitize("hwaddress"))) does correctly
> > > disable instrumentation. Use it instead.
> > >
> > > Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117196 [1]
> > > Link: https://lore.kernel.org/r/000000000000f362e80620e27859@google.com
> > > Link: https://lore.kernel.org/r/ZvFGwKfoC4yVjN_X@J2N7QTR9R3
> > > Link: https://bugzilla.kernel.org/show_bug.cgi?id=218854
> > > Reported-by: syzbot+908886656a02769af987@...kaller.appspotmail.com
> > > Tested-by: Andrey Konovalov <andreyknvl@...il.com>
> > > Cc: Andrew Pinski <pinskia@...il.com>
> > > Cc: Mark Rutland <mark.rutland@....com>
> > > Cc: Will Deacon <will@...nel.org>
> > > Signed-off-by: Marco Elver <elver@...gle.com>
> > > ---
> > >  include/linux/compiler-gcc.h | 4 ++++
> > >  1 file changed, 4 insertions(+)
> > >
> > > diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
> > > index f805adaa316e..cd6f9aae311f 100644
> > > --- a/include/linux/compiler-gcc.h
> > > +++ b/include/linux/compiler-gcc.h
> > > @@ -80,7 +80,11 @@
> > >  #define __noscs __attribute__((__no_sanitize__("shadow-call-stack")))
> > >  #endif
> > >
> > > +#ifdef __SANITIZE_HWADDRESS__
> > > +#define __no_sanitize_address __attribute__((__no_sanitize__("hwaddress")))
> > > +#else
> > >  #define __no_sanitize_address __attribute__((__no_sanitize_address__))
> > > +#endif
> >
> > Does this work correctly for all versions of GCC that support
> > -fsanitize=kernel-hwaddress?
>
> Yes, tested from GCC 11+, kernel-hwaddress was added in GCC 11.
> Also tested from clang 9.0+ and it works there too.

+1 yes. From what I can tell GCC always supported
no_sanitize("hwaddress") for -fsanitize=kernel-hwaddress.

Even for Clang, we define __no_sanitize_address to include
no_sanitize("hwaddress"):
https://elixir.bootlin.com/linux/v6.11.4/source/include/linux/compiler-clang.h#L29

So this has just been an oversight when GCC support for KASAN_SW_TAGS
was introduced.

Having a Fixes tag for this would be nice, but I don't think we
explicitly added GCC support, and instead just relied on
CC_HAS_KASAN_SW_TAGS with cc-option telling us if the flag is
supported.

But maybe we can use this:

Fixes: 7b861a53e46b ("kasan: Bump required compiler version")

Because it's the first time we encountered issues with no_sanitize,
and bumped the required GCC version as a result. Perhaps going along
with that should have been fixing of compiler-gcc.h's definition of
__no_sanitize_address.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ