]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - scripts/Makefile.kasan
x86/msr-index: Cleanup bit defines
[mirror_ubuntu-bionic-kernel.git] / scripts / Makefile.kasan
CommitLineData
b2441318 1# SPDX-License-Identifier: GPL-2.0
0b24becc
AR
2ifdef CONFIG_KASAN
3ifdef CONFIG_KASAN_INLINE
4 call_threshold := 10000
5else
6 call_threshold := 0
7endif
8
39d114dd
AR
9KASAN_SHADOW_OFFSET ?= $(CONFIG_KASAN_SHADOW_OFFSET)
10
0b24becc
AR
11CFLAGS_KASAN_MINIMAL := -fsanitize=kernel-address
12
13CFLAGS_KASAN := $(call cc-option, -fsanitize=kernel-address \
39d114dd 14 -fasan-shadow-offset=$(KASAN_SHADOW_OFFSET) \
bebf56a1 15 --param asan-stack=1 --param asan-globals=1 \
0b24becc
AR
16 --param asan-instrumentation-with-call-threshold=$(call_threshold))
17
18ifeq ($(call cc-option, $(CFLAGS_KASAN_MINIMAL) -Werror),)
6e54abac 19 ifneq ($(CONFIG_COMPILE_TEST),y)
0b24becc
AR
20 $(warning Cannot use CONFIG_KASAN: \
21 -fsanitize=kernel-address is not supported by compiler)
6e54abac 22 endif
0b24becc
AR
23else
24 ifeq ($(CFLAGS_KASAN),)
6e54abac
AR
25 ifneq ($(CONFIG_COMPILE_TEST),y)
26 $(warning CONFIG_KASAN: compiler does not support all options.\
27 Trying minimal configuration)
28 endif
0b24becc
AR
29 CFLAGS_KASAN := $(CFLAGS_KASAN_MINIMAL)
30 endif
31endif
c5caf21a 32
9aa5a93e 33ifdef CONFIG_KASAN_EXTRA
c5caf21a 34CFLAGS_KASAN += $(call cc-option, -fsanitize-address-use-after-scope)
9aa5a93e 35endif
691cb3fd
AK
36
37CFLAGS_KASAN_NOSANITIZE := -fno-builtin
38
0b24becc 39endif