]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.15-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Dec 2023 16:07:57 +0000 (17:07 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Dec 2023 16:07:57 +0000 (17:07 +0100)
added patches:
kasan-disable-kasan_non_canonical_hook-for-hw-tags.patch

queue-5.15/kasan-disable-kasan_non_canonical_hook-for-hw-tags.patch [new file with mode: 0644]
queue-5.15/series

diff --git a/queue-5.15/kasan-disable-kasan_non_canonical_hook-for-hw-tags.patch b/queue-5.15/kasan-disable-kasan_non_canonical_hook-for-hw-tags.patch
new file mode 100644 (file)
index 0000000..c899b38
--- /dev/null
@@ -0,0 +1,79 @@
+From 17c17567fe510857b18fe01b7a88027600e76ac6 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Mon, 16 Oct 2023 22:08:38 +0200
+Subject: kasan: disable kasan_non_canonical_hook() for HW tags
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 17c17567fe510857b18fe01b7a88027600e76ac6 upstream.
+
+On arm64, building with CONFIG_KASAN_HW_TAGS now causes a compile-time
+error:
+
+mm/kasan/report.c: In function 'kasan_non_canonical_hook':
+mm/kasan/report.c:637:20: error: 'KASAN_SHADOW_OFFSET' undeclared (first use in this function)
+  637 |         if (addr < KASAN_SHADOW_OFFSET)
+      |                    ^~~~~~~~~~~~~~~~~~~
+mm/kasan/report.c:637:20: note: each undeclared identifier is reported only once for each function it appears in
+mm/kasan/report.c:640:77: error: expected expression before ';' token
+  640 |         orig_addr = (addr - KASAN_SHADOW_OFFSET) << KASAN_SHADOW_SCALE_SHIFT;
+
+This was caused by removing the dependency on CONFIG_KASAN_INLINE that
+used to prevent this from happening. Use the more specific dependency
+on KASAN_SW_TAGS || KASAN_GENERIC to only ignore the function for hwasan
+mode.
+
+Link: https://lkml.kernel.org/r/20231016200925.984439-1-arnd@kernel.org
+Fixes: 12ec6a919b0f ("kasan: print the original fault addr when access invalid shadow")
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Cc: Alexander Potapenko <glider@google.com>
+Cc: Andrey Konovalov <andreyknvl@gmail.com>
+Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
+Cc: Dmitry Vyukov <dvyukov@google.com>
+Cc: Haibo Li <haibo.li@mediatek.com>
+Cc: Kees Cook <keescook@chromium.org>
+Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
+Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
+Cc: Matthias Brugger <matthias.bgg@gmail.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ include/linux/kasan.h |    6 +++---
+ mm/kasan/report.c     |    4 +++-
+ 2 files changed, 6 insertions(+), 4 deletions(-)
+
+--- a/include/linux/kasan.h
++++ b/include/linux/kasan.h
+@@ -471,10 +471,10 @@ static inline void kasan_free_shadow(con
+ #endif /* (CONFIG_KASAN_GENERIC || CONFIG_KASAN_SW_TAGS) && !CONFIG_KASAN_VMALLOC */
+-#ifdef CONFIG_KASAN
++#if defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS)
+ void kasan_non_canonical_hook(unsigned long addr);
+-#else /* CONFIG_KASAN */
++#else /* CONFIG_KASAN_GENERIC || CONFIG_KASAN_SW_TAGS */
+ static inline void kasan_non_canonical_hook(unsigned long addr) { }
+-#endif /* CONFIG_KASAN */
++#endif /* CONFIG_KASAN_GENERIC || CONFIG_KASAN_SW_TAGS */
+ #endif /* LINUX_KASAN_H */
+--- a/mm/kasan/report.c
++++ b/mm/kasan/report.c
+@@ -457,8 +457,9 @@ bool kasan_report(unsigned long addr, si
+       return ret;
+ }
++#if defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS)
+ /*
+- * With CONFIG_KASAN, accesses to bogus pointers (outside the high
++ * With CONFIG_KASAN_INLINE, accesses to bogus pointers (outside the high
+  * canonical half of the address space) cause out-of-bounds shadow memory reads
+  * before the actual access. For addresses in the low canonical half of the
+  * address space, as well as most non-canonical addresses, that out-of-bounds
+@@ -494,3 +495,4 @@ void kasan_non_canonical_hook(unsigned l
+       pr_alert("KASAN: %s in range [0x%016lx-0x%016lx]\n", bug_type,
+                orig_addr, orig_addr + KASAN_GRANULE_SIZE - 1);
+ }
++#endif
index 0e536a8ad16569f3455a0941e36161bd20928202..23b2a44a42d5054badb1bb9186c2bb557db8912a 100644 (file)
@@ -156,3 +156,4 @@ revert-drm-bridge-lt9611uxc-fix-the-race-in-the-error-path.patch
 revert-drm-bridge-lt9611uxc-register-and-attach-our-dsi-device-at-probe.patch
 revert-drm-bridge-lt9611uxc-switch-to-devm-mipi-dsi-helpers.patch
 tracing-kprobes-return-eaddrnotavail-when-func-matches-several-symbols.patch
+kasan-disable-kasan_non_canonical_hook-for-hw-tags.patch