Makefile.kasan 779 B

12345678910111213141516171819202122232425
  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. $(warning Cannot use CONFIG_KASAN: \
  14. -fsanitize=kernel-address is not supported by compiler)
  15. else
  16. ifeq ($(CFLAGS_KASAN),)
  17. $(warning CONFIG_KASAN: compiler does not support all options.\
  18. Trying minimal configuration)
  19. CFLAGS_KASAN := $(CFLAGS_KASAN_MINIMAL)
  20. endif
  21. endif
  22. endif