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: <ZxIeVabQQS2aISe5@elver.google.com>
Date: Fri, 18 Oct 2024 10:37:41 +0200
From: Marco Elver <elver@...gle.com>
To: Will Deacon <will@...nel.org>
Cc: linux-arm-kernel@...ts.infradead.org, catalin.marinas@....com,
	kernel-team@...roid.com, linux-kernel@...r.kernel.org,
	ryabinin.a.a@...il.com, glider@...gle.com,
	kasan-dev@...glegroups.com, Andrey Konovalov <andreyknvl@...il.com>,
	Mark Rutland <mark.rutland@....com>,
	syzbot+908886656a02769af987@...kaller.appspotmail.com,
	Andrew Pinski <pinskia@...il.com>
Subject: Re: [PATCH] kasan: Disable Software Tag-Based KASAN with GCC

On Tue, Oct 15, 2024 at 01:39PM +0100, 'Will Deacon' via kasan-dev wrote:
> On Mon, 14 Oct 2024 17:11:00 +0100, Will Deacon wrote:
> > Syzbot reports a KASAN failure early during boot on arm64 when building
> > with GCC 12.2.0 and using the Software Tag-Based KASAN mode:
> > 
> >   | BUG: KASAN: invalid-access in smp_build_mpidr_hash arch/arm64/kernel/setup.c:133 [inline]
> >   | BUG: KASAN: invalid-access in setup_arch+0x984/0xd60 arch/arm64/kernel/setup.c:356
> >   | Write of size 4 at addr 03ff800086867e00 by task swapper/0
> >   | Pointer tag: [03], memory tag: [fe]
> > 
> > [...]
> 
> Applied to arm64 (for-next/fixes), thanks!
> 
> [1/1] kasan: Disable Software Tag-Based KASAN with GCC
>       https://git.kernel.org/arm64/c/7aed6a2c51ff

I do not think this is the right fix. Please see alternative below.
Please do double-check that the observed splat above is fixed with that.

Thanks,
-- Marco

------ >8 ------

>From 23bd83dbff5a9778f34831ed292d5e52b4b0ee18 Mon Sep 17 00:00:00 2001
From: Marco Elver <elver@...gle.com>
Date: Fri, 18 Oct 2024 10:18:24 +0200
Subject: [PATCH] kasan: Fix Software Tag-Based KASAN with GCC

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
Cc: Andrew Pinski <pinskia@...il.com>
Cc: Andrey Konovalov <andreyknvl@...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
 
 #if defined(__SANITIZE_THREAD__)
 #define __no_sanitize_thread __attribute__((__no_sanitize_thread__))
-- 
2.47.0.rc1.288.g06298d1525-goog

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ