Kconfig.kasan 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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 && SYSFS) || (SLAB && !DEBUG_SLAB)
  7. select SLUB_DEBUG if SLUB
  8. select CONSTRUCTORS
  9. select STACKDEPOT
  10. help
  11. Enables kernel address sanitizer - runtime memory debugger,
  12. designed to find out-of-bounds accesses and use-after-free bugs.
  13. This is strictly a debugging feature and it requires a gcc version
  14. of 4.9.2 or later. Detection of out of bounds accesses to stack or
  15. global variables requires gcc 5.0 or later.
  16. This feature consumes about 1/8 of available memory and brings about
  17. ~x3 performance slowdown.
  18. For better error detection enable CONFIG_STACKTRACE.
  19. Currently CONFIG_KASAN doesn't work with CONFIG_DEBUG_SLAB
  20. (the resulting kernel does not boot).
  21. config KASAN_EXTRA
  22. bool "KAsan: extra checks"
  23. depends on KASAN && DEBUG_KERNEL && !COMPILE_TEST
  24. help
  25. This enables further checks in the kernel address sanitizer, for now
  26. it only includes the address-use-after-scope check that can lead
  27. to excessive kernel stack usage, frame size warnings and longer
  28. compile time.
  29. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81715 has more
  30. choice
  31. prompt "Instrumentation type"
  32. depends on KASAN
  33. default KASAN_OUTLINE
  34. config KASAN_OUTLINE
  35. bool "Outline instrumentation"
  36. help
  37. Before every memory access compiler insert function call
  38. __asan_load*/__asan_store*. These functions performs check
  39. of shadow memory. This is slower than inline instrumentation,
  40. however it doesn't bloat size of kernel's .text section so
  41. much as inline does.
  42. config KASAN_INLINE
  43. bool "Inline instrumentation"
  44. help
  45. Compiler directly inserts code checking shadow memory before
  46. memory accesses. This is faster than outline (in some workloads
  47. it gives about x2 boost over outline instrumentation), but
  48. make kernel's .text size much bigger.
  49. This requires a gcc version of 5.0 or later.
  50. endchoice
  51. config TEST_KASAN
  52. tristate "Module for testing kasan for bug detection"
  53. depends on m && KASAN
  54. help
  55. This is a test module doing various nasty things like
  56. out of bounds accesses, use after free. It is useful for testing
  57. kernel debugging features like kernel address sanitizer.
  58. endif