Kconfig.kasan 1.8 KB

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