Kconfig.kasan 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. config HAVE_ARCH_KASAN
  2. bool
  3. if HAVE_ARCH_KASAN
  4. config KASAN
  5. bool "KASan: runtime memory debugger"
  6. depends on SLUB || (SLAB && !DEBUG_SLAB)
  7. select CONSTRUCTORS
  8. select STACKDEPOT
  9. help
  10. Enables kernel address sanitizer - runtime memory debugger,
  11. designed to find out-of-bounds accesses and use-after-free bugs.
  12. This is strictly a debugging feature and it requires a gcc version
  13. of 4.9.2 or later. Detection of out of bounds accesses to stack or
  14. global variables requires gcc 5.0 or later.
  15. This feature consumes about 1/8 of available memory and brings about
  16. ~x3 performance slowdown.
  17. For better error detection enable CONFIG_STACKTRACE.
  18. Currently CONFIG_KASAN doesn't work with CONFIG_DEBUG_SLAB
  19. (the resulting kernel does not boot).
  20. choice
  21. prompt "Instrumentation type"
  22. depends on KASAN
  23. default KASAN_OUTLINE
  24. config KASAN_OUTLINE
  25. bool "Outline instrumentation"
  26. help
  27. Before every memory access compiler insert function call
  28. __asan_load*/__asan_store*. These functions performs check
  29. of shadow memory. This is slower than inline instrumentation,
  30. however it doesn't bloat size of kernel's .text section so
  31. much as inline does.
  32. config KASAN_INLINE
  33. bool "Inline instrumentation"
  34. help
  35. Compiler directly inserts code checking shadow memory before
  36. memory accesses. This is faster than outline (in some workloads
  37. it gives about x2 boost over outline instrumentation), but
  38. make kernel's .text size much bigger.
  39. This requires a gcc version of 5.0 or later.
  40. endchoice
  41. config TEST_KASAN
  42. tristate "Module for testing kasan for bug detection"
  43. depends on m && KASAN
  44. help
  45. This is a test module doing various nasty things like
  46. out of bounds accesses, use after free. It is useful for testing
  47. kernel debugging features like kernel address sanitizer.
  48. endif