Commit 02c58773 authored by Walter Wu's avatar Walter Wu Committed by Linus Torvalds
Browse files

kasan: remove redundant config option

CONFIG_KASAN_STACK and CONFIG_KASAN_STACK_ENABLE both enable KASAN stack
instrumentation, but we should only need one config, so that we remove
CONFIG_KASAN_STACK_ENABLE and make CONFIG_KASAN_STACK workable.  see [1].

When enable KASAN stack instrumentation, then for gcc we could do no
prompt and default value y, and for clang prompt and default value n.

This patch fixes the following compilation warning:

  include/linux/kasan.h:333:30: warning: 'CONFIG_KASAN_STACK' is not defined, evaluates to 0 [-Wundef]

[akpm@linux-foundation.org: fix merge snafu]

Link: https://bugzilla.kernel.org/show_bug.cgi?id=210221 [1]
Link: https://lkml.kernel.org/r/20210226012531.29231-1-walter-zh.wu@mediatek.com


Fixes: d9b571c8 ("kasan: fix KASAN_STACK dependency for HW_TAGS")
Signed-off-by: default avatarWalter Wu <walter-zh.wu@mediatek.com>
Suggested-by: default avatarDmitry Vyukov <dvyukov@google.com>
Reviewed-by: default avatarNathan Chancellor <natechancellor@gmail.com>
Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
Reviewed-by: default avatarAndrey Konovalov <andreyknvl@google.com>
Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 5c595ac4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -134,7 +134,7 @@ SYM_FUNC_START(_cpu_resume)
	 */
	bl	cpu_do_resume

#if defined(CONFIG_KASAN) && CONFIG_KASAN_STACK
#if defined(CONFIG_KASAN) && defined(CONFIG_KASAN_STACK)
	mov	x0, sp
	bl	kasan_unpoison_task_stack_below
#endif
+1 −1
Original line number Diff line number Diff line
@@ -115,7 +115,7 @@ SYM_FUNC_START(do_suspend_lowlevel)
	movq	pt_regs_r14(%rax), %r14
	movq	pt_regs_r15(%rax), %r15

#if defined(CONFIG_KASAN) && CONFIG_KASAN_STACK
#if defined(CONFIG_KASAN) && defined(CONFIG_KASAN_STACK)
	/*
	 * The suspend path may have poisoned some areas deeper in the stack,
	 * which we now need to unpoison.
+1 −1
Original line number Diff line number Diff line
@@ -330,7 +330,7 @@ static inline bool kasan_check_byte(const void *address)

#endif /* CONFIG_KASAN */

#if defined(CONFIG_KASAN) && CONFIG_KASAN_STACK
#if defined(CONFIG_KASAN) && defined(CONFIG_KASAN_STACK)
void kasan_unpoison_task_stack(struct task_struct *task);
#else
static inline void kasan_unpoison_task_stack(struct task_struct *task) {}
+2 −7
Original line number Diff line number Diff line
@@ -138,9 +138,10 @@ config KASAN_INLINE

endchoice

config KASAN_STACK_ENABLE
config KASAN_STACK
	bool "Enable stack instrumentation (unsafe)" if CC_IS_CLANG && !COMPILE_TEST
	depends on KASAN_GENERIC || KASAN_SW_TAGS
	default y if CC_IS_GCC
	help
	  The LLVM stack address sanitizer has a know problem that
	  causes excessive stack usage in a lot of functions, see
@@ -154,12 +155,6 @@ config KASAN_STACK_ENABLE
	  CONFIG_COMPILE_TEST.	On gcc it is assumed to always be safe
	  to use and enabled by default.

config KASAN_STACK
	int
	depends on KASAN_GENERIC || KASAN_SW_TAGS
	default 1 if KASAN_STACK_ENABLE || CC_IS_GCC
	default 0

config KASAN_SW_TAGS_IDENTIFY
	bool "Enable memory corruption identification"
	depends on KASAN_SW_TAGS
+1 −1
Original line number Diff line number Diff line
@@ -63,7 +63,7 @@ void __kasan_unpoison_range(const void *address, size_t size)
	kasan_unpoison(address, size);
}

#if CONFIG_KASAN_STACK
#ifdef CONFIG_KASAN_STACK
/* Unpoison the entire stack for a task. */
void kasan_unpoison_task_stack(struct task_struct *task)
{
Loading