mirror of
https://github.com/torvalds/linux.git
synced 2026-06-06 21:45:45 +02:00
Revert "BACKPORT: kasan: remove redundant config option"
This reverts commit 13aefe4bf8.
That commit might lead to stack overflows with x86 KASAN with stack
instrumentation enabled and has been dropped from the mm tree.
Revert the change for now.
Bug: 172318110
Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Change-Id: I5020ec2361d5f9976d0666e0c1ed6925e29fa5b2
This commit is contained in:
parent
49301bae6a
commit
c0a166c983
|
|
@ -134,7 +134,7 @@ SYM_FUNC_START(_cpu_resume)
|
|||
*/
|
||||
bl cpu_do_resume
|
||||
|
||||
#if defined(CONFIG_KASAN) && defined(CONFIG_KASAN_STACK)
|
||||
#if defined(CONFIG_KASAN) && CONFIG_KASAN_STACK
|
||||
mov x0, sp
|
||||
bl kasan_unpoison_task_stack_below
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ SYM_FUNC_START(do_suspend_lowlevel)
|
|||
movq pt_regs_r14(%rax), %r14
|
||||
movq pt_regs_r15(%rax), %r15
|
||||
|
||||
#if defined(CONFIG_KASAN) && defined(CONFIG_KASAN_STACK)
|
||||
#if defined(CONFIG_KASAN) && CONFIG_KASAN_STACK
|
||||
/*
|
||||
* The suspend path may have poisoned some areas deeper in the stack,
|
||||
* which we now need to unpoison.
|
||||
|
|
|
|||
|
|
@ -330,7 +330,7 @@ static inline bool kasan_check_byte(const void *address)
|
|||
|
||||
#endif /* CONFIG_KASAN */
|
||||
|
||||
#if defined(CONFIG_KASAN) && defined(CONFIG_KASAN_STACK)
|
||||
#if defined(CONFIG_KASAN) && CONFIG_KASAN_STACK
|
||||
void kasan_unpoison_task_stack(struct task_struct *task);
|
||||
#else
|
||||
static inline void kasan_unpoison_task_stack(struct task_struct *task) {}
|
||||
|
|
|
|||
|
|
@ -138,10 +138,9 @@ config KASAN_INLINE
|
|||
|
||||
endchoice
|
||||
|
||||
config KASAN_STACK
|
||||
config KASAN_STACK_ENABLE
|
||||
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
|
||||
|
|
@ -155,6 +154,20 @@ config KASAN_STACK
|
|||
CONFIG_COMPILE_TEST. On gcc it is assumed to always be safe
|
||||
to use and enabled by default.
|
||||
|
||||
config KASAN_STACK
|
||||
int
|
||||
default 1 if KASAN_STACK_ENABLE || CC_IS_GCC
|
||||
default 0
|
||||
|
||||
config KASAN_S390_4_LEVEL_PAGING
|
||||
bool "KASan: use 4-level paging"
|
||||
depends on S390
|
||||
help
|
||||
Compiling the kernel with KASan disables automatic 3-level vs
|
||||
4-level paging selection. 3-level paging is used by default (up
|
||||
to 3TB of RAM with KASan enabled). This options allows to force
|
||||
4-level paging instead.
|
||||
|
||||
config KASAN_SW_TAGS_IDENTIFY
|
||||
bool "Enable memory corruption identification"
|
||||
depends on KASAN_SW_TAGS
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ void __kasan_unpoison_range(const void *address, size_t size)
|
|||
kasan_unpoison(address, size);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_KASAN_STACK
|
||||
#if CONFIG_KASAN_STACK
|
||||
/* Unpoison the entire stack for a task. */
|
||||
void kasan_unpoison_task_stack(struct task_struct *task)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -231,7 +231,7 @@ void *kasan_find_first_bad_addr(void *addr, size_t size);
|
|||
const char *kasan_get_bug_type(struct kasan_access_info *info);
|
||||
void kasan_metadata_fetch_row(char *buffer, void *row);
|
||||
|
||||
#if defined(CONFIG_KASAN_GENERIC) && defined(CONFIG_KASAN_STACK)
|
||||
#if defined(CONFIG_KASAN_GENERIC) && CONFIG_KASAN_STACK
|
||||
void kasan_print_address_stack_frame(const void *addr);
|
||||
#else
|
||||
static inline void kasan_print_address_stack_frame(const void *addr) { }
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ void kasan_metadata_fetch_row(char *buffer, void *row)
|
|||
memcpy(buffer, kasan_mem_to_shadow(row), META_BYTES_PER_ROW);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_KASAN_STACK
|
||||
#if CONFIG_KASAN_STACK
|
||||
static bool __must_check tokenize_frame_descr(const char **frame_descr,
|
||||
char *token, size_t max_tok_len,
|
||||
unsigned long *value)
|
||||
|
|
|
|||
|
|
@ -2,12 +2,6 @@
|
|||
CFLAGS_KASAN_NOSANITIZE := -fno-builtin
|
||||
KASAN_SHADOW_OFFSET ?= $(CONFIG_KASAN_SHADOW_OFFSET)
|
||||
|
||||
ifdef CONFIG_KASAN_STACK
|
||||
stack_enable := 1
|
||||
else
|
||||
stack_enable := 0
|
||||
endif
|
||||
|
||||
ifdef CONFIG_KASAN_GENERIC
|
||||
|
||||
ifdef CONFIG_KASAN_INLINE
|
||||
|
|
@ -33,7 +27,7 @@ else
|
|||
CFLAGS_KASAN := $(CFLAGS_KASAN_SHADOW) \
|
||||
$(call cc-param,asan-globals=1) \
|
||||
$(call cc-param,asan-instrumentation-with-call-threshold=$(call_threshold)) \
|
||||
$(call cc-param,asan-stack=$(stack_enable)) \
|
||||
$(call cc-param,asan-stack=$(CONFIG_KASAN_STACK)) \
|
||||
$(call cc-param,asan-instrument-allocas=1)
|
||||
endif
|
||||
|
||||
|
|
@ -48,7 +42,7 @@ else
|
|||
endif
|
||||
|
||||
CFLAGS_KASAN := -fsanitize=kernel-hwaddress \
|
||||
-mllvm -hwasan-instrument-stack=$(stack_enable) \
|
||||
-mllvm -hwasan-instrument-stack=$(CONFIG_KASAN_STACK) \
|
||||
-mllvm -hwasan-use-short-granules=0 \
|
||||
$(instrumentation_flags)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user