Kconfig.debug 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394
  1. menu "Kernel hacking"
  2. config TRACE_IRQFLAGS_SUPPORT
  3. def_bool y
  4. source "lib/Kconfig.debug"
  5. config STRICT_DEVMEM
  6. bool "Filter access to /dev/mem"
  7. ---help---
  8. If this option is disabled, you allow userspace (root) access to all
  9. of memory, including kernel and userspace memory. Accidental
  10. access to this is obviously disastrous, but specific access can
  11. be used by people debugging the kernel. Note that with PAT support
  12. enabled, even in this case there are restrictions on /dev/mem
  13. use due to the cache aliasing requirements.
  14. If this option is switched on, the /dev/mem file only allows
  15. userspace access to PCI space and the BIOS code and data regions.
  16. This is sufficient for dosemu and X and all common users of
  17. /dev/mem.
  18. If in doubt, say Y.
  19. config X86_VERBOSE_BOOTUP
  20. bool "Enable verbose x86 bootup info messages"
  21. default y
  22. ---help---
  23. Enables the informational output from the decompression stage
  24. (e.g. bzImage) of the boot. If you disable this you will still
  25. see errors. Disable this if you want silent bootup.
  26. config EARLY_PRINTK
  27. bool "Early printk" if EXPERT
  28. default y
  29. ---help---
  30. Write kernel log output directly into the VGA buffer or to a serial
  31. port.
  32. This is useful for kernel debugging when your machine crashes very
  33. early before the console code is initialized. For normal operation
  34. it is not recommended because it looks ugly and doesn't cooperate
  35. with klogd/syslogd or the X server. You should normally N here,
  36. unless you want to debug such a crash.
  37. config EARLY_PRINTK_DBGP
  38. bool "Early printk via EHCI debug port"
  39. depends on EARLY_PRINTK && PCI
  40. ---help---
  41. Write kernel log output directly into the EHCI debug port.
  42. This is useful for kernel debugging when your machine crashes very
  43. early before the console code is initialized. For normal operation
  44. it is not recommended because it looks ugly and doesn't cooperate
  45. with klogd/syslogd or the X server. You should normally N here,
  46. unless you want to debug such a crash. You need usb debug device.
  47. config EARLY_PRINTK_EFI
  48. bool "Early printk via the EFI framebuffer"
  49. depends on EFI && EARLY_PRINTK
  50. select FONT_SUPPORT
  51. ---help---
  52. Write kernel log output directly into the EFI framebuffer.
  53. This is useful for kernel debugging when your machine crashes very
  54. early before the console code is initialized.
  55. config X86_PTDUMP_CORE
  56. def_bool n
  57. config X86_PTDUMP
  58. bool "Export kernel pagetable layout to userspace via debugfs"
  59. depends on DEBUG_KERNEL
  60. select DEBUG_FS
  61. select X86_PTDUMP_CORE
  62. ---help---
  63. Say Y here if you want to show the kernel pagetable layout in a
  64. debugfs file. This information is only useful for kernel developers
  65. who are working in architecture specific areas of the kernel.
  66. It is probably not a good idea to enable this feature in a production
  67. kernel.
  68. If in doubt, say "N"
  69. config EFI_PGT_DUMP
  70. bool "Dump the EFI pagetable"
  71. depends on EFI
  72. select X86_PTDUMP_CORE
  73. ---help---
  74. Enable this if you want to dump the EFI page table before
  75. enabling virtual mode. This can be used to debug miscellaneous
  76. issues with the mapping of the EFI runtime regions into that
  77. table.
  78. config DEBUG_RODATA
  79. bool "Write protect kernel read-only data structures"
  80. default y
  81. depends on DEBUG_KERNEL
  82. ---help---
  83. Mark the kernel read-only data as write-protected in the pagetables,
  84. in order to catch accidental (and incorrect) writes to such const
  85. data. This is recommended so that we can catch kernel bugs sooner.
  86. If in doubt, say "Y".
  87. config DEBUG_RODATA_TEST
  88. bool "Testcase for the DEBUG_RODATA feature"
  89. depends on DEBUG_RODATA
  90. default y
  91. ---help---
  92. This option enables a testcase for the DEBUG_RODATA
  93. feature as well as for the change_page_attr() infrastructure.
  94. If in doubt, say "N"
  95. config DEBUG_WX
  96. bool "Warn on W+X mappings at boot"
  97. depends on DEBUG_RODATA
  98. select X86_PTDUMP_CORE
  99. ---help---
  100. Generate a warning if any W+X mappings are found at boot.
  101. This is useful for discovering cases where the kernel is leaving
  102. W+X mappings after applying NX, as such mappings are a security risk.
  103. Look for a message in dmesg output like this:
  104. x86/mm: Checked W+X mappings: passed, no W+X pages found.
  105. or like this, if the check failed:
  106. x86/mm: Checked W+X mappings: FAILED, <N> W+X pages found.
  107. Note that even if the check fails, your kernel is possibly
  108. still fine, as W+X mappings are not a security hole in
  109. themselves, what they do is that they make the exploitation
  110. of other unfixed kernel bugs easier.
  111. There is no runtime or memory usage effect of this option
  112. once the kernel has booted up - it's a one time check.
  113. If in doubt, say "Y".
  114. config DEBUG_SET_MODULE_RONX
  115. bool "Set loadable kernel module data as NX and text as RO"
  116. depends on MODULES
  117. ---help---
  118. This option helps catch unintended modifications to loadable
  119. kernel module's text and read-only data. It also prevents execution
  120. of module data. Such protection may interfere with run-time code
  121. patching and dynamic kernel tracing - and they might also protect
  122. against certain classes of kernel exploits.
  123. If in doubt, say "N".
  124. config DEBUG_NX_TEST
  125. tristate "Testcase for the NX non-executable stack feature"
  126. depends on DEBUG_KERNEL && m
  127. ---help---
  128. This option enables a testcase for the CPU NX capability
  129. and the software setup of this feature.
  130. If in doubt, say "N"
  131. config DOUBLEFAULT
  132. default y
  133. bool "Enable doublefault exception handler" if EXPERT
  134. ---help---
  135. This option allows trapping of rare doublefault exceptions that
  136. would otherwise cause a system to silently reboot. Disabling this
  137. option saves about 4k and might cause you much additional grey
  138. hair.
  139. config DEBUG_TLBFLUSH
  140. bool "Set upper limit of TLB entries to flush one-by-one"
  141. depends on DEBUG_KERNEL
  142. ---help---
  143. X86-only for now.
  144. This option allows the user to tune the amount of TLB entries the
  145. kernel flushes one-by-one instead of doing a full TLB flush. In
  146. certain situations, the former is cheaper. This is controlled by the
  147. tlb_flushall_shift knob under /sys/kernel/debug/x86. If you set it
  148. to -1, the code flushes the whole TLB unconditionally. Otherwise,
  149. for positive values of it, the kernel will use single TLB entry
  150. invalidating instructions according to the following formula:
  151. flush_entries <= active_tlb_entries / 2^tlb_flushall_shift
  152. If in doubt, say "N".
  153. config IOMMU_DEBUG
  154. bool "Enable IOMMU debugging"
  155. depends on GART_IOMMU && DEBUG_KERNEL
  156. depends on X86_64
  157. ---help---
  158. Force the IOMMU to on even when you have less than 4GB of
  159. memory and add debugging code. On overflow always panic. And
  160. allow to enable IOMMU leak tracing. Can be disabled at boot
  161. time with iommu=noforce. This will also enable scatter gather
  162. list merging. Currently not recommended for production
  163. code. When you use it make sure you have a big enough
  164. IOMMU/AGP aperture. Most of the options enabled by this can
  165. be set more finegrained using the iommu= command line
  166. options. See Documentation/x86/x86_64/boot-options.txt for more
  167. details.
  168. config IOMMU_STRESS
  169. bool "Enable IOMMU stress-test mode"
  170. ---help---
  171. This option disables various optimizations in IOMMU related
  172. code to do real stress testing of the IOMMU code. This option
  173. will cause a performance drop and should only be enabled for
  174. testing.
  175. config IOMMU_LEAK
  176. bool "IOMMU leak tracing"
  177. depends on IOMMU_DEBUG && DMA_API_DEBUG
  178. ---help---
  179. Add a simple leak tracer to the IOMMU code. This is useful when you
  180. are debugging a buggy device driver that leaks IOMMU mappings.
  181. config HAVE_MMIOTRACE_SUPPORT
  182. def_bool y
  183. config X86_DECODER_SELFTEST
  184. bool "x86 instruction decoder selftest"
  185. depends on DEBUG_KERNEL && KPROBES
  186. depends on !COMPILE_TEST
  187. ---help---
  188. Perform x86 instruction decoder selftests at build time.
  189. This option is useful for checking the sanity of x86 instruction
  190. decoder code.
  191. If unsure, say "N".
  192. #
  193. # IO delay types:
  194. #
  195. config IO_DELAY_TYPE_0X80
  196. int
  197. default "0"
  198. config IO_DELAY_TYPE_0XED
  199. int
  200. default "1"
  201. config IO_DELAY_TYPE_UDELAY
  202. int
  203. default "2"
  204. config IO_DELAY_TYPE_NONE
  205. int
  206. default "3"
  207. choice
  208. prompt "IO delay type"
  209. default IO_DELAY_0X80
  210. config IO_DELAY_0X80
  211. bool "port 0x80 based port-IO delay [recommended]"
  212. ---help---
  213. This is the traditional Linux IO delay used for in/out_p.
  214. It is the most tested hence safest selection here.
  215. config IO_DELAY_0XED
  216. bool "port 0xed based port-IO delay"
  217. ---help---
  218. Use port 0xed as the IO delay. This frees up port 0x80 which is
  219. often used as a hardware-debug port.
  220. config IO_DELAY_UDELAY
  221. bool "udelay based port-IO delay"
  222. ---help---
  223. Use udelay(2) as the IO delay method. This provides the delay
  224. while not having any side-effect on the IO port space.
  225. config IO_DELAY_NONE
  226. bool "no port-IO delay"
  227. ---help---
  228. No port-IO delay. Will break on old boxes that require port-IO
  229. delay for certain operations. Should work on most new machines.
  230. endchoice
  231. if IO_DELAY_0X80
  232. config DEFAULT_IO_DELAY_TYPE
  233. int
  234. default IO_DELAY_TYPE_0X80
  235. endif
  236. if IO_DELAY_0XED
  237. config DEFAULT_IO_DELAY_TYPE
  238. int
  239. default IO_DELAY_TYPE_0XED
  240. endif
  241. if IO_DELAY_UDELAY
  242. config DEFAULT_IO_DELAY_TYPE
  243. int
  244. default IO_DELAY_TYPE_UDELAY
  245. endif
  246. if IO_DELAY_NONE
  247. config DEFAULT_IO_DELAY_TYPE
  248. int
  249. default IO_DELAY_TYPE_NONE
  250. endif
  251. config DEBUG_BOOT_PARAMS
  252. bool "Debug boot parameters"
  253. depends on DEBUG_KERNEL
  254. depends on DEBUG_FS
  255. ---help---
  256. This option will cause struct boot_params to be exported via debugfs.
  257. config CPA_DEBUG
  258. bool "CPA self-test code"
  259. depends on DEBUG_KERNEL
  260. ---help---
  261. Do change_page_attr() self-tests every 30 seconds.
  262. config OPTIMIZE_INLINING
  263. bool "Allow gcc to uninline functions marked 'inline'"
  264. ---help---
  265. This option determines if the kernel forces gcc to inline the functions
  266. developers have marked 'inline'. Doing so takes away freedom from gcc to
  267. do what it thinks is best, which is desirable for the gcc 3.x series of
  268. compilers. The gcc 4.x series have a rewritten inlining algorithm and
  269. enabling this option will generate a smaller kernel there. Hopefully
  270. this algorithm is so good that allowing gcc 4.x and above to make the
  271. decision will become the default in the future. Until then this option
  272. is there to test gcc for this.
  273. If unsure, say N.
  274. config DEBUG_ENTRY
  275. bool "Debug low-level entry code"
  276. depends on DEBUG_KERNEL
  277. ---help---
  278. This option enables sanity checks in x86's low-level entry code.
  279. Some of these sanity checks may slow down kernel entries and
  280. exits or otherwise impact performance.
  281. This is currently used to help test NMI code.
  282. If unsure, say N.
  283. config DEBUG_NMI_SELFTEST
  284. bool "NMI Selftest"
  285. depends on DEBUG_KERNEL && X86_LOCAL_APIC
  286. ---help---
  287. Enabling this option turns on a quick NMI selftest to verify
  288. that the NMI behaves correctly.
  289. This might help diagnose strange hangs that rely on NMI to
  290. function properly.
  291. If unsure, say N.
  292. config DEBUG_IMR_SELFTEST
  293. bool "Isolated Memory Region self test"
  294. default n
  295. depends on INTEL_IMR
  296. ---help---
  297. This option enables automated sanity testing of the IMR code.
  298. Some simple tests are run to verify IMR bounds checking, alignment
  299. and overlapping. This option is really only useful if you are
  300. debugging an IMR memory map or are modifying the IMR code and want to
  301. test your changes.
  302. If unsure say N here.
  303. config X86_DEBUG_FPU
  304. bool "Debug the x86 FPU code"
  305. depends on DEBUG_KERNEL
  306. default y
  307. ---help---
  308. If this option is enabled then there will be extra sanity
  309. checks and (boot time) debug printouts added to the kernel.
  310. This debugging adds some small amount of runtime overhead
  311. to the kernel.
  312. If unsure, say N.
  313. config PUNIT_ATOM_DEBUG
  314. tristate "ATOM Punit debug driver"
  315. depends on PCI
  316. select DEBUG_FS
  317. select IOSF_MBI
  318. ---help---
  319. This is a debug driver, which gets the power states
  320. of all Punit North Complex devices. The power states of
  321. each device is exposed as part of the debugfs interface.
  322. The current power state can be read from
  323. /sys/kernel/debug/punit_atom/dev_power_state
  324. endmenu