mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-27 19:29:37 +00:00
![Marco Elver](/assets/img/avatar_default.png)
commit 33cd65e73a
upstream.
During early boot, while KASAN is not yet initialized, it is possible to
enter reporting code-path and end up in kasan_report().
While uninitialized, the branch there prevents generating any reports,
however, under certain circumstances when branches are being traced
(TRACE_BRANCH_PROFILING), we may recurse deep enough to cause kernel
reboots without warning.
To prevent similar issues in future, we should disable branch tracing
for the core runtime.
[elver@google.com: remove duplicate DISABLE_BRANCH_PROFILING, per Qian Cai]
Link: https://lore.kernel.org/lkml/20200517011732.GE24705@shao2-debian/
Link: http://lkml.kernel.org/r/20200522075207.157349-1-elver@google.com
Reported-by: kernel test robot <rong.a.chen@intel.com>
Signed-off-by: Marco Elver <elver@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Andrey Konovalov <andreyknvl@google.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Qian Cai <cai@lca.pw>
Cc: <stable@vger.kernel.org>
Link: http://lkml.kernel.org/r//20200517011732.GE24705@shao2-debian/
Link: http://lkml.kernel.org/r/20200519182459.87166-1-elver@google.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
24 lines
1.1 KiB
Makefile
24 lines
1.1 KiB
Makefile
# SPDX-License-Identifier: GPL-2.0
|
|
KASAN_SANITIZE := n
|
|
UBSAN_SANITIZE_common.o := n
|
|
UBSAN_SANITIZE_generic.o := n
|
|
UBSAN_SANITIZE_generic_report.o := n
|
|
UBSAN_SANITIZE_tags.o := n
|
|
KCOV_INSTRUMENT := n
|
|
|
|
CFLAGS_REMOVE_common.o = $(CC_FLAGS_FTRACE)
|
|
CFLAGS_REMOVE_generic.o = $(CC_FLAGS_FTRACE)
|
|
CFLAGS_REMOVE_generic_report.o = $(CC_FLAGS_FTRACE)
|
|
CFLAGS_REMOVE_tags.o = $(CC_FLAGS_FTRACE)
|
|
|
|
# Function splitter causes unnecessary splits in __asan_load1/__asan_store1
|
|
# see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63533
|
|
|
|
CFLAGS_common.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) -DDISABLE_BRANCH_PROFILING
|
|
CFLAGS_generic.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) -DDISABLE_BRANCH_PROFILING
|
|
CFLAGS_generic_report.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) -DDISABLE_BRANCH_PROFILING
|
|
CFLAGS_tags.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) -DDISABLE_BRANCH_PROFILING
|
|
|
|
obj-$(CONFIG_KASAN) := common.o init.o report.o
|
|
obj-$(CONFIG_KASAN_GENERIC) += generic.o generic_report.o quarantine.o
|
|
obj-$(CONFIG_KASAN_SW_TAGS) += tags.o tags_report.o
|