From bdc373d18535abbe93d7712b943f63c6def9519f Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 3 Nov 2023 13:28:27 +0000 Subject: [PATCH] Revert "kasan: print the original fault addr when access invalid shadow" This reverts commit 632c2199e52d0e957dd47d4c931d60b82cd5ff29 which is commit babddbfb7d7d70ae7f10fedd75a45d8ad75fdddf upstream. It just flat out breaks the build for KASAN builds, so revert it. Odd. Fixes: 1684909df3f4 ("kasan: print the original fault addr when access invalid shadow") Signed-off-by: Greg Kroah-Hartman Change-Id: Ida71f61b6ea32f2682091407144032928891c83e --- include/linux/kasan.h | 6 +++--- mm/kasan/report.c | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/include/linux/kasan.h b/include/linux/kasan.h index 8681eec1c2ca..99dc14b5ad44 100644 --- a/include/linux/kasan.h +++ b/include/linux/kasan.h @@ -456,10 +456,10 @@ static inline void kasan_free_shadow(const struct vm_struct *vm) {} #endif /* (CONFIG_KASAN_GENERIC || CONFIG_KASAN_SW_TAGS) && !CONFIG_KASAN_VMALLOC */ -#ifdef CONFIG_KASAN +#ifdef CONFIG_KASAN_INLINE void kasan_non_canonical_hook(unsigned long addr); -#else /* CONFIG_KASAN */ +#else /* CONFIG_KASAN_INLINE */ static inline void kasan_non_canonical_hook(unsigned long addr) { } -#endif /* CONFIG_KASAN */ +#endif /* CONFIG_KASAN_INLINE */ #endif /* LINUX_KASAN_H */ diff --git a/mm/kasan/report.c b/mm/kasan/report.c index d60342d18a8a..13bdaaccccb2 100644 --- a/mm/kasan/report.c +++ b/mm/kasan/report.c @@ -434,8 +434,9 @@ bool kasan_report(unsigned long addr, size_t size, bool is_write, return ret; } +#ifdef CONFIG_KASAN_INLINE /* - * 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 @@ -471,3 +472,4 @@ void kasan_non_canonical_hook(unsigned long addr) pr_alert("KASAN: %s in range [0x%016lx-0x%016lx]\n", bug_type, orig_addr, orig_addr + KASAN_GRANULE_SIZE - 1); } +#endif