Back to home page

LXR

 
 

    


0001 ifdef CONFIG_KASAN
0002 ifdef CONFIG_KASAN_INLINE
0003         call_threshold := 10000
0004 else
0005         call_threshold := 0
0006 endif
0007 
0008 KASAN_SHADOW_OFFSET ?= $(CONFIG_KASAN_SHADOW_OFFSET)
0009 
0010 CFLAGS_KASAN_MINIMAL := -fsanitize=kernel-address
0011 
0012 CFLAGS_KASAN := $(call cc-option, -fsanitize=kernel-address \
0013                 -fasan-shadow-offset=$(KASAN_SHADOW_OFFSET) \
0014                 --param asan-stack=1 --param asan-globals=1 \
0015                 --param asan-instrumentation-with-call-threshold=$(call_threshold))
0016 
0017 ifeq ($(call cc-option, $(CFLAGS_KASAN_MINIMAL) -Werror),)
0018    ifneq ($(CONFIG_COMPILE_TEST),y)
0019         $(warning Cannot use CONFIG_KASAN: \
0020             -fsanitize=kernel-address is not supported by compiler)
0021    endif
0022 else
0023     ifeq ($(CFLAGS_KASAN),)
0024         ifneq ($(CONFIG_COMPILE_TEST),y)
0025             $(warning CONFIG_KASAN: compiler does not support all options.\
0026                 Trying minimal configuration)
0027         endif
0028         CFLAGS_KASAN := $(CFLAGS_KASAN_MINIMAL)
0029     endif
0030 endif
0031 
0032 CFLAGS_KASAN += $(call cc-option, -fsanitize-address-use-after-scope)
0033 endif