Makefile.kasan 887 B

123456789101112131415161718192021222324252627282930
  1. ifdef CONFIG_KASAN
  2. ifdef CONFIG_KASAN_INLINE
  3. call_threshold := 10000
  4. else
  5. call_threshold := 0
  6. endif
  7. CFLAGS_KASAN_MINIMAL := -fsanitize=kernel-address
  8. CFLAGS_KASAN := $(call cc-option, -fsanitize=kernel-address \
  9. -fasan-shadow-offset=$(CONFIG_KASAN_SHADOW_OFFSET) \
  10. --param asan-stack=1 --param asan-globals=1 \
  11. --param asan-instrumentation-with-call-threshold=$(call_threshold))
  12. ifeq ($(call cc-option, $(CFLAGS_KASAN_MINIMAL) -Werror),)
  13. ifneq ($(CONFIG_COMPILE_TEST),y)
  14. $(warning Cannot use CONFIG_KASAN: \
  15. -fsanitize=kernel-address is not supported by compiler)
  16. endif
  17. else
  18. ifeq ($(CFLAGS_KASAN),)
  19. ifneq ($(CONFIG_COMPILE_TEST),y)
  20. $(warning CONFIG_KASAN: compiler does not support all options.\
  21. Trying minimal configuration)
  22. endif
  23. CFLAGS_KASAN := $(CFLAGS_KASAN_MINIMAL)
  24. endif
  25. endif
  26. endif