Kconfig.debug 92 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825
  1. # SPDX-License-Identifier: GPL-2.0-only
  2. menu "Kernel hacking"
  3. menu "printk and dmesg options"
  4. config PRINTK_TIME
  5. bool "Show timing information on printks"
  6. depends on PRINTK
  7. help
  8. Selecting this option causes time stamps of the printk()
  9. messages to be added to the output of the syslog() system
  10. call and at the console.
  11. The timestamp is always recorded internally, and exported
  12. to /dev/kmsg. This flag just specifies if the timestamp should
  13. be included, not that the timestamp is recorded.
  14. The behavior is also controlled by the kernel command line
  15. parameter printk.time=1. See Documentation/admin-guide/kernel-parameters.rst
  16. config PRINTK_CALLER
  17. bool "Show caller information on printks"
  18. depends on PRINTK
  19. help
  20. Selecting this option causes printk() to add a caller "thread id" (if
  21. in task context) or a caller "processor id" (if not in task context)
  22. to every message.
  23. This option is intended for environments where multiple threads
  24. concurrently call printk() for many times, for it is difficult to
  25. interpret without knowing where these lines (or sometimes individual
  26. line which was divided into multiple lines due to race) came from.
  27. Since toggling after boot makes the code racy, currently there is
  28. no option to enable/disable at the kernel command line parameter or
  29. sysfs interface.
  30. config STACKTRACE_BUILD_ID
  31. bool "Show build ID information in stacktraces"
  32. depends on PRINTK
  33. help
  34. Selecting this option adds build ID information for symbols in
  35. stacktraces printed with the printk format '%p[SR]b'.
  36. This option is intended for distros where debuginfo is not easily
  37. accessible but can be downloaded given the build ID of the vmlinux or
  38. kernel module where the function is located.
  39. config CONSOLE_LOGLEVEL_DEFAULT
  40. int "Default console loglevel (1-15)"
  41. range 1 15
  42. default "7"
  43. help
  44. Default loglevel to determine what will be printed on the console.
  45. Setting a default here is equivalent to passing in loglevel=<x> in
  46. the kernel bootargs. loglevel=<x> continues to override whatever
  47. value is specified here as well.
  48. Note: This does not affect the log level of un-prefixed printk()
  49. usage in the kernel. That is controlled by the MESSAGE_LOGLEVEL_DEFAULT
  50. option.
  51. config CONSOLE_LOGLEVEL_QUIET
  52. int "quiet console loglevel (1-15)"
  53. range 1 15
  54. default "4"
  55. help
  56. loglevel to use when "quiet" is passed on the kernel commandline.
  57. When "quiet" is passed on the kernel commandline this loglevel
  58. will be used as the loglevel. IOW passing "quiet" will be the
  59. equivalent of passing "loglevel=<CONSOLE_LOGLEVEL_QUIET>"
  60. config MESSAGE_LOGLEVEL_DEFAULT
  61. int "Default message log level (1-7)"
  62. range 1 7
  63. default "4"
  64. help
  65. Default log level for printk statements with no specified priority.
  66. This was hard-coded to KERN_WARNING since at least 2.6.10 but folks
  67. that are auditing their logs closely may want to set it to a lower
  68. priority.
  69. Note: This does not affect what message level gets printed on the console
  70. by default. To change that, use loglevel=<x> in the kernel bootargs,
  71. or pick a different CONSOLE_LOGLEVEL_DEFAULT configuration value.
  72. config BOOT_PRINTK_DELAY
  73. bool "Delay each boot printk message by N milliseconds"
  74. depends on DEBUG_KERNEL && PRINTK && GENERIC_CALIBRATE_DELAY
  75. help
  76. This build option allows you to read kernel boot messages
  77. by inserting a short delay after each one. The delay is
  78. specified in milliseconds on the kernel command line,
  79. using "boot_delay=N".
  80. It is likely that you would also need to use "lpj=M" to preset
  81. the "loops per jiffie" value.
  82. See a previous boot log for the "lpj" value to use for your
  83. system, and then set "lpj=M" before setting "boot_delay=N".
  84. NOTE: Using this option may adversely affect SMP systems.
  85. I.e., processors other than the first one may not boot up.
  86. BOOT_PRINTK_DELAY also may cause LOCKUP_DETECTOR to detect
  87. what it believes to be lockup conditions.
  88. config DYNAMIC_DEBUG
  89. bool "Enable dynamic printk() support"
  90. default n
  91. depends on PRINTK
  92. depends on (DEBUG_FS || PROC_FS)
  93. select DYNAMIC_DEBUG_CORE
  94. help
  95. Compiles debug level messages into the kernel, which would not
  96. otherwise be available at runtime. These messages can then be
  97. enabled/disabled based on various levels of scope - per source file,
  98. function, module, format string, and line number. This mechanism
  99. implicitly compiles in all pr_debug() and dev_dbg() calls, which
  100. enlarges the kernel text size by about 2%.
  101. If a source file is compiled with DEBUG flag set, any
  102. pr_debug() calls in it are enabled by default, but can be
  103. disabled at runtime as below. Note that DEBUG flag is
  104. turned on by many CONFIG_*DEBUG* options.
  105. Usage:
  106. Dynamic debugging is controlled via the 'dynamic_debug/control' file,
  107. which is contained in the 'debugfs' filesystem or procfs.
  108. Thus, the debugfs or procfs filesystem must first be mounted before
  109. making use of this feature.
  110. We refer the control file as: <debugfs>/dynamic_debug/control. This
  111. file contains a list of the debug statements that can be enabled. The
  112. format for each line of the file is:
  113. filename:lineno [module]function flags format
  114. filename : source file of the debug statement
  115. lineno : line number of the debug statement
  116. module : module that contains the debug statement
  117. function : function that contains the debug statement
  118. flags : '=p' means the line is turned 'on' for printing
  119. format : the format used for the debug statement
  120. From a live system:
  121. nullarbor:~ # cat <debugfs>/dynamic_debug/control
  122. # filename:lineno [module]function flags format
  123. fs/aio.c:222 [aio]__put_ioctx =_ "__put_ioctx:\040freeing\040%p\012"
  124. fs/aio.c:248 [aio]ioctx_alloc =_ "ENOMEM:\040nr_events\040too\040high\012"
  125. fs/aio.c:1770 [aio]sys_io_cancel =_ "calling\040cancel\012"
  126. Example usage:
  127. // enable the message at line 1603 of file svcsock.c
  128. nullarbor:~ # echo -n 'file svcsock.c line 1603 +p' >
  129. <debugfs>/dynamic_debug/control
  130. // enable all the messages in file svcsock.c
  131. nullarbor:~ # echo -n 'file svcsock.c +p' >
  132. <debugfs>/dynamic_debug/control
  133. // enable all the messages in the NFS server module
  134. nullarbor:~ # echo -n 'module nfsd +p' >
  135. <debugfs>/dynamic_debug/control
  136. // enable all 12 messages in the function svc_process()
  137. nullarbor:~ # echo -n 'func svc_process +p' >
  138. <debugfs>/dynamic_debug/control
  139. // disable all 12 messages in the function svc_process()
  140. nullarbor:~ # echo -n 'func svc_process -p' >
  141. <debugfs>/dynamic_debug/control
  142. See Documentation/admin-guide/dynamic-debug-howto.rst for additional
  143. information.
  144. config DYNAMIC_DEBUG_CORE
  145. bool "Enable core function of dynamic debug support"
  146. depends on PRINTK
  147. depends on (DEBUG_FS || PROC_FS)
  148. help
  149. Enable core functional support of dynamic debug. It is useful
  150. when you want to tie dynamic debug to your kernel modules with
  151. DYNAMIC_DEBUG_MODULE defined for each of them, especially for
  152. the case of embedded system where the kernel image size is
  153. sensitive for people.
  154. config SYMBOLIC_ERRNAME
  155. bool "Support symbolic error names in printf"
  156. default y if PRINTK
  157. help
  158. If you say Y here, the kernel's printf implementation will
  159. be able to print symbolic error names such as ENOSPC instead
  160. of the number 28. It makes the kernel image slightly larger
  161. (about 3KB), but can make the kernel logs easier to read.
  162. config DEBUG_BUGVERBOSE
  163. bool "Verbose BUG() reporting (adds 70K)" if DEBUG_KERNEL && EXPERT
  164. depends on BUG && (GENERIC_BUG || HAVE_DEBUG_BUGVERBOSE)
  165. default y
  166. help
  167. Say Y here to make BUG() panics output the file name and line number
  168. of the BUG call as well as the EIP and oops trace. This aids
  169. debugging but costs about 70-100K of memory.
  170. endmenu # "printk and dmesg options"
  171. config DEBUG_KERNEL
  172. bool "Kernel debugging"
  173. help
  174. Say Y here if you are developing drivers or trying to debug and
  175. identify kernel problems.
  176. config DEBUG_MISC
  177. bool "Miscellaneous debug code"
  178. default DEBUG_KERNEL
  179. depends on DEBUG_KERNEL
  180. help
  181. Say Y here if you need to enable miscellaneous debug code that should
  182. be under a more specific debug option but isn't.
  183. menu "Compile-time checks and compiler options"
  184. config DEBUG_INFO
  185. bool
  186. help
  187. A kernel debug info option other than "None" has been selected
  188. in the "Debug information" choice below, indicating that debug
  189. information will be generated for build targets.
  190. # Clang is known to generate .{s,u}leb128 with symbol deltas with DWARF5, which
  191. # some targets may not support: https://sourceware.org/bugzilla/show_bug.cgi?id=27215
  192. config AS_HAS_NON_CONST_LEB128
  193. def_bool $(as-instr,.uleb128 .Lexpr_end4 - .Lexpr_start3\n.Lexpr_start3:\n.Lexpr_end4:)
  194. choice
  195. prompt "Debug information"
  196. depends on DEBUG_KERNEL
  197. help
  198. Selecting something other than "None" results in a kernel image
  199. that will include debugging info resulting in a larger kernel image.
  200. This adds debug symbols to the kernel and modules (gcc -g), and
  201. is needed if you intend to use kernel crashdump or binary object
  202. tools like crash, kgdb, LKCD, gdb, etc on the kernel.
  203. Choose which version of DWARF debug info to emit. If unsure,
  204. select "Toolchain default".
  205. config DEBUG_INFO_NONE
  206. bool "Disable debug information"
  207. help
  208. Do not build the kernel with debugging information, which will
  209. result in a faster and smaller build.
  210. config DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT
  211. bool "Rely on the toolchain's implicit default DWARF version"
  212. select DEBUG_INFO
  213. depends on !CC_IS_CLANG || AS_IS_LLVM || CLANG_VERSION < 140000 || (AS_IS_GNU && AS_VERSION >= 23502 && AS_HAS_NON_CONST_LEB128)
  214. help
  215. The implicit default version of DWARF debug info produced by a
  216. toolchain changes over time.
  217. This can break consumers of the debug info that haven't upgraded to
  218. support newer revisions, and prevent testing newer versions, but
  219. those should be less common scenarios.
  220. config DEBUG_INFO_DWARF4
  221. bool "Generate DWARF Version 4 debuginfo"
  222. select DEBUG_INFO
  223. depends on !CC_IS_CLANG || AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502)
  224. help
  225. Generate DWARF v4 debug info. This requires gcc 4.5+, binutils 2.35.2
  226. if using clang without clang's integrated assembler, and gdb 7.0+.
  227. If you have consumers of DWARF debug info that are not ready for
  228. newer revisions of DWARF, you may wish to choose this or have your
  229. config select this.
  230. config DEBUG_INFO_DWARF5
  231. bool "Generate DWARF Version 5 debuginfo"
  232. select DEBUG_INFO
  233. depends on !CC_IS_CLANG || AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502 && AS_HAS_NON_CONST_LEB128)
  234. help
  235. Generate DWARF v5 debug info. Requires binutils 2.35.2, gcc 5.0+ (gcc
  236. 5.0+ accepts the -gdwarf-5 flag but only had partial support for some
  237. draft features until 7.0), and gdb 8.0+.
  238. Changes to the structure of debug info in Version 5 allow for around
  239. 15-18% savings in resulting image and debug info section sizes as
  240. compared to DWARF Version 4. DWARF Version 5 standardizes previous
  241. extensions such as accelerators for symbol indexing and the format
  242. for fission (.dwo/.dwp) files. Users may not want to select this
  243. config if they rely on tooling that has not yet been updated to
  244. support DWARF Version 5.
  245. endchoice # "Debug information"
  246. if DEBUG_INFO
  247. config DEBUG_INFO_REDUCED
  248. bool "Reduce debugging information"
  249. help
  250. If you say Y here gcc is instructed to generate less debugging
  251. information for structure types. This means that tools that
  252. need full debugging information (like kgdb or systemtap) won't
  253. be happy. But if you merely need debugging information to
  254. resolve line numbers there is no loss. Advantage is that
  255. build directory object sizes shrink dramatically over a full
  256. DEBUG_INFO build and compile times are reduced too.
  257. Only works with newer gcc versions.
  258. config DEBUG_INFO_COMPRESSED
  259. bool "Compressed debugging information"
  260. depends on $(cc-option,-gz=zlib)
  261. depends on $(ld-option,--compress-debug-sections=zlib)
  262. help
  263. Compress the debug information using zlib. Requires GCC 5.0+ or Clang
  264. 5.0+, binutils 2.26+, and zlib.
  265. Users of dpkg-deb via scripts/package/builddeb may find an increase in
  266. size of their debug .deb packages with this config set, due to the
  267. debug info being compressed with zlib, then the object files being
  268. recompressed with a different compression scheme. But this is still
  269. preferable to setting $KDEB_COMPRESS to "none" which would be even
  270. larger.
  271. config DEBUG_INFO_SPLIT
  272. bool "Produce split debuginfo in .dwo files"
  273. depends on $(cc-option,-gsplit-dwarf)
  274. help
  275. Generate debug info into separate .dwo files. This significantly
  276. reduces the build directory size for builds with DEBUG_INFO,
  277. because it stores the information only once on disk in .dwo
  278. files instead of multiple times in object files and executables.
  279. In addition the debug information is also compressed.
  280. Requires recent gcc (4.7+) and recent gdb/binutils.
  281. Any tool that packages or reads debug information would need
  282. to know about the .dwo files and include them.
  283. Incompatible with older versions of ccache.
  284. config DEBUG_INFO_BTF
  285. bool "Generate BTF typeinfo"
  286. depends on !DEBUG_INFO_SPLIT && !DEBUG_INFO_REDUCED
  287. depends on !GCC_PLUGIN_RANDSTRUCT || COMPILE_TEST
  288. depends on BPF_SYSCALL
  289. depends on !DEBUG_INFO_DWARF5 || PAHOLE_VERSION >= 121
  290. help
  291. Generate deduplicated BTF type information from DWARF debug info.
  292. Turning this on expects presence of pahole tool, which will convert
  293. DWARF type info into equivalent deduplicated BTF type info.
  294. config PAHOLE_HAS_SPLIT_BTF
  295. def_bool PAHOLE_VERSION >= 119
  296. config PAHOLE_HAS_BTF_TAG
  297. def_bool PAHOLE_VERSION >= 123
  298. depends on CC_IS_CLANG
  299. help
  300. Decide whether pahole emits btf_tag attributes (btf_type_tag and
  301. btf_decl_tag) or not. Currently only clang compiler implements
  302. these attributes, so make the config depend on CC_IS_CLANG.
  303. config DEBUG_INFO_BTF_MODULES
  304. def_bool y
  305. depends on DEBUG_INFO_BTF && MODULES && PAHOLE_HAS_SPLIT_BTF
  306. help
  307. Generate compact split BTF type information for kernel modules.
  308. config MODULE_ALLOW_BTF_MISMATCH
  309. bool "Allow loading modules with non-matching BTF type info"
  310. depends on DEBUG_INFO_BTF_MODULES
  311. help
  312. For modules whose split BTF does not match vmlinux, load without
  313. BTF rather than refusing to load. The default behavior with
  314. module BTF enabled is to reject modules with such mismatches;
  315. this option will still load module BTF where possible but ignore
  316. it when a mismatch is found.
  317. config GDB_SCRIPTS
  318. bool "Provide GDB scripts for kernel debugging"
  319. help
  320. This creates the required links to GDB helper scripts in the
  321. build directory. If you load vmlinux into gdb, the helper
  322. scripts will be automatically imported by gdb as well, and
  323. additional functions are available to analyze a Linux kernel
  324. instance. See Documentation/dev-tools/gdb-kernel-debugging.rst
  325. for further details.
  326. endif # DEBUG_INFO
  327. config FRAME_WARN
  328. int "Warn for stack frames larger than"
  329. range 0 8192
  330. default 0 if KUNIT
  331. default 0 if KMSAN
  332. default 2048 if GCC_PLUGIN_LATENT_ENTROPY
  333. default 2048 if PARISC
  334. default 1536 if (!64BIT && XTENSA)
  335. default 1280 if KASAN && !64BIT
  336. default 1024 if !64BIT
  337. default 2048 if 64BIT
  338. help
  339. Tell the compiler to warn at build time for stack frames larger than this.
  340. Setting this too low will cause a lot of warnings.
  341. Setting it to 0 disables the warning.
  342. config STRIP_ASM_SYMS
  343. bool "Strip assembler-generated symbols during link"
  344. default n
  345. help
  346. Strip internal assembler-generated symbols during a link (symbols
  347. that look like '.Lxxx') so they don't pollute the output of
  348. get_wchan() and suchlike.
  349. config READABLE_ASM
  350. bool "Generate readable assembler code"
  351. depends on DEBUG_KERNEL
  352. depends on CC_IS_GCC
  353. help
  354. Disable some compiler optimizations that tend to generate human unreadable
  355. assembler output. This may make the kernel slightly slower, but it helps
  356. to keep kernel developers who have to stare a lot at assembler listings
  357. sane.
  358. config HEADERS_INSTALL
  359. bool "Install uapi headers to usr/include"
  360. depends on !UML
  361. help
  362. This option will install uapi headers (headers exported to user-space)
  363. into the usr/include directory for use during the kernel build.
  364. This is unneeded for building the kernel itself, but needed for some
  365. user-space program samples. It is also needed by some features such
  366. as uapi header sanity checks.
  367. config DEBUG_SECTION_MISMATCH
  368. bool "Enable full Section mismatch analysis"
  369. depends on CC_IS_GCC
  370. help
  371. The section mismatch analysis checks if there are illegal
  372. references from one section to another section.
  373. During linktime or runtime, some sections are dropped;
  374. any use of code/data previously in these sections would
  375. most likely result in an oops.
  376. In the code, functions and variables are annotated with
  377. __init,, etc. (see the full list in include/linux/init.h),
  378. which results in the code/data being placed in specific sections.
  379. The section mismatch analysis is always performed after a full
  380. kernel build, and enabling this option causes the following
  381. additional step to occur:
  382. - Add the option -fno-inline-functions-called-once to gcc commands.
  383. When inlining a function annotated with __init in a non-init
  384. function, we would lose the section information and thus
  385. the analysis would not catch the illegal reference.
  386. This option tells gcc to inline less (but it does result in
  387. a larger kernel).
  388. config SECTION_MISMATCH_WARN_ONLY
  389. bool "Make section mismatch errors non-fatal"
  390. default y
  391. help
  392. If you say N here, the build process will fail if there are any
  393. section mismatch, instead of just throwing warnings.
  394. If unsure, say Y.
  395. config DEBUG_FORCE_FUNCTION_ALIGN_64B
  396. bool "Force all function address 64B aligned"
  397. depends on EXPERT && (X86_64 || ARM64 || PPC32 || PPC64 || ARC)
  398. help
  399. There are cases that a commit from one domain changes the function
  400. address alignment of other domains, and cause magic performance
  401. bump (regression or improvement). Enable this option will help to
  402. verify if the bump is caused by function alignment changes, while
  403. it will slightly increase the kernel size and affect icache usage.
  404. It is mainly for debug and performance tuning use.
  405. #
  406. # Select this config option from the architecture Kconfig, if it
  407. # is preferred to always offer frame pointers as a config
  408. # option on the architecture (regardless of KERNEL_DEBUG):
  409. #
  410. config ARCH_WANT_FRAME_POINTERS
  411. bool
  412. config FRAME_POINTER
  413. bool "Compile the kernel with frame pointers"
  414. depends on DEBUG_KERNEL && (M68K || UML || SUPERH) || ARCH_WANT_FRAME_POINTERS
  415. default y if (DEBUG_INFO && UML) || ARCH_WANT_FRAME_POINTERS
  416. help
  417. If you say Y here the resulting kernel image will be slightly
  418. larger and slower, but it gives very useful debugging information
  419. in case of kernel bugs. (precise oopses/stacktraces/warnings)
  420. config OBJTOOL
  421. bool
  422. config STACK_VALIDATION
  423. bool "Compile-time stack metadata validation"
  424. depends on HAVE_STACK_VALIDATION && UNWINDER_FRAME_POINTER
  425. select OBJTOOL
  426. default n
  427. help
  428. Validate frame pointer rules at compile-time. This helps ensure that
  429. runtime stack traces are more reliable.
  430. For more information, see
  431. tools/objtool/Documentation/objtool.txt.
  432. config NOINSTR_VALIDATION
  433. bool
  434. depends on HAVE_NOINSTR_VALIDATION && DEBUG_ENTRY
  435. select OBJTOOL
  436. default y
  437. config VMLINUX_MAP
  438. bool "Generate vmlinux.map file when linking"
  439. depends on EXPERT
  440. help
  441. Selecting this option will pass "-Map=vmlinux.map" to ld
  442. when linking vmlinux. That file can be useful for verifying
  443. and debugging magic section games, and for seeing which
  444. pieces of code get eliminated with
  445. CONFIG_LD_DEAD_CODE_DATA_ELIMINATION.
  446. config DEBUG_FORCE_WEAK_PER_CPU
  447. bool "Force weak per-cpu definitions"
  448. depends on DEBUG_KERNEL
  449. help
  450. s390 and alpha require percpu variables in modules to be
  451. defined weak to work around addressing range issue which
  452. puts the following two restrictions on percpu variable
  453. definitions.
  454. 1. percpu symbols must be unique whether static or not
  455. 2. percpu variables can't be defined inside a function
  456. To ensure that generic code follows the above rules, this
  457. option forces all percpu variables to be defined as weak.
  458. endmenu # "Compiler options"
  459. menu "Generic Kernel Debugging Instruments"
  460. config MAGIC_SYSRQ
  461. bool "Magic SysRq key"
  462. depends on !UML
  463. help
  464. If you say Y here, you will have some control over the system even
  465. if the system crashes for example during kernel debugging (e.g., you
  466. will be able to flush the buffer cache to disk, reboot the system
  467. immediately or dump some status information). This is accomplished
  468. by pressing various keys while holding SysRq (Alt+PrintScreen). It
  469. also works on a serial console (on PC hardware at least), if you
  470. send a BREAK and then within 5 seconds a command keypress. The
  471. keys are documented in <file:Documentation/admin-guide/sysrq.rst>.
  472. Don't say Y unless you really know what this hack does.
  473. config MAGIC_SYSRQ_DEFAULT_ENABLE
  474. hex "Enable magic SysRq key functions by default"
  475. depends on MAGIC_SYSRQ
  476. default 0x1
  477. help
  478. Specifies which SysRq key functions are enabled by default.
  479. This may be set to 1 or 0 to enable or disable them all, or
  480. to a bitmask as described in Documentation/admin-guide/sysrq.rst.
  481. config MAGIC_SYSRQ_SERIAL
  482. bool "Enable magic SysRq key over serial"
  483. depends on MAGIC_SYSRQ
  484. default y
  485. help
  486. Many embedded boards have a disconnected TTL level serial which can
  487. generate some garbage that can lead to spurious false sysrq detects.
  488. This option allows you to decide whether you want to enable the
  489. magic SysRq key.
  490. config MAGIC_SYSRQ_SERIAL_SEQUENCE
  491. string "Char sequence that enables magic SysRq over serial"
  492. depends on MAGIC_SYSRQ_SERIAL
  493. default ""
  494. help
  495. Specifies a sequence of characters that can follow BREAK to enable
  496. SysRq on a serial console.
  497. If unsure, leave an empty string and the option will not be enabled.
  498. config DEBUG_FS
  499. bool "Debug Filesystem"
  500. help
  501. debugfs is a virtual file system that kernel developers use to put
  502. debugging files into. Enable this option to be able to read and
  503. write to these files.
  504. For detailed documentation on the debugfs API, see
  505. Documentation/filesystems/.
  506. If unsure, say N.
  507. choice
  508. prompt "Debugfs default access"
  509. depends on DEBUG_FS
  510. default DEBUG_FS_ALLOW_ALL
  511. help
  512. This selects the default access restrictions for debugfs.
  513. It can be overridden with kernel command line option
  514. debugfs=[on,no-mount,off]. The restrictions apply for API access
  515. and filesystem registration.
  516. config DEBUG_FS_ALLOW_ALL
  517. bool "Access normal"
  518. help
  519. No restrictions apply. Both API and filesystem registration
  520. is on. This is the normal default operation.
  521. config DEBUG_FS_DISALLOW_MOUNT
  522. bool "Do not register debugfs as filesystem"
  523. help
  524. The API is open but filesystem is not loaded. Clients can still do
  525. their work and read with debug tools that do not need
  526. debugfs filesystem.
  527. config DEBUG_FS_ALLOW_NONE
  528. bool "No access"
  529. help
  530. Access is off. Clients get -PERM when trying to create nodes in
  531. debugfs tree and debugfs is not registered as a filesystem.
  532. Client can then back-off or continue without debugfs access.
  533. endchoice
  534. source "lib/Kconfig.kgdb"
  535. source "lib/Kconfig.ubsan"
  536. source "lib/Kconfig.kcsan"
  537. endmenu
  538. menu "Networking Debugging"
  539. source "net/Kconfig.debug"
  540. endmenu # "Networking Debugging"
  541. menu "Memory Debugging"
  542. source "mm/Kconfig.debug"
  543. config DEBUG_OBJECTS
  544. bool "Debug object operations"
  545. depends on DEBUG_KERNEL
  546. help
  547. If you say Y here, additional code will be inserted into the
  548. kernel to track the life time of various objects and validate
  549. the operations on those objects.
  550. config DEBUG_OBJECTS_SELFTEST
  551. bool "Debug objects selftest"
  552. depends on DEBUG_OBJECTS
  553. help
  554. This enables the selftest of the object debug code.
  555. config DEBUG_OBJECTS_FREE
  556. bool "Debug objects in freed memory"
  557. depends on DEBUG_OBJECTS
  558. help
  559. This enables checks whether a k/v free operation frees an area
  560. which contains an object which has not been deactivated
  561. properly. This can make kmalloc/kfree-intensive workloads
  562. much slower.
  563. config DEBUG_OBJECTS_TIMERS
  564. bool "Debug timer objects"
  565. depends on DEBUG_OBJECTS
  566. help
  567. If you say Y here, additional code will be inserted into the
  568. timer routines to track the life time of timer objects and
  569. validate the timer operations.
  570. config DEBUG_OBJECTS_WORK
  571. bool "Debug work objects"
  572. depends on DEBUG_OBJECTS
  573. help
  574. If you say Y here, additional code will be inserted into the
  575. work queue routines to track the life time of work objects and
  576. validate the work operations.
  577. config DEBUG_OBJECTS_RCU_HEAD
  578. bool "Debug RCU callbacks objects"
  579. depends on DEBUG_OBJECTS
  580. help
  581. Enable this to turn on debugging of RCU list heads (call_rcu() usage).
  582. config DEBUG_OBJECTS_PERCPU_COUNTER
  583. bool "Debug percpu counter objects"
  584. depends on DEBUG_OBJECTS
  585. help
  586. If you say Y here, additional code will be inserted into the
  587. percpu counter routines to track the life time of percpu counter
  588. objects and validate the percpu counter operations.
  589. config DEBUG_OBJECTS_ENABLE_DEFAULT
  590. int "debug_objects bootup default value (0-1)"
  591. range 0 1
  592. default "1"
  593. depends on DEBUG_OBJECTS
  594. help
  595. Debug objects boot parameter default value
  596. config SHRINKER_DEBUG
  597. bool "Enable shrinker debugging support"
  598. depends on DEBUG_FS
  599. help
  600. Say Y to enable the shrinker debugfs interface which provides
  601. visibility into the kernel memory shrinkers subsystem.
  602. Disable it to avoid an extra memory footprint.
  603. config HAVE_DEBUG_KMEMLEAK
  604. bool
  605. config DEBUG_KMEMLEAK
  606. bool "Kernel memory leak detector"
  607. depends on DEBUG_KERNEL && HAVE_DEBUG_KMEMLEAK
  608. select DEBUG_FS
  609. select STACKTRACE if STACKTRACE_SUPPORT
  610. select KALLSYMS
  611. select CRC32
  612. help
  613. Say Y here if you want to enable the memory leak
  614. detector. The memory allocation/freeing is traced in a way
  615. similar to the Boehm's conservative garbage collector, the
  616. difference being that the orphan objects are not freed but
  617. only shown in /sys/kernel/debug/kmemleak. Enabling this
  618. feature will introduce an overhead to memory
  619. allocations. See Documentation/dev-tools/kmemleak.rst for more
  620. details.
  621. Enabling DEBUG_SLAB or SLUB_DEBUG may increase the chances
  622. of finding leaks due to the slab objects poisoning.
  623. In order to access the kmemleak file, debugfs needs to be
  624. mounted (usually at /sys/kernel/debug).
  625. config DEBUG_KMEMLEAK_MEM_POOL_SIZE
  626. int "Kmemleak memory pool size"
  627. depends on DEBUG_KMEMLEAK
  628. range 200 1000000
  629. default 16000
  630. help
  631. Kmemleak must track all the memory allocations to avoid
  632. reporting false positives. Since memory may be allocated or
  633. freed before kmemleak is fully initialised, use a static pool
  634. of metadata objects to track such callbacks. After kmemleak is
  635. fully initialised, this memory pool acts as an emergency one
  636. if slab allocations fail.
  637. config DEBUG_KMEMLEAK_TEST
  638. tristate "Simple test for the kernel memory leak detector"
  639. depends on DEBUG_KMEMLEAK && m
  640. help
  641. This option enables a module that explicitly leaks memory.
  642. If unsure, say N.
  643. config DEBUG_KMEMLEAK_DEFAULT_OFF
  644. bool "Default kmemleak to off"
  645. depends on DEBUG_KMEMLEAK
  646. help
  647. Say Y here to disable kmemleak by default. It can then be enabled
  648. on the command line via kmemleak=on.
  649. config DEBUG_KMEMLEAK_AUTO_SCAN
  650. bool "Enable kmemleak auto scan thread on boot up"
  651. default y
  652. depends on DEBUG_KMEMLEAK
  653. help
  654. Depending on the cpu, kmemleak scan may be cpu intensive and can
  655. stall user tasks at times. This option enables/disables automatic
  656. kmemleak scan at boot up.
  657. Say N here to disable kmemleak auto scan thread to stop automatic
  658. scanning. Disabling this option disables automatic reporting of
  659. memory leaks.
  660. If unsure, say Y.
  661. config DEBUG_STACK_USAGE
  662. bool "Stack utilization instrumentation"
  663. depends on DEBUG_KERNEL && !IA64
  664. help
  665. Enables the display of the minimum amount of free stack which each
  666. task has ever had available in the sysrq-T and sysrq-P debug output.
  667. This option will slow down process creation somewhat.
  668. config SCHED_STACK_END_CHECK
  669. bool "Detect stack corruption on calls to schedule()"
  670. depends on DEBUG_KERNEL
  671. default n
  672. help
  673. This option checks for a stack overrun on calls to schedule().
  674. If the stack end location is found to be over written always panic as
  675. the content of the corrupted region can no longer be trusted.
  676. This is to ensure no erroneous behaviour occurs which could result in
  677. data corruption or a sporadic crash at a later stage once the region
  678. is examined. The runtime overhead introduced is minimal.
  679. config ARCH_HAS_DEBUG_VM_PGTABLE
  680. bool
  681. help
  682. An architecture should select this when it can successfully
  683. build and run DEBUG_VM_PGTABLE.
  684. config DEBUG_VM_IRQSOFF
  685. def_bool DEBUG_VM && !PREEMPT_RT
  686. config DEBUG_VM
  687. bool "Debug VM"
  688. depends on DEBUG_KERNEL
  689. help
  690. Enable this to turn on extended checks in the virtual-memory system
  691. that may impact performance.
  692. If unsure, say N.
  693. config DEBUG_VM_MAPLE_TREE
  694. bool "Debug VM maple trees"
  695. depends on DEBUG_VM
  696. select DEBUG_MAPLE_TREE
  697. help
  698. Enable VM maple tree debugging information and extra validations.
  699. If unsure, say N.
  700. config DEBUG_VM_RB
  701. bool "Debug VM red-black trees"
  702. depends on DEBUG_VM
  703. help
  704. Enable VM red-black tree debugging information and extra validations.
  705. If unsure, say N.
  706. config DEBUG_VM_PGFLAGS
  707. bool "Debug page-flags operations"
  708. depends on DEBUG_VM
  709. help
  710. Enables extra validation on page flags operations.
  711. If unsure, say N.
  712. config DEBUG_VM_PGTABLE
  713. bool "Debug arch page table for semantics compliance"
  714. depends on MMU
  715. depends on ARCH_HAS_DEBUG_VM_PGTABLE
  716. default y if DEBUG_VM
  717. help
  718. This option provides a debug method which can be used to test
  719. architecture page table helper functions on various platforms in
  720. verifying if they comply with expected generic MM semantics. This
  721. will help architecture code in making sure that any changes or
  722. new additions of these helpers still conform to expected
  723. semantics of the generic MM. Platforms will have to opt in for
  724. this through ARCH_HAS_DEBUG_VM_PGTABLE.
  725. If unsure, say N.
  726. config ARCH_HAS_DEBUG_VIRTUAL
  727. bool
  728. config DEBUG_VIRTUAL
  729. bool "Debug VM translations"
  730. depends on DEBUG_KERNEL && ARCH_HAS_DEBUG_VIRTUAL
  731. help
  732. Enable some costly sanity checks in virtual to page code. This can
  733. catch mistakes with virt_to_page() and friends.
  734. If unsure, say N.
  735. config DEBUG_NOMMU_REGIONS
  736. bool "Debug the global anon/private NOMMU mapping region tree"
  737. depends on DEBUG_KERNEL && !MMU
  738. help
  739. This option causes the global tree of anonymous and private mapping
  740. regions to be regularly checked for invalid topology.
  741. config DEBUG_MEMORY_INIT
  742. bool "Debug memory initialisation" if EXPERT
  743. default !EXPERT
  744. help
  745. Enable this for additional checks during memory initialisation.
  746. The sanity checks verify aspects of the VM such as the memory model
  747. and other information provided by the architecture. Verbose
  748. information will be printed at KERN_DEBUG loglevel depending
  749. on the mminit_loglevel= command-line option.
  750. If unsure, say Y
  751. config MEMORY_NOTIFIER_ERROR_INJECT
  752. tristate "Memory hotplug notifier error injection module"
  753. depends on MEMORY_HOTPLUG && NOTIFIER_ERROR_INJECTION
  754. help
  755. This option provides the ability to inject artificial errors to
  756. memory hotplug notifier chain callbacks. It is controlled through
  757. debugfs interface under /sys/kernel/debug/notifier-error-inject/memory
  758. If the notifier call chain should be failed with some events
  759. notified, write the error code to "actions/<notifier event>/error".
  760. Example: Inject memory hotplug offline error (-12 == -ENOMEM)
  761. # cd /sys/kernel/debug/notifier-error-inject/memory
  762. # echo -12 > actions/MEM_GOING_OFFLINE/error
  763. # echo offline > /sys/devices/system/memory/memoryXXX/state
  764. bash: echo: write error: Cannot allocate memory
  765. To compile this code as a module, choose M here: the module will
  766. be called memory-notifier-error-inject.
  767. If unsure, say N.
  768. config DEBUG_PER_CPU_MAPS
  769. bool "Debug access to per_cpu maps"
  770. depends on DEBUG_KERNEL
  771. depends on SMP
  772. help
  773. Say Y to verify that the per_cpu map being accessed has
  774. been set up. This adds a fair amount of code to kernel memory
  775. and decreases performance.
  776. Say N if unsure.
  777. config DEBUG_KMAP_LOCAL
  778. bool "Debug kmap_local temporary mappings"
  779. depends on DEBUG_KERNEL && KMAP_LOCAL
  780. help
  781. This option enables additional error checking for the kmap_local
  782. infrastructure. Disable for production use.
  783. config ARCH_SUPPORTS_KMAP_LOCAL_FORCE_MAP
  784. bool
  785. config DEBUG_KMAP_LOCAL_FORCE_MAP
  786. bool "Enforce kmap_local temporary mappings"
  787. depends on DEBUG_KERNEL && ARCH_SUPPORTS_KMAP_LOCAL_FORCE_MAP
  788. select KMAP_LOCAL
  789. select DEBUG_KMAP_LOCAL
  790. help
  791. This option enforces temporary mappings through the kmap_local
  792. mechanism for non-highmem pages and on non-highmem systems.
  793. Disable this for production systems!
  794. config DEBUG_HIGHMEM
  795. bool "Highmem debugging"
  796. depends on DEBUG_KERNEL && HIGHMEM
  797. select DEBUG_KMAP_LOCAL_FORCE_MAP if ARCH_SUPPORTS_KMAP_LOCAL_FORCE_MAP
  798. select DEBUG_KMAP_LOCAL
  799. help
  800. This option enables additional error checking for high memory
  801. systems. Disable for production systems.
  802. config HAVE_DEBUG_STACKOVERFLOW
  803. bool
  804. config DEBUG_STACKOVERFLOW
  805. bool "Check for stack overflows"
  806. depends on DEBUG_KERNEL && HAVE_DEBUG_STACKOVERFLOW
  807. help
  808. Say Y here if you want to check for overflows of kernel, IRQ
  809. and exception stacks (if your architecture uses them). This
  810. option will show detailed messages if free stack space drops
  811. below a certain limit.
  812. These kinds of bugs usually occur when call-chains in the
  813. kernel get too deep, especially when interrupts are
  814. involved.
  815. Use this in cases where you see apparently random memory
  816. corruption, especially if it appears in 'struct thread_info'
  817. If in doubt, say "N".
  818. source "lib/Kconfig.kasan"
  819. source "lib/Kconfig.kfence"
  820. source "lib/Kconfig.kmsan"
  821. endmenu # "Memory Debugging"
  822. config DEBUG_SHIRQ
  823. bool "Debug shared IRQ handlers"
  824. depends on DEBUG_KERNEL
  825. help
  826. Enable this to generate a spurious interrupt just before a shared
  827. interrupt handler is deregistered (generating one when registering
  828. is currently disabled). Drivers need to handle this correctly. Some
  829. don't and need to be caught.
  830. menu "Debug Oops, Lockups and Hangs"
  831. config PANIC_ON_OOPS
  832. bool "Panic on Oops"
  833. help
  834. Say Y here to enable the kernel to panic when it oopses. This
  835. has the same effect as setting oops=panic on the kernel command
  836. line.
  837. This feature is useful to ensure that the kernel does not do
  838. anything erroneous after an oops which could result in data
  839. corruption or other issues.
  840. Say N if unsure.
  841. config PANIC_ON_OOPS_VALUE
  842. int
  843. range 0 1
  844. default 0 if !PANIC_ON_OOPS
  845. default 1 if PANIC_ON_OOPS
  846. config PANIC_TIMEOUT
  847. int "panic timeout"
  848. default 0
  849. help
  850. Set the timeout value (in seconds) until a reboot occurs when
  851. the kernel panics. If n = 0, then we wait forever. A timeout
  852. value n > 0 will wait n seconds before rebooting, while a timeout
  853. value n < 0 will reboot immediately.
  854. config LOCKUP_DETECTOR
  855. bool
  856. config SOFTLOCKUP_DETECTOR
  857. bool "Detect Soft Lockups"
  858. depends on DEBUG_KERNEL && !S390
  859. select LOCKUP_DETECTOR
  860. help
  861. Say Y here to enable the kernel to act as a watchdog to detect
  862. soft lockups.
  863. Softlockups are bugs that cause the kernel to loop in kernel
  864. mode for more than 20 seconds, without giving other tasks a
  865. chance to run. The current stack trace is displayed upon
  866. detection and the system will stay locked up.
  867. config BOOTPARAM_SOFTLOCKUP_PANIC
  868. bool "Panic (Reboot) On Soft Lockups"
  869. depends on SOFTLOCKUP_DETECTOR
  870. help
  871. Say Y here to enable the kernel to panic on "soft lockups",
  872. which are bugs that cause the kernel to loop in kernel
  873. mode for more than 20 seconds (configurable using the watchdog_thresh
  874. sysctl), without giving other tasks a chance to run.
  875. The panic can be used in combination with panic_timeout,
  876. to cause the system to reboot automatically after a
  877. lockup has been detected. This feature is useful for
  878. high-availability systems that have uptime guarantees and
  879. where a lockup must be resolved ASAP.
  880. Say N if unsure.
  881. config HARDLOCKUP_DETECTOR_PERF
  882. bool
  883. select SOFTLOCKUP_DETECTOR
  884. #
  885. # Enables a timestamp based low pass filter to compensate for perf based
  886. # hard lockup detection which runs too fast due to turbo modes.
  887. #
  888. config HARDLOCKUP_CHECK_TIMESTAMP
  889. bool
  890. #
  891. # arch/ can define HAVE_HARDLOCKUP_DETECTOR_ARCH to provide their own hard
  892. # lockup detector rather than the perf based detector.
  893. #
  894. config HARDLOCKUP_DETECTOR
  895. bool "Detect Hard Lockups"
  896. depends on DEBUG_KERNEL && !S390
  897. depends on HAVE_HARDLOCKUP_DETECTOR_PERF || HAVE_HARDLOCKUP_DETECTOR_ARCH
  898. select LOCKUP_DETECTOR
  899. select HARDLOCKUP_DETECTOR_PERF if HAVE_HARDLOCKUP_DETECTOR_PERF
  900. help
  901. Say Y here to enable the kernel to act as a watchdog to detect
  902. hard lockups.
  903. Hardlockups are bugs that cause the CPU to loop in kernel mode
  904. for more than 10 seconds, without letting other interrupts have a
  905. chance to run. The current stack trace is displayed upon detection
  906. and the system will stay locked up.
  907. config BOOTPARAM_HARDLOCKUP_PANIC
  908. bool "Panic (Reboot) On Hard Lockups"
  909. depends on HARDLOCKUP_DETECTOR
  910. help
  911. Say Y here to enable the kernel to panic on "hard lockups",
  912. which are bugs that cause the kernel to loop in kernel
  913. mode with interrupts disabled for more than 10 seconds (configurable
  914. using the watchdog_thresh sysctl).
  915. Say N if unsure.
  916. config DETECT_HUNG_TASK
  917. bool "Detect Hung Tasks"
  918. depends on DEBUG_KERNEL
  919. default SOFTLOCKUP_DETECTOR
  920. help
  921. Say Y here to enable the kernel to detect "hung tasks",
  922. which are bugs that cause the task to be stuck in
  923. uninterruptible "D" state indefinitely.
  924. When a hung task is detected, the kernel will print the
  925. current stack trace (which you should report), but the
  926. task will stay in uninterruptible state. If lockdep is
  927. enabled then all held locks will also be reported. This
  928. feature has negligible overhead.
  929. config DEFAULT_HUNG_TASK_TIMEOUT
  930. int "Default timeout for hung task detection (in seconds)"
  931. depends on DETECT_HUNG_TASK
  932. default 120
  933. help
  934. This option controls the default timeout (in seconds) used
  935. to determine when a task has become non-responsive and should
  936. be considered hung.
  937. It can be adjusted at runtime via the kernel.hung_task_timeout_secs
  938. sysctl or by writing a value to
  939. /proc/sys/kernel/hung_task_timeout_secs.
  940. A timeout of 0 disables the check. The default is two minutes.
  941. Keeping the default should be fine in most cases.
  942. config BOOTPARAM_HUNG_TASK_PANIC
  943. bool "Panic (Reboot) On Hung Tasks"
  944. depends on DETECT_HUNG_TASK
  945. help
  946. Say Y here to enable the kernel to panic on "hung tasks",
  947. which are bugs that cause the kernel to leave a task stuck
  948. in uninterruptible "D" state.
  949. The panic can be used in combination with panic_timeout,
  950. to cause the system to reboot automatically after a
  951. hung task has been detected. This feature is useful for
  952. high-availability systems that have uptime guarantees and
  953. where a hung tasks must be resolved ASAP.
  954. Say N if unsure.
  955. config WQ_WATCHDOG
  956. bool "Detect Workqueue Stalls"
  957. depends on DEBUG_KERNEL
  958. help
  959. Say Y here to enable stall detection on workqueues. If a
  960. worker pool doesn't make forward progress on a pending work
  961. item for over a given amount of time, 30s by default, a
  962. warning message is printed along with dump of workqueue
  963. state. This can be configured through kernel parameter
  964. "workqueue.watchdog_thresh" and its sysfs counterpart.
  965. config TEST_LOCKUP
  966. tristate "Test module to generate lockups"
  967. depends on m
  968. help
  969. This builds the "test_lockup" module that helps to make sure
  970. that watchdogs and lockup detectors are working properly.
  971. Depending on module parameters it could emulate soft or hard
  972. lockup, "hung task", or locking arbitrary lock for a long time.
  973. Also it could generate series of lockups with cooling-down periods.
  974. If unsure, say N.
  975. endmenu # "Debug lockups and hangs"
  976. menu "Scheduler Debugging"
  977. config SCHED_DEBUG
  978. bool "Collect scheduler debugging info"
  979. depends on DEBUG_KERNEL && PROC_FS
  980. default y
  981. help
  982. If you say Y here, the /proc/sched_debug file will be provided
  983. that can help debug the scheduler. The runtime overhead of this
  984. option is minimal.
  985. config SCHED_INFO
  986. bool
  987. default n
  988. config SCHEDSTATS
  989. bool "Collect scheduler statistics"
  990. depends on DEBUG_KERNEL && PROC_FS
  991. select SCHED_INFO
  992. help
  993. If you say Y here, additional code will be inserted into the
  994. scheduler and related routines to collect statistics about
  995. scheduler behavior and provide them in /proc/schedstat. These
  996. stats may be useful for both tuning and debugging the scheduler
  997. If you aren't debugging the scheduler or trying to tune a specific
  998. application, you can say N to avoid the very slight overhead
  999. this adds.
  1000. endmenu
  1001. config DEBUG_TIMEKEEPING
  1002. bool "Enable extra timekeeping sanity checking"
  1003. help
  1004. This option will enable additional timekeeping sanity checks
  1005. which may be helpful when diagnosing issues where timekeeping
  1006. problems are suspected.
  1007. This may include checks in the timekeeping hotpaths, so this
  1008. option may have a (very small) performance impact to some
  1009. workloads.
  1010. If unsure, say N.
  1011. config DEBUG_PREEMPT
  1012. bool "Debug preemptible kernel"
  1013. depends on DEBUG_KERNEL && PREEMPTION && TRACE_IRQFLAGS_SUPPORT
  1014. help
  1015. If you say Y here then the kernel will use a debug variant of the
  1016. commonly used smp_processor_id() function and will print warnings
  1017. if kernel code uses it in a preemption-unsafe way. Also, the kernel
  1018. will detect preemption count underflows.
  1019. This option has potential to introduce high runtime overhead,
  1020. depending on workload as it triggers debugging routines for each
  1021. this_cpu operation. It should only be used for debugging purposes.
  1022. menu "Lock Debugging (spinlocks, mutexes, etc...)"
  1023. config LOCK_DEBUGGING_SUPPORT
  1024. bool
  1025. depends on TRACE_IRQFLAGS_SUPPORT && STACKTRACE_SUPPORT && LOCKDEP_SUPPORT
  1026. default y
  1027. config PROVE_LOCKING
  1028. bool "Lock debugging: prove locking correctness"
  1029. depends on DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT
  1030. select LOCKDEP
  1031. select DEBUG_SPINLOCK
  1032. select DEBUG_MUTEXES if !PREEMPT_RT
  1033. select DEBUG_RT_MUTEXES if RT_MUTEXES
  1034. select DEBUG_RWSEMS
  1035. select DEBUG_WW_MUTEX_SLOWPATH
  1036. select DEBUG_LOCK_ALLOC
  1037. select PREEMPT_COUNT if !ARCH_NO_PREEMPT
  1038. select TRACE_IRQFLAGS
  1039. default n
  1040. help
  1041. This feature enables the kernel to prove that all locking
  1042. that occurs in the kernel runtime is mathematically
  1043. correct: that under no circumstance could an arbitrary (and
  1044. not yet triggered) combination of observed locking
  1045. sequences (on an arbitrary number of CPUs, running an
  1046. arbitrary number of tasks and interrupt contexts) cause a
  1047. deadlock.
  1048. In short, this feature enables the kernel to report locking
  1049. related deadlocks before they actually occur.
  1050. The proof does not depend on how hard and complex a
  1051. deadlock scenario would be to trigger: how many
  1052. participant CPUs, tasks and irq-contexts would be needed
  1053. for it to trigger. The proof also does not depend on
  1054. timing: if a race and a resulting deadlock is possible
  1055. theoretically (no matter how unlikely the race scenario
  1056. is), it will be proven so and will immediately be
  1057. reported by the kernel (once the event is observed that
  1058. makes the deadlock theoretically possible).
  1059. If a deadlock is impossible (i.e. the locking rules, as
  1060. observed by the kernel, are mathematically correct), the
  1061. kernel reports nothing.
  1062. NOTE: this feature can also be enabled for rwlocks, mutexes
  1063. and rwsems - in which case all dependencies between these
  1064. different locking variants are observed and mapped too, and
  1065. the proof of observed correctness is also maintained for an
  1066. arbitrary combination of these separate locking variants.
  1067. For more details, see Documentation/locking/lockdep-design.rst.
  1068. config PROVE_RAW_LOCK_NESTING
  1069. bool "Enable raw_spinlock - spinlock nesting checks"
  1070. depends on PROVE_LOCKING
  1071. default n
  1072. help
  1073. Enable the raw_spinlock vs. spinlock nesting checks which ensure
  1074. that the lock nesting rules for PREEMPT_RT enabled kernels are
  1075. not violated.
  1076. NOTE: There are known nesting problems. So if you enable this
  1077. option expect lockdep splats until these problems have been fully
  1078. addressed which is work in progress. This config switch allows to
  1079. identify and analyze these problems. It will be removed and the
  1080. check permanently enabled once the main issues have been fixed.
  1081. If unsure, select N.
  1082. config LOCK_STAT
  1083. bool "Lock usage statistics"
  1084. depends on DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT
  1085. select LOCKDEP
  1086. select DEBUG_SPINLOCK
  1087. select DEBUG_MUTEXES if !PREEMPT_RT
  1088. select DEBUG_RT_MUTEXES if RT_MUTEXES
  1089. select DEBUG_LOCK_ALLOC
  1090. default n
  1091. help
  1092. This feature enables tracking lock contention points
  1093. For more details, see Documentation/locking/lockstat.rst
  1094. This also enables lock events required by "perf lock",
  1095. subcommand of perf.
  1096. If you want to use "perf lock", you also need to turn on
  1097. CONFIG_EVENT_TRACING.
  1098. CONFIG_LOCK_STAT defines "contended" and "acquired" lock events.
  1099. (CONFIG_LOCKDEP defines "acquire" and "release" events.)
  1100. config DEBUG_RT_MUTEXES
  1101. bool "RT Mutex debugging, deadlock detection"
  1102. depends on DEBUG_KERNEL && RT_MUTEXES
  1103. help
  1104. This allows rt mutex semantics violations and rt mutex related
  1105. deadlocks (lockups) to be detected and reported automatically.
  1106. config DEBUG_SPINLOCK
  1107. bool "Spinlock and rw-lock debugging: basic checks"
  1108. depends on DEBUG_KERNEL
  1109. select UNINLINE_SPIN_UNLOCK
  1110. help
  1111. Say Y here and build SMP to catch missing spinlock initialization
  1112. and certain other kinds of spinlock errors commonly made. This is
  1113. best used in conjunction with the NMI watchdog so that spinlock
  1114. deadlocks are also debuggable.
  1115. config DEBUG_MUTEXES
  1116. bool "Mutex debugging: basic checks"
  1117. depends on DEBUG_KERNEL && !PREEMPT_RT
  1118. help
  1119. This feature allows mutex semantics violations to be detected and
  1120. reported.
  1121. config DEBUG_WW_MUTEX_SLOWPATH
  1122. bool "Wait/wound mutex debugging: Slowpath testing"
  1123. depends on DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT
  1124. select DEBUG_LOCK_ALLOC
  1125. select DEBUG_SPINLOCK
  1126. select DEBUG_MUTEXES if !PREEMPT_RT
  1127. select DEBUG_RT_MUTEXES if PREEMPT_RT
  1128. help
  1129. This feature enables slowpath testing for w/w mutex users by
  1130. injecting additional -EDEADLK wound/backoff cases. Together with
  1131. the full mutex checks enabled with (CONFIG_PROVE_LOCKING) this
  1132. will test all possible w/w mutex interface abuse with the
  1133. exception of simply not acquiring all the required locks.
  1134. Note that this feature can introduce significant overhead, so
  1135. it really should not be enabled in a production or distro kernel,
  1136. even a debug kernel. If you are a driver writer, enable it. If
  1137. you are a distro, do not.
  1138. config DEBUG_RWSEMS
  1139. bool "RW Semaphore debugging: basic checks"
  1140. depends on DEBUG_KERNEL
  1141. help
  1142. This debugging feature allows mismatched rw semaphore locks
  1143. and unlocks to be detected and reported.
  1144. config DEBUG_LOCK_ALLOC
  1145. bool "Lock debugging: detect incorrect freeing of live locks"
  1146. depends on DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT
  1147. select DEBUG_SPINLOCK
  1148. select DEBUG_MUTEXES if !PREEMPT_RT
  1149. select DEBUG_RT_MUTEXES if RT_MUTEXES
  1150. select LOCKDEP
  1151. help
  1152. This feature will check whether any held lock (spinlock, rwlock,
  1153. mutex or rwsem) is incorrectly freed by the kernel, via any of the
  1154. memory-freeing routines (kfree(), kmem_cache_free(), free_pages(),
  1155. vfree(), etc.), whether a live lock is incorrectly reinitialized via
  1156. spin_lock_init()/mutex_init()/etc., or whether there is any lock
  1157. held during task exit.
  1158. config LOCKDEP
  1159. bool
  1160. depends on DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT
  1161. select STACKTRACE
  1162. select KALLSYMS
  1163. select KALLSYMS_ALL
  1164. config LOCKDEP_SMALL
  1165. bool
  1166. config LOCKDEP_BITS
  1167. int "Bitsize for MAX_LOCKDEP_ENTRIES"
  1168. depends on LOCKDEP && !LOCKDEP_SMALL
  1169. range 10 30
  1170. default 15
  1171. help
  1172. Try increasing this value if you hit "BUG: MAX_LOCKDEP_ENTRIES too low!" message.
  1173. config LOCKDEP_CHAINS_BITS
  1174. int "Bitsize for MAX_LOCKDEP_CHAINS"
  1175. depends on LOCKDEP && !LOCKDEP_SMALL
  1176. range 10 30
  1177. default 16
  1178. help
  1179. Try increasing this value if you hit "BUG: MAX_LOCKDEP_CHAINS too low!" message.
  1180. config LOCKDEP_STACK_TRACE_BITS
  1181. int "Bitsize for MAX_STACK_TRACE_ENTRIES"
  1182. depends on LOCKDEP && !LOCKDEP_SMALL
  1183. range 10 30
  1184. default 19
  1185. help
  1186. Try increasing this value if you hit "BUG: MAX_STACK_TRACE_ENTRIES too low!" message.
  1187. config LOCKDEP_STACK_TRACE_HASH_BITS
  1188. int "Bitsize for STACK_TRACE_HASH_SIZE"
  1189. depends on LOCKDEP && !LOCKDEP_SMALL
  1190. range 10 30
  1191. default 14
  1192. help
  1193. Try increasing this value if you need large MAX_STACK_TRACE_ENTRIES.
  1194. config LOCKDEP_CIRCULAR_QUEUE_BITS
  1195. int "Bitsize for elements in circular_queue struct"
  1196. depends on LOCKDEP
  1197. range 10 30
  1198. default 12
  1199. help
  1200. Try increasing this value if you hit "lockdep bfs error:-1" warning due to __cq_enqueue() failure.
  1201. config DEBUG_LOCKDEP
  1202. bool "Lock dependency engine debugging"
  1203. depends on DEBUG_KERNEL && LOCKDEP
  1204. select DEBUG_IRQFLAGS
  1205. help
  1206. If you say Y here, the lock dependency engine will do
  1207. additional runtime checks to debug itself, at the price
  1208. of more runtime overhead.
  1209. config DEBUG_ATOMIC_SLEEP
  1210. bool "Sleep inside atomic section checking"
  1211. select PREEMPT_COUNT
  1212. depends on DEBUG_KERNEL
  1213. depends on !ARCH_NO_PREEMPT
  1214. help
  1215. If you say Y here, various routines which may sleep will become very
  1216. noisy if they are called inside atomic sections: when a spinlock is
  1217. held, inside an rcu read side critical section, inside preempt disabled
  1218. sections, inside an interrupt, etc...
  1219. config DEBUG_LOCKING_API_SELFTESTS
  1220. bool "Locking API boot-time self-tests"
  1221. depends on DEBUG_KERNEL
  1222. help
  1223. Say Y here if you want the kernel to run a short self-test during
  1224. bootup. The self-test checks whether common types of locking bugs
  1225. are detected by debugging mechanisms or not. (if you disable
  1226. lock debugging then those bugs won't be detected of course.)
  1227. The following locking APIs are covered: spinlocks, rwlocks,
  1228. mutexes and rwsems.
  1229. config LOCK_TORTURE_TEST
  1230. tristate "torture tests for locking"
  1231. depends on DEBUG_KERNEL
  1232. select TORTURE_TEST
  1233. help
  1234. This option provides a kernel module that runs torture tests
  1235. on kernel locking primitives. The kernel module may be built
  1236. after the fact on the running kernel to be tested, if desired.
  1237. Say Y here if you want kernel locking-primitive torture tests
  1238. to be built into the kernel.
  1239. Say M if you want these torture tests to build as a module.
  1240. Say N if you are unsure.
  1241. config WW_MUTEX_SELFTEST
  1242. tristate "Wait/wound mutex selftests"
  1243. help
  1244. This option provides a kernel module that runs tests on the
  1245. on the struct ww_mutex locking API.
  1246. It is recommended to enable DEBUG_WW_MUTEX_SLOWPATH in conjunction
  1247. with this test harness.
  1248. Say M if you want these self tests to build as a module.
  1249. Say N if you are unsure.
  1250. config SCF_TORTURE_TEST
  1251. tristate "torture tests for smp_call_function*()"
  1252. depends on DEBUG_KERNEL
  1253. select TORTURE_TEST
  1254. help
  1255. This option provides a kernel module that runs torture tests
  1256. on the smp_call_function() family of primitives. The kernel
  1257. module may be built after the fact on the running kernel to
  1258. be tested, if desired.
  1259. config CSD_LOCK_WAIT_DEBUG
  1260. bool "Debugging for csd_lock_wait(), called from smp_call_function*()"
  1261. depends on DEBUG_KERNEL
  1262. depends on 64BIT
  1263. default n
  1264. help
  1265. This option enables debug prints when CPUs are slow to respond
  1266. to the smp_call_function*() IPI wrappers. These debug prints
  1267. include the IPI handler function currently executing (if any)
  1268. and relevant stack traces.
  1269. endmenu # lock debugging
  1270. config TRACE_IRQFLAGS
  1271. depends on TRACE_IRQFLAGS_SUPPORT
  1272. bool
  1273. help
  1274. Enables hooks to interrupt enabling and disabling for
  1275. either tracing or lock debugging.
  1276. config TRACE_IRQFLAGS_NMI
  1277. def_bool y
  1278. depends on TRACE_IRQFLAGS
  1279. depends on TRACE_IRQFLAGS_NMI_SUPPORT
  1280. config DEBUG_IRQFLAGS
  1281. bool "Debug IRQ flag manipulation"
  1282. help
  1283. Enables checks for potentially unsafe enabling or disabling of
  1284. interrupts, such as calling raw_local_irq_restore() when interrupts
  1285. are enabled.
  1286. config STACKTRACE
  1287. bool "Stack backtrace support"
  1288. depends on STACKTRACE_SUPPORT
  1289. help
  1290. This option causes the kernel to create a /proc/pid/stack for
  1291. every process, showing its current stack trace.
  1292. It is also used by various kernel debugging features that require
  1293. stack trace generation.
  1294. config WARN_ALL_UNSEEDED_RANDOM
  1295. bool "Warn for all uses of unseeded randomness"
  1296. default n
  1297. help
  1298. Some parts of the kernel contain bugs relating to their use of
  1299. cryptographically secure random numbers before it's actually possible
  1300. to generate those numbers securely. This setting ensures that these
  1301. flaws don't go unnoticed, by enabling a message, should this ever
  1302. occur. This will allow people with obscure setups to know when things
  1303. are going wrong, so that they might contact developers about fixing
  1304. it.
  1305. Unfortunately, on some models of some architectures getting
  1306. a fully seeded CRNG is extremely difficult, and so this can
  1307. result in dmesg getting spammed for a surprisingly long
  1308. time. This is really bad from a security perspective, and
  1309. so architecture maintainers really need to do what they can
  1310. to get the CRNG seeded sooner after the system is booted.
  1311. However, since users cannot do anything actionable to
  1312. address this, by default this option is disabled.
  1313. Say Y here if you want to receive warnings for all uses of
  1314. unseeded randomness. This will be of use primarily for
  1315. those developers interested in improving the security of
  1316. Linux kernels running on their architecture (or
  1317. subarchitecture).
  1318. config DEBUG_KOBJECT
  1319. bool "kobject debugging"
  1320. depends on DEBUG_KERNEL
  1321. help
  1322. If you say Y here, some extra kobject debugging messages will be sent
  1323. to the syslog.
  1324. config DEBUG_KOBJECT_RELEASE
  1325. bool "kobject release debugging"
  1326. depends on DEBUG_OBJECTS_TIMERS
  1327. help
  1328. kobjects are reference counted objects. This means that their
  1329. last reference count put is not predictable, and the kobject can
  1330. live on past the point at which a driver decides to drop its
  1331. initial reference to the kobject gained on allocation. An
  1332. example of this would be a struct device which has just been
  1333. unregistered.
  1334. However, some buggy drivers assume that after such an operation,
  1335. the memory backing the kobject can be immediately freed. This
  1336. goes completely against the principles of a refcounted object.
  1337. If you say Y here, the kernel will delay the release of kobjects
  1338. on the last reference count to improve the visibility of this
  1339. kind of kobject release bug.
  1340. config HAVE_DEBUG_BUGVERBOSE
  1341. bool
  1342. menu "Debug kernel data structures"
  1343. config DEBUG_LIST
  1344. bool "Debug linked list manipulation"
  1345. depends on DEBUG_KERNEL || BUG_ON_DATA_CORRUPTION
  1346. help
  1347. Enable this to turn on extended checks in the linked-list
  1348. walking routines.
  1349. If unsure, say N.
  1350. config DEBUG_PLIST
  1351. bool "Debug priority linked list manipulation"
  1352. depends on DEBUG_KERNEL
  1353. help
  1354. Enable this to turn on extended checks in the priority-ordered
  1355. linked-list (plist) walking routines. This checks the entire
  1356. list multiple times during each manipulation.
  1357. If unsure, say N.
  1358. config DEBUG_SG
  1359. bool "Debug SG table operations"
  1360. depends on DEBUG_KERNEL
  1361. help
  1362. Enable this to turn on checks on scatter-gather tables. This can
  1363. help find problems with drivers that do not properly initialize
  1364. their sg tables.
  1365. If unsure, say N.
  1366. config DEBUG_NOTIFIERS
  1367. bool "Debug notifier call chains"
  1368. depends on DEBUG_KERNEL
  1369. help
  1370. Enable this to turn on sanity checking for notifier call chains.
  1371. This is most useful for kernel developers to make sure that
  1372. modules properly unregister themselves from notifier chains.
  1373. This is a relatively cheap check but if you care about maximum
  1374. performance, say N.
  1375. config BUG_ON_DATA_CORRUPTION
  1376. bool "Trigger a BUG when data corruption is detected"
  1377. select DEBUG_LIST
  1378. help
  1379. Select this option if the kernel should BUG when it encounters
  1380. data corruption in kernel memory structures when they get checked
  1381. for validity.
  1382. If unsure, say N.
  1383. config DEBUG_MAPLE_TREE
  1384. bool "Debug maple trees"
  1385. depends on DEBUG_KERNEL
  1386. help
  1387. Enable maple tree debugging information and extra validations.
  1388. If unsure, say N.
  1389. endmenu
  1390. config DEBUG_CREDENTIALS
  1391. bool "Debug credential management"
  1392. depends on DEBUG_KERNEL
  1393. help
  1394. Enable this to turn on some debug checking for credential
  1395. management. The additional code keeps track of the number of
  1396. pointers from task_structs to any given cred struct, and checks to
  1397. see that this number never exceeds the usage count of the cred
  1398. struct.
  1399. Furthermore, if SELinux is enabled, this also checks that the
  1400. security pointer in the cred struct is never seen to be invalid.
  1401. If unsure, say N.
  1402. source "kernel/rcu/Kconfig.debug"
  1403. config DEBUG_WQ_FORCE_RR_CPU
  1404. bool "Force round-robin CPU selection for unbound work items"
  1405. depends on DEBUG_KERNEL
  1406. default n
  1407. help
  1408. Workqueue used to implicitly guarantee that work items queued
  1409. without explicit CPU specified are put on the local CPU. This
  1410. guarantee is no longer true and while local CPU is still
  1411. preferred work items may be put on foreign CPUs. Kernel
  1412. parameter "workqueue.debug_force_rr_cpu" is added to force
  1413. round-robin CPU selection to flush out usages which depend on the
  1414. now broken guarantee. This config option enables the debug
  1415. feature by default. When enabled, memory and cache locality will
  1416. be impacted.
  1417. config CPU_HOTPLUG_STATE_CONTROL
  1418. bool "Enable CPU hotplug state control"
  1419. depends on DEBUG_KERNEL
  1420. depends on HOTPLUG_CPU
  1421. default n
  1422. help
  1423. Allows to write steps between "offline" and "online" to the CPUs
  1424. sysfs target file so states can be stepped granular. This is a debug
  1425. option for now as the hotplug machinery cannot be stopped and
  1426. restarted at arbitrary points yet.
  1427. Say N if your are unsure.
  1428. config LATENCYTOP
  1429. bool "Latency measuring infrastructure"
  1430. depends on DEBUG_KERNEL
  1431. depends on STACKTRACE_SUPPORT
  1432. depends on PROC_FS
  1433. depends on FRAME_POINTER || MIPS || PPC || S390 || MICROBLAZE || ARM || ARC || X86
  1434. select KALLSYMS
  1435. select KALLSYMS_ALL
  1436. select STACKTRACE
  1437. select SCHEDSTATS
  1438. help
  1439. Enable this option if you want to use the LatencyTOP tool
  1440. to find out which userspace is blocking on what kernel operations.
  1441. source "kernel/trace/Kconfig"
  1442. config PROVIDE_OHCI1394_DMA_INIT
  1443. bool "Remote debugging over FireWire early on boot"
  1444. depends on PCI && X86
  1445. help
  1446. If you want to debug problems which hang or crash the kernel early
  1447. on boot and the crashing machine has a FireWire port, you can use
  1448. this feature to remotely access the memory of the crashed machine
  1449. over FireWire. This employs remote DMA as part of the OHCI1394
  1450. specification which is now the standard for FireWire controllers.
  1451. With remote DMA, you can monitor the printk buffer remotely using
  1452. firescope and access all memory below 4GB using fireproxy from gdb.
  1453. Even controlling a kernel debugger is possible using remote DMA.
  1454. Usage:
  1455. If ohci1394_dma=early is used as boot parameter, it will initialize
  1456. all OHCI1394 controllers which are found in the PCI config space.
  1457. As all changes to the FireWire bus such as enabling and disabling
  1458. devices cause a bus reset and thereby disable remote DMA for all
  1459. devices, be sure to have the cable plugged and FireWire enabled on
  1460. the debugging host before booting the debug target for debugging.
  1461. This code (~1k) is freed after boot. By then, the firewire stack
  1462. in charge of the OHCI-1394 controllers should be used instead.
  1463. See Documentation/core-api/debugging-via-ohci1394.rst for more information.
  1464. source "samples/Kconfig"
  1465. config ARCH_HAS_DEVMEM_IS_ALLOWED
  1466. bool
  1467. config STRICT_DEVMEM
  1468. bool "Filter access to /dev/mem"
  1469. depends on MMU && DEVMEM
  1470. depends on ARCH_HAS_DEVMEM_IS_ALLOWED || GENERIC_LIB_DEVMEM_IS_ALLOWED
  1471. default y if PPC || X86 || ARM64
  1472. help
  1473. If this option is disabled, you allow userspace (root) access to all
  1474. of memory, including kernel and userspace memory. Accidental
  1475. access to this is obviously disastrous, but specific access can
  1476. be used by people debugging the kernel. Note that with PAT support
  1477. enabled, even in this case there are restrictions on /dev/mem
  1478. use due to the cache aliasing requirements.
  1479. If this option is switched on, and IO_STRICT_DEVMEM=n, the /dev/mem
  1480. file only allows userspace access to PCI space and the BIOS code and
  1481. data regions. This is sufficient for dosemu and X and all common
  1482. users of /dev/mem.
  1483. If in doubt, say Y.
  1484. config IO_STRICT_DEVMEM
  1485. bool "Filter I/O access to /dev/mem"
  1486. depends on STRICT_DEVMEM
  1487. help
  1488. If this option is disabled, you allow userspace (root) access to all
  1489. io-memory regardless of whether a driver is actively using that
  1490. range. Accidental access to this is obviously disastrous, but
  1491. specific access can be used by people debugging kernel drivers.
  1492. If this option is switched on, the /dev/mem file only allows
  1493. userspace access to *idle* io-memory ranges (see /proc/iomem) This
  1494. may break traditional users of /dev/mem (dosemu, legacy X, etc...)
  1495. if the driver using a given range cannot be disabled.
  1496. If in doubt, say Y.
  1497. menu "$(SRCARCH) Debugging"
  1498. source "arch/$(SRCARCH)/Kconfig.debug"
  1499. endmenu
  1500. menu "Kernel Testing and Coverage"
  1501. source "lib/kunit/Kconfig"
  1502. config NOTIFIER_ERROR_INJECTION
  1503. tristate "Notifier error injection"
  1504. depends on DEBUG_KERNEL
  1505. select DEBUG_FS
  1506. help
  1507. This option provides the ability to inject artificial errors to
  1508. specified notifier chain callbacks. It is useful to test the error
  1509. handling of notifier call chain failures.
  1510. Say N if unsure.
  1511. config PM_NOTIFIER_ERROR_INJECT
  1512. tristate "PM notifier error injection module"
  1513. depends on PM && NOTIFIER_ERROR_INJECTION
  1514. default m if PM_DEBUG
  1515. help
  1516. This option provides the ability to inject artificial errors to
  1517. PM notifier chain callbacks. It is controlled through debugfs
  1518. interface /sys/kernel/debug/notifier-error-inject/pm
  1519. If the notifier call chain should be failed with some events
  1520. notified, write the error code to "actions/<notifier event>/error".
  1521. Example: Inject PM suspend error (-12 = -ENOMEM)
  1522. # cd /sys/kernel/debug/notifier-error-inject/pm/
  1523. # echo -12 > actions/PM_SUSPEND_PREPARE/error
  1524. # echo mem > /sys/power/state
  1525. bash: echo: write error: Cannot allocate memory
  1526. To compile this code as a module, choose M here: the module will
  1527. be called pm-notifier-error-inject.
  1528. If unsure, say N.
  1529. config OF_RECONFIG_NOTIFIER_ERROR_INJECT
  1530. tristate "OF reconfig notifier error injection module"
  1531. depends on OF_DYNAMIC && NOTIFIER_ERROR_INJECTION
  1532. help
  1533. This option provides the ability to inject artificial errors to
  1534. OF reconfig notifier chain callbacks. It is controlled
  1535. through debugfs interface under
  1536. /sys/kernel/debug/notifier-error-inject/OF-reconfig/
  1537. If the notifier call chain should be failed with some events
  1538. notified, write the error code to "actions/<notifier event>/error".
  1539. To compile this code as a module, choose M here: the module will
  1540. be called of-reconfig-notifier-error-inject.
  1541. If unsure, say N.
  1542. config NETDEV_NOTIFIER_ERROR_INJECT
  1543. tristate "Netdev notifier error injection module"
  1544. depends on NET && NOTIFIER_ERROR_INJECTION
  1545. help
  1546. This option provides the ability to inject artificial errors to
  1547. netdevice notifier chain callbacks. It is controlled through debugfs
  1548. interface /sys/kernel/debug/notifier-error-inject/netdev
  1549. If the notifier call chain should be failed with some events
  1550. notified, write the error code to "actions/<notifier event>/error".
  1551. Example: Inject netdevice mtu change error (-22 = -EINVAL)
  1552. # cd /sys/kernel/debug/notifier-error-inject/netdev
  1553. # echo -22 > actions/NETDEV_CHANGEMTU/error
  1554. # ip link set eth0 mtu 1024
  1555. RTNETLINK answers: Invalid argument
  1556. To compile this code as a module, choose M here: the module will
  1557. be called netdev-notifier-error-inject.
  1558. If unsure, say N.
  1559. config FUNCTION_ERROR_INJECTION
  1560. bool "Fault-injections of functions"
  1561. depends on HAVE_FUNCTION_ERROR_INJECTION && KPROBES
  1562. help
  1563. Add fault injections into various functions that are annotated with
  1564. ALLOW_ERROR_INJECTION() in the kernel. BPF may also modify the return
  1565. value of theses functions. This is useful to test error paths of code.
  1566. If unsure, say N
  1567. config FAULT_INJECTION
  1568. bool "Fault-injection framework"
  1569. depends on DEBUG_KERNEL
  1570. help
  1571. Provide fault-injection framework.
  1572. For more details, see Documentation/fault-injection/.
  1573. config FAILSLAB
  1574. bool "Fault-injection capability for kmalloc"
  1575. depends on FAULT_INJECTION
  1576. depends on SLAB || SLUB
  1577. help
  1578. Provide fault-injection capability for kmalloc.
  1579. config FAIL_PAGE_ALLOC
  1580. bool "Fault-injection capability for alloc_pages()"
  1581. depends on FAULT_INJECTION
  1582. help
  1583. Provide fault-injection capability for alloc_pages().
  1584. config FAULT_INJECTION_USERCOPY
  1585. bool "Fault injection capability for usercopy functions"
  1586. depends on FAULT_INJECTION
  1587. help
  1588. Provides fault-injection capability to inject failures
  1589. in usercopy functions (copy_from_user(), get_user(), ...).
  1590. config FAIL_MAKE_REQUEST
  1591. bool "Fault-injection capability for disk IO"
  1592. depends on FAULT_INJECTION && BLOCK
  1593. help
  1594. Provide fault-injection capability for disk IO.
  1595. config FAIL_IO_TIMEOUT
  1596. bool "Fault-injection capability for faking disk interrupts"
  1597. depends on FAULT_INJECTION && BLOCK
  1598. help
  1599. Provide fault-injection capability on end IO handling. This
  1600. will make the block layer "forget" an interrupt as configured,
  1601. thus exercising the error handling.
  1602. Only works with drivers that use the generic timeout handling,
  1603. for others it won't do anything.
  1604. config FAIL_FUTEX
  1605. bool "Fault-injection capability for futexes"
  1606. select DEBUG_FS
  1607. depends on FAULT_INJECTION && FUTEX
  1608. help
  1609. Provide fault-injection capability for futexes.
  1610. config FAULT_INJECTION_DEBUG_FS
  1611. bool "Debugfs entries for fault-injection capabilities"
  1612. depends on FAULT_INJECTION && SYSFS && DEBUG_FS
  1613. help
  1614. Enable configuration of fault-injection capabilities via debugfs.
  1615. config FAIL_FUNCTION
  1616. bool "Fault-injection capability for functions"
  1617. depends on FAULT_INJECTION_DEBUG_FS && FUNCTION_ERROR_INJECTION
  1618. help
  1619. Provide function-based fault-injection capability.
  1620. This will allow you to override a specific function with a return
  1621. with given return value. As a result, function caller will see
  1622. an error value and have to handle it. This is useful to test the
  1623. error handling in various subsystems.
  1624. config FAIL_MMC_REQUEST
  1625. bool "Fault-injection capability for MMC IO"
  1626. depends on FAULT_INJECTION_DEBUG_FS && MMC
  1627. help
  1628. Provide fault-injection capability for MMC IO.
  1629. This will make the mmc core return data errors. This is
  1630. useful to test the error handling in the mmc block device
  1631. and to test how the mmc host driver handles retries from
  1632. the block device.
  1633. config FAIL_SUNRPC
  1634. bool "Fault-injection capability for SunRPC"
  1635. depends on FAULT_INJECTION_DEBUG_FS && SUNRPC_DEBUG
  1636. help
  1637. Provide fault-injection capability for SunRPC and
  1638. its consumers.
  1639. config FAULT_INJECTION_STACKTRACE_FILTER
  1640. bool "stacktrace filter for fault-injection capabilities"
  1641. depends on FAULT_INJECTION_DEBUG_FS && STACKTRACE_SUPPORT
  1642. depends on !X86_64
  1643. select STACKTRACE
  1644. depends on FRAME_POINTER || MIPS || PPC || S390 || MICROBLAZE || ARM || ARC || X86
  1645. help
  1646. Provide stacktrace filter for fault-injection capabilities
  1647. config ARCH_HAS_KCOV
  1648. bool
  1649. help
  1650. An architecture should select this when it can successfully
  1651. build and run with CONFIG_KCOV. This typically requires
  1652. disabling instrumentation for some early boot code.
  1653. config CC_HAS_SANCOV_TRACE_PC
  1654. def_bool $(cc-option,-fsanitize-coverage=trace-pc)
  1655. config KCOV
  1656. bool "Code coverage for fuzzing"
  1657. depends on ARCH_HAS_KCOV
  1658. depends on CC_HAS_SANCOV_TRACE_PC || GCC_PLUGINS
  1659. depends on !ARCH_WANTS_NO_INSTR || HAVE_NOINSTR_HACK || \
  1660. GCC_VERSION >= 120000 || CLANG_VERSION >= 130000
  1661. select DEBUG_FS
  1662. select GCC_PLUGIN_SANCOV if !CC_HAS_SANCOV_TRACE_PC
  1663. select OBJTOOL if HAVE_NOINSTR_HACK
  1664. help
  1665. KCOV exposes kernel code coverage information in a form suitable
  1666. for coverage-guided fuzzing (randomized testing).
  1667. If RANDOMIZE_BASE is enabled, PC values will not be stable across
  1668. different machines and across reboots. If you need stable PC values,
  1669. disable RANDOMIZE_BASE.
  1670. For more details, see Documentation/dev-tools/kcov.rst.
  1671. config KCOV_ENABLE_COMPARISONS
  1672. bool "Enable comparison operands collection by KCOV"
  1673. depends on KCOV
  1674. depends on $(cc-option,-fsanitize-coverage=trace-cmp)
  1675. help
  1676. KCOV also exposes operands of every comparison in the instrumented
  1677. code along with operand sizes and PCs of the comparison instructions.
  1678. These operands can be used by fuzzing engines to improve the quality
  1679. of fuzzing coverage.
  1680. config KCOV_INSTRUMENT_ALL
  1681. bool "Instrument all code by default"
  1682. depends on KCOV
  1683. default y
  1684. help
  1685. If you are doing generic system call fuzzing (like e.g. syzkaller),
  1686. then you will want to instrument the whole kernel and you should
  1687. say y here. If you are doing more targeted fuzzing (like e.g.
  1688. filesystem fuzzing with AFL) then you will want to enable coverage
  1689. for more specific subsets of files, and should say n here.
  1690. config KCOV_IRQ_AREA_SIZE
  1691. hex "Size of interrupt coverage collection area in words"
  1692. depends on KCOV
  1693. default 0x40000
  1694. help
  1695. KCOV uses preallocated per-cpu areas to collect coverage from
  1696. soft interrupts. This specifies the size of those areas in the
  1697. number of unsigned long words.
  1698. menuconfig RUNTIME_TESTING_MENU
  1699. bool "Runtime Testing"
  1700. def_bool y
  1701. if RUNTIME_TESTING_MENU
  1702. config LKDTM
  1703. tristate "Linux Kernel Dump Test Tool Module"
  1704. depends on DEBUG_FS
  1705. help
  1706. This module enables testing of the different dumping mechanisms by
  1707. inducing system failures at predefined crash points.
  1708. If you don't need it: say N
  1709. Choose M here to compile this code as a module. The module will be
  1710. called lkdtm.
  1711. Documentation on how to use the module can be found in
  1712. Documentation/fault-injection/provoke-crashes.rst
  1713. config CPUMASK_KUNIT_TEST
  1714. tristate "KUnit test for cpumask" if !KUNIT_ALL_TESTS
  1715. depends on KUNIT
  1716. default KUNIT_ALL_TESTS
  1717. help
  1718. Enable to turn on cpumask tests, running at boot or module load time.
  1719. For more information on KUnit and unit tests in general, please refer
  1720. to the KUnit documentation in Documentation/dev-tools/kunit/.
  1721. If unsure, say N.
  1722. config TEST_LIST_SORT
  1723. tristate "Linked list sorting test" if !KUNIT_ALL_TESTS
  1724. depends on KUNIT
  1725. default KUNIT_ALL_TESTS
  1726. help
  1727. Enable this to turn on 'list_sort()' function test. This test is
  1728. executed only once during system boot (so affects only boot time),
  1729. or at module load time.
  1730. If unsure, say N.
  1731. config TEST_MIN_HEAP
  1732. tristate "Min heap test"
  1733. depends on DEBUG_KERNEL || m
  1734. help
  1735. Enable this to turn on min heap function tests. This test is
  1736. executed only once during system boot (so affects only boot time),
  1737. or at module load time.
  1738. If unsure, say N.
  1739. config TEST_SORT
  1740. tristate "Array-based sort test" if !KUNIT_ALL_TESTS
  1741. depends on KUNIT
  1742. select STACKTRACE if ARCH_CORRECT_STACKTRACE_ON_KRETPROBE
  1743. default KUNIT_ALL_TESTS
  1744. help
  1745. This option enables the self-test function of 'sort()' at boot,
  1746. or at module load time.
  1747. If unsure, say N.
  1748. config TEST_DIV64
  1749. tristate "64bit/32bit division and modulo test"
  1750. depends on DEBUG_KERNEL || m
  1751. help
  1752. Enable this to turn on 'do_div()' function test. This test is
  1753. executed only once during system boot (so affects only boot time),
  1754. or at module load time.
  1755. If unsure, say N.
  1756. config KPROBES_SANITY_TEST
  1757. tristate "Kprobes sanity tests" if !KUNIT_ALL_TESTS
  1758. depends on DEBUG_KERNEL
  1759. depends on KPROBES
  1760. depends on KUNIT
  1761. select STACKTRACE if ARCH_CORRECT_STACKTRACE_ON_KRETPROBE
  1762. default KUNIT_ALL_TESTS
  1763. help
  1764. This option provides for testing basic kprobes functionality on
  1765. boot. Samples of kprobe and kretprobe are inserted and
  1766. verified for functionality.
  1767. Say N if you are unsure.
  1768. config FPROBE_SANITY_TEST
  1769. bool "Self test for fprobe"
  1770. depends on DEBUG_KERNEL
  1771. depends on FPROBE
  1772. depends on KUNIT=y
  1773. help
  1774. This option will enable testing the fprobe when the system boot.
  1775. A series of tests are made to verify that the fprobe is functioning
  1776. properly.
  1777. Say N if you are unsure.
  1778. config BACKTRACE_SELF_TEST
  1779. tristate "Self test for the backtrace code"
  1780. depends on DEBUG_KERNEL
  1781. help
  1782. This option provides a kernel module that can be used to test
  1783. the kernel stack backtrace code. This option is not useful
  1784. for distributions or general kernels, but only for kernel
  1785. developers working on architecture code.
  1786. Note that if you want to also test saved backtraces, you will
  1787. have to enable STACKTRACE as well.
  1788. Say N if you are unsure.
  1789. config TEST_REF_TRACKER
  1790. tristate "Self test for reference tracker"
  1791. depends on DEBUG_KERNEL && STACKTRACE_SUPPORT
  1792. select REF_TRACKER
  1793. help
  1794. This option provides a kernel module performing tests
  1795. using reference tracker infrastructure.
  1796. Say N if you are unsure.
  1797. config RBTREE_TEST
  1798. tristate "Red-Black tree test"
  1799. depends on DEBUG_KERNEL
  1800. help
  1801. A benchmark measuring the performance of the rbtree library.
  1802. Also includes rbtree invariant checks.
  1803. config REED_SOLOMON_TEST
  1804. tristate "Reed-Solomon library test"
  1805. depends on DEBUG_KERNEL || m
  1806. select REED_SOLOMON
  1807. select REED_SOLOMON_ENC16
  1808. select REED_SOLOMON_DEC16
  1809. help
  1810. This option enables the self-test function of rslib at boot,
  1811. or at module load time.
  1812. If unsure, say N.
  1813. config INTERVAL_TREE_TEST
  1814. tristate "Interval tree test"
  1815. depends on DEBUG_KERNEL
  1816. select INTERVAL_TREE
  1817. help
  1818. A benchmark measuring the performance of the interval tree library
  1819. config PERCPU_TEST
  1820. tristate "Per cpu operations test"
  1821. depends on m && DEBUG_KERNEL
  1822. help
  1823. Enable this option to build test module which validates per-cpu
  1824. operations.
  1825. If unsure, say N.
  1826. config ATOMIC64_SELFTEST
  1827. tristate "Perform an atomic64_t self-test"
  1828. help
  1829. Enable this option to test the atomic64_t functions at boot or
  1830. at module load time.
  1831. If unsure, say N.
  1832. config ASYNC_RAID6_TEST
  1833. tristate "Self test for hardware accelerated raid6 recovery"
  1834. depends on ASYNC_RAID6_RECOV
  1835. select ASYNC_MEMCPY
  1836. help
  1837. This is a one-shot self test that permutes through the
  1838. recovery of all the possible two disk failure scenarios for a
  1839. N-disk array. Recovery is performed with the asynchronous
  1840. raid6 recovery routines, and will optionally use an offload
  1841. engine if one is available.
  1842. If unsure, say N.
  1843. config TEST_HEXDUMP
  1844. tristate "Test functions located in the hexdump module at runtime"
  1845. config STRING_SELFTEST
  1846. tristate "Test string functions at runtime"
  1847. config TEST_STRING_HELPERS
  1848. tristate "Test functions located in the string_helpers module at runtime"
  1849. config TEST_STRSCPY
  1850. tristate "Test strscpy*() family of functions at runtime"
  1851. config TEST_KSTRTOX
  1852. tristate "Test kstrto*() family of functions at runtime"
  1853. config TEST_PRINTF
  1854. tristate "Test printf() family of functions at runtime"
  1855. config TEST_SCANF
  1856. tristate "Test scanf() family of functions at runtime"
  1857. config TEST_BITMAP
  1858. tristate "Test bitmap_*() family of functions at runtime"
  1859. help
  1860. Enable this option to test the bitmap functions at boot.
  1861. If unsure, say N.
  1862. config TEST_UUID
  1863. tristate "Test functions located in the uuid module at runtime"
  1864. config TEST_XARRAY
  1865. tristate "Test the XArray code at runtime"
  1866. config TEST_MAPLE_TREE
  1867. select DEBUG_MAPLE_TREE
  1868. tristate "Test the Maple Tree code at runtime"
  1869. config TEST_RHASHTABLE
  1870. tristate "Perform selftest on resizable hash table"
  1871. help
  1872. Enable this option to test the rhashtable functions at boot.
  1873. If unsure, say N.
  1874. config TEST_SIPHASH
  1875. tristate "Perform selftest on siphash functions"
  1876. help
  1877. Enable this option to test the kernel's siphash (<linux/siphash.h>) hash
  1878. functions on boot (or module load).
  1879. This is intended to help people writing architecture-specific
  1880. optimized versions. If unsure, say N.
  1881. config TEST_IDA
  1882. tristate "Perform selftest on IDA functions"
  1883. config TEST_PARMAN
  1884. tristate "Perform selftest on priority array manager"
  1885. depends on PARMAN
  1886. help
  1887. Enable this option to test priority array manager on boot
  1888. (or module load).
  1889. If unsure, say N.
  1890. config TEST_IRQ_TIMINGS
  1891. bool "IRQ timings selftest"
  1892. depends on IRQ_TIMINGS
  1893. help
  1894. Enable this option to test the irq timings code on boot.
  1895. If unsure, say N.
  1896. config TEST_LKM
  1897. tristate "Test module loading with 'hello world' module"
  1898. depends on m
  1899. help
  1900. This builds the "test_module" module that emits "Hello, world"
  1901. on printk when loaded. It is designed to be used for basic
  1902. evaluation of the module loading subsystem (for example when
  1903. validating module verification). It lacks any extra dependencies,
  1904. and will not normally be loaded by the system unless explicitly
  1905. requested by name.
  1906. If unsure, say N.
  1907. config TEST_BITOPS
  1908. tristate "Test module for compilation of bitops operations"
  1909. depends on m
  1910. help
  1911. This builds the "test_bitops" module that is much like the
  1912. TEST_LKM module except that it does a basic exercise of the
  1913. set/clear_bit macros and get_count_order/long to make sure there are
  1914. no compiler warnings from C=1 sparse checker or -Wextra
  1915. compilations. It has no dependencies and doesn't run or load unless
  1916. explicitly requested by name. for example: modprobe test_bitops.
  1917. If unsure, say N.
  1918. config TEST_VMALLOC
  1919. tristate "Test module for stress/performance analysis of vmalloc allocator"
  1920. default n
  1921. depends on MMU
  1922. depends on m
  1923. help
  1924. This builds the "test_vmalloc" module that should be used for
  1925. stress and performance analysis. So, any new change for vmalloc
  1926. subsystem can be evaluated from performance and stability point
  1927. of view.
  1928. If unsure, say N.
  1929. config TEST_USER_COPY
  1930. tristate "Test user/kernel boundary protections"
  1931. depends on m
  1932. help
  1933. This builds the "test_user_copy" module that runs sanity checks
  1934. on the copy_to/from_user infrastructure, making sure basic
  1935. user/kernel boundary testing is working. If it fails to load,
  1936. a regression has been detected in the user/kernel memory boundary
  1937. protections.
  1938. If unsure, say N.
  1939. config TEST_BPF
  1940. tristate "Test BPF filter functionality"
  1941. depends on m && NET
  1942. help
  1943. This builds the "test_bpf" module that runs various test vectors
  1944. against the BPF interpreter or BPF JIT compiler depending on the
  1945. current setting. This is in particular useful for BPF JIT compiler
  1946. development, but also to run regression tests against changes in
  1947. the interpreter code. It also enables test stubs for eBPF maps and
  1948. verifier used by user space verifier testsuite.
  1949. If unsure, say N.
  1950. config TEST_BLACKHOLE_DEV
  1951. tristate "Test blackhole netdev functionality"
  1952. depends on m && NET
  1953. help
  1954. This builds the "test_blackhole_dev" module that validates the
  1955. data path through this blackhole netdev.
  1956. If unsure, say N.
  1957. config FIND_BIT_BENCHMARK
  1958. tristate "Test find_bit functions"
  1959. help
  1960. This builds the "test_find_bit" module that measure find_*_bit()
  1961. functions performance.
  1962. If unsure, say N.
  1963. config TEST_FIRMWARE
  1964. tristate "Test firmware loading via userspace interface"
  1965. depends on FW_LOADER
  1966. help
  1967. This builds the "test_firmware" module that creates a userspace
  1968. interface for testing firmware loading. This can be used to
  1969. control the triggering of firmware loading without needing an
  1970. actual firmware-using device. The contents can be rechecked by
  1971. userspace.
  1972. If unsure, say N.
  1973. config TEST_SYSCTL
  1974. tristate "sysctl test driver"
  1975. depends on PROC_SYSCTL
  1976. help
  1977. This builds the "test_sysctl" module. This driver enables to test the
  1978. proc sysctl interfaces available to drivers safely without affecting
  1979. production knobs which might alter system functionality.
  1980. If unsure, say N.
  1981. config BITFIELD_KUNIT
  1982. tristate "KUnit test bitfield functions at runtime" if !KUNIT_ALL_TESTS
  1983. depends on KUNIT
  1984. default KUNIT_ALL_TESTS
  1985. help
  1986. Enable this option to test the bitfield functions at boot.
  1987. KUnit tests run during boot and output the results to the debug log
  1988. in TAP format (http://testanything.org/). Only useful for kernel devs
  1989. running the KUnit test harness, and not intended for inclusion into a
  1990. production build.
  1991. For more information on KUnit and unit tests in general please refer
  1992. to the KUnit documentation in Documentation/dev-tools/kunit/.
  1993. If unsure, say N.
  1994. config HASH_KUNIT_TEST
  1995. tristate "KUnit Test for integer hash functions" if !KUNIT_ALL_TESTS
  1996. depends on KUNIT
  1997. default KUNIT_ALL_TESTS
  1998. help
  1999. Enable this option to test the kernel's string (<linux/stringhash.h>), and
  2000. integer (<linux/hash.h>) hash functions on boot.
  2001. KUnit tests run during boot and output the results to the debug log
  2002. in TAP format (https://testanything.org/). Only useful for kernel devs
  2003. running the KUnit test harness, and not intended for inclusion into a
  2004. production build.
  2005. For more information on KUnit and unit tests in general please refer
  2006. to the KUnit documentation in Documentation/dev-tools/kunit/.
  2007. This is intended to help people writing architecture-specific
  2008. optimized versions. If unsure, say N.
  2009. config RESOURCE_KUNIT_TEST
  2010. tristate "KUnit test for resource API" if !KUNIT_ALL_TESTS
  2011. depends on KUNIT
  2012. default KUNIT_ALL_TESTS
  2013. help
  2014. This builds the resource API unit test.
  2015. Tests the logic of API provided by resource.c and ioport.h.
  2016. For more information on KUnit and unit tests in general please refer
  2017. to the KUnit documentation in Documentation/dev-tools/kunit/.
  2018. If unsure, say N.
  2019. config SYSCTL_KUNIT_TEST
  2020. tristate "KUnit test for sysctl" if !KUNIT_ALL_TESTS
  2021. depends on KUNIT
  2022. default KUNIT_ALL_TESTS
  2023. help
  2024. This builds the proc sysctl unit test, which runs on boot.
  2025. Tests the API contract and implementation correctness of sysctl.
  2026. For more information on KUnit and unit tests in general please refer
  2027. to the KUnit documentation in Documentation/dev-tools/kunit/.
  2028. If unsure, say N.
  2029. config LIST_KUNIT_TEST
  2030. tristate "KUnit Test for Kernel Linked-list structures" if !KUNIT_ALL_TESTS
  2031. depends on KUNIT
  2032. default KUNIT_ALL_TESTS
  2033. help
  2034. This builds the linked list KUnit test suite.
  2035. It tests that the API and basic functionality of the list_head type
  2036. and associated macros.
  2037. KUnit tests run during boot and output the results to the debug log
  2038. in TAP format (https://testanything.org/). Only useful for kernel devs
  2039. running the KUnit test harness, and not intended for inclusion into a
  2040. production build.
  2041. For more information on KUnit and unit tests in general please refer
  2042. to the KUnit documentation in Documentation/dev-tools/kunit/.
  2043. If unsure, say N.
  2044. config LINEAR_RANGES_TEST
  2045. tristate "KUnit test for linear_ranges"
  2046. depends on KUNIT
  2047. select LINEAR_RANGES
  2048. help
  2049. This builds the linear_ranges unit test, which runs on boot.
  2050. Tests the linear_ranges logic correctness.
  2051. For more information on KUnit and unit tests in general please refer
  2052. to the KUnit documentation in Documentation/dev-tools/kunit/.
  2053. If unsure, say N.
  2054. config CMDLINE_KUNIT_TEST
  2055. tristate "KUnit test for cmdline API" if !KUNIT_ALL_TESTS
  2056. depends on KUNIT
  2057. default KUNIT_ALL_TESTS
  2058. help
  2059. This builds the cmdline API unit test.
  2060. Tests the logic of API provided by cmdline.c.
  2061. For more information on KUnit and unit tests in general please refer
  2062. to the KUnit documentation in Documentation/dev-tools/kunit/.
  2063. If unsure, say N.
  2064. config BITS_TEST
  2065. tristate "KUnit test for bits.h" if !KUNIT_ALL_TESTS
  2066. depends on KUNIT
  2067. default KUNIT_ALL_TESTS
  2068. help
  2069. This builds the bits unit test.
  2070. Tests the logic of macros defined in bits.h.
  2071. For more information on KUnit and unit tests in general please refer
  2072. to the KUnit documentation in Documentation/dev-tools/kunit/.
  2073. If unsure, say N.
  2074. config SLUB_KUNIT_TEST
  2075. tristate "KUnit test for SLUB cache error detection" if !KUNIT_ALL_TESTS
  2076. depends on SLUB_DEBUG && KUNIT
  2077. default KUNIT_ALL_TESTS
  2078. help
  2079. This builds SLUB allocator unit test.
  2080. Tests SLUB cache debugging functionality.
  2081. For more information on KUnit and unit tests in general please refer
  2082. to the KUnit documentation in Documentation/dev-tools/kunit/.
  2083. If unsure, say N.
  2084. config RATIONAL_KUNIT_TEST
  2085. tristate "KUnit test for rational.c" if !KUNIT_ALL_TESTS
  2086. depends on KUNIT && RATIONAL
  2087. default KUNIT_ALL_TESTS
  2088. help
  2089. This builds the rational math unit test.
  2090. For more information on KUnit and unit tests in general please refer
  2091. to the KUnit documentation in Documentation/dev-tools/kunit/.
  2092. If unsure, say N.
  2093. config MEMCPY_KUNIT_TEST
  2094. tristate "Test memcpy(), memmove(), and memset() functions at runtime" if !KUNIT_ALL_TESTS
  2095. depends on KUNIT
  2096. default KUNIT_ALL_TESTS
  2097. help
  2098. Builds unit tests for memcpy(), memmove(), and memset() functions.
  2099. For more information on KUnit and unit tests in general please refer
  2100. to the KUnit documentation in Documentation/dev-tools/kunit/.
  2101. If unsure, say N.
  2102. config IS_SIGNED_TYPE_KUNIT_TEST
  2103. tristate "Test is_signed_type() macro" if !KUNIT_ALL_TESTS
  2104. depends on KUNIT
  2105. default KUNIT_ALL_TESTS
  2106. help
  2107. Builds unit tests for the is_signed_type() macro.
  2108. For more information on KUnit and unit tests in general please refer
  2109. to the KUnit documentation in Documentation/dev-tools/kunit/.
  2110. If unsure, say N.
  2111. config OVERFLOW_KUNIT_TEST
  2112. tristate "Test check_*_overflow() functions at runtime" if !KUNIT_ALL_TESTS
  2113. depends on KUNIT
  2114. default KUNIT_ALL_TESTS
  2115. help
  2116. Builds unit tests for the check_*_overflow(), size_*(), allocation, and
  2117. related functions.
  2118. For more information on KUnit and unit tests in general please refer
  2119. to the KUnit documentation in Documentation/dev-tools/kunit/.
  2120. If unsure, say N.
  2121. config STACKINIT_KUNIT_TEST
  2122. tristate "Test level of stack variable initialization" if !KUNIT_ALL_TESTS
  2123. depends on KUNIT
  2124. default KUNIT_ALL_TESTS
  2125. help
  2126. Test if the kernel is zero-initializing stack variables and
  2127. padding. Coverage is controlled by compiler flags,
  2128. CONFIG_INIT_STACK_ALL_PATTERN, CONFIG_INIT_STACK_ALL_ZERO,
  2129. CONFIG_GCC_PLUGIN_STRUCTLEAK, CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF,
  2130. or CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL.
  2131. config FORTIFY_KUNIT_TEST
  2132. tristate "Test fortified str*() and mem*() function internals at runtime" if !KUNIT_ALL_TESTS
  2133. depends on KUNIT && FORTIFY_SOURCE
  2134. default KUNIT_ALL_TESTS
  2135. help
  2136. Builds unit tests for checking internals of FORTIFY_SOURCE as used
  2137. by the str*() and mem*() family of functions. For testing runtime
  2138. traps of FORTIFY_SOURCE, see LKDTM's "FORTIFY_*" tests.
  2139. config HW_BREAKPOINT_KUNIT_TEST
  2140. bool "Test hw_breakpoint constraints accounting" if !KUNIT_ALL_TESTS
  2141. depends on HAVE_HW_BREAKPOINT
  2142. depends on KUNIT=y
  2143. default KUNIT_ALL_TESTS
  2144. help
  2145. Tests for hw_breakpoint constraints accounting.
  2146. If unsure, say N.
  2147. config TEST_UDELAY
  2148. tristate "udelay test driver"
  2149. help
  2150. This builds the "udelay_test" module that helps to make sure
  2151. that udelay() is working properly.
  2152. If unsure, say N.
  2153. config TEST_STATIC_KEYS
  2154. tristate "Test static keys"
  2155. depends on m
  2156. help
  2157. Test the static key interfaces.
  2158. If unsure, say N.
  2159. config TEST_DYNAMIC_DEBUG
  2160. tristate "Test DYNAMIC_DEBUG"
  2161. depends on DYNAMIC_DEBUG
  2162. help
  2163. This module registers a tracer callback to count enabled
  2164. pr_debugs in a 'do_debugging' function, then alters their
  2165. enablements, calls the function, and compares counts.
  2166. If unsure, say N.
  2167. config TEST_KMOD
  2168. tristate "kmod stress tester"
  2169. depends on m
  2170. depends on NETDEVICES && NET_CORE && INET # for TUN
  2171. depends on BLOCK
  2172. depends on PAGE_SIZE_LESS_THAN_256KB # for BTRFS
  2173. select TEST_LKM
  2174. select XFS_FS
  2175. select TUN
  2176. select BTRFS_FS
  2177. help
  2178. Test the kernel's module loading mechanism: kmod. kmod implements
  2179. support to load modules using the Linux kernel's usermode helper.
  2180. This test provides a series of tests against kmod.
  2181. Although technically you can either build test_kmod as a module or
  2182. into the kernel we disallow building it into the kernel since
  2183. it stress tests request_module() and this will very likely cause
  2184. some issues by taking over precious threads available from other
  2185. module load requests, ultimately this could be fatal.
  2186. To run tests run:
  2187. tools/testing/selftests/kmod/kmod.sh --help
  2188. If unsure, say N.
  2189. config TEST_DEBUG_VIRTUAL
  2190. tristate "Test CONFIG_DEBUG_VIRTUAL feature"
  2191. depends on DEBUG_VIRTUAL
  2192. help
  2193. Test the kernel's ability to detect incorrect calls to
  2194. virt_to_phys() done against the non-linear part of the
  2195. kernel's virtual address map.
  2196. If unsure, say N.
  2197. config TEST_MEMCAT_P
  2198. tristate "Test memcat_p() helper function"
  2199. help
  2200. Test the memcat_p() helper for correctly merging two
  2201. pointer arrays together.
  2202. If unsure, say N.
  2203. config TEST_LIVEPATCH
  2204. tristate "Test livepatching"
  2205. default n
  2206. depends on DYNAMIC_DEBUG
  2207. depends on LIVEPATCH
  2208. depends on m
  2209. help
  2210. Test kernel livepatching features for correctness. The tests will
  2211. load test modules that will be livepatched in various scenarios.
  2212. To run all the livepatching tests:
  2213. make -C tools/testing/selftests TARGETS=livepatch run_tests
  2214. Alternatively, individual tests may be invoked:
  2215. tools/testing/selftests/livepatch/test-callbacks.sh
  2216. tools/testing/selftests/livepatch/test-livepatch.sh
  2217. tools/testing/selftests/livepatch/test-shadow-vars.sh
  2218. If unsure, say N.
  2219. config TEST_OBJAGG
  2220. tristate "Perform selftest on object aggreration manager"
  2221. default n
  2222. depends on OBJAGG
  2223. help
  2224. Enable this option to test object aggregation manager on boot
  2225. (or module load).
  2226. config TEST_MEMINIT
  2227. tristate "Test heap/page initialization"
  2228. help
  2229. Test if the kernel is zero-initializing heap and page allocations.
  2230. This can be useful to test init_on_alloc and init_on_free features.
  2231. If unsure, say N.
  2232. config TEST_HMM
  2233. tristate "Test HMM (Heterogeneous Memory Management)"
  2234. depends on TRANSPARENT_HUGEPAGE
  2235. depends on DEVICE_PRIVATE
  2236. select HMM_MIRROR
  2237. select MMU_NOTIFIER
  2238. help
  2239. This is a pseudo device driver solely for testing HMM.
  2240. Say M here if you want to build the HMM test module.
  2241. Doing so will allow you to run tools/testing/selftest/vm/hmm-tests.
  2242. If unsure, say N.
  2243. config TEST_FREE_PAGES
  2244. tristate "Test freeing pages"
  2245. help
  2246. Test that a memory leak does not occur due to a race between
  2247. freeing a block of pages and a speculative page reference.
  2248. Loading this module is safe if your kernel has the bug fixed.
  2249. If the bug is not fixed, it will leak gigabytes of memory and
  2250. probably OOM your system.
  2251. config TEST_FPU
  2252. tristate "Test floating point operations in kernel space"
  2253. depends on X86 && !KCOV_INSTRUMENT_ALL
  2254. help
  2255. Enable this option to add /sys/kernel/debug/selftest_helpers/test_fpu
  2256. which will trigger a sequence of floating point operations. This is used
  2257. for self-testing floating point control register setting in
  2258. kernel_fpu_begin().
  2259. If unsure, say N.
  2260. config TEST_CLOCKSOURCE_WATCHDOG
  2261. tristate "Test clocksource watchdog in kernel space"
  2262. depends on CLOCKSOURCE_WATCHDOG
  2263. help
  2264. Enable this option to create a kernel module that will trigger
  2265. a test of the clocksource watchdog. This module may be loaded
  2266. via modprobe or insmod in which case it will run upon being
  2267. loaded, or it may be built in, in which case it will run
  2268. shortly after boot.
  2269. If unsure, say N.
  2270. endif # RUNTIME_TESTING_MENU
  2271. config ARCH_USE_MEMTEST
  2272. bool
  2273. help
  2274. An architecture should select this when it uses early_memtest()
  2275. during boot process.
  2276. config MEMTEST
  2277. bool "Memtest"
  2278. depends on ARCH_USE_MEMTEST
  2279. help
  2280. This option adds a kernel parameter 'memtest', which allows memtest
  2281. to be set and executed.
  2282. memtest=0, mean disabled; -- default
  2283. memtest=1, mean do 1 test pattern;
  2284. ...
  2285. memtest=17, mean do 17 test patterns.
  2286. If you are unsure how to answer this question, answer N.
  2287. config HYPERV_TESTING
  2288. bool "Microsoft Hyper-V driver testing"
  2289. default n
  2290. depends on HYPERV && DEBUG_FS
  2291. help
  2292. Select this option to enable Hyper-V vmbus testing.
  2293. endmenu # "Kernel Testing and Coverage"
  2294. menu "Rust hacking"
  2295. config RUST_DEBUG_ASSERTIONS
  2296. bool "Debug assertions"
  2297. depends on RUST
  2298. help
  2299. Enables rustc's `-Cdebug-assertions` codegen option.
  2300. This flag lets you turn `cfg(debug_assertions)` conditional
  2301. compilation on or off. This can be used to enable extra debugging
  2302. code in development but not in production. For example, it controls
  2303. the behavior of the standard library's `debug_assert!` macro.
  2304. Note that this will apply to all Rust code, including `core`.
  2305. If unsure, say N.
  2306. config RUST_OVERFLOW_CHECKS
  2307. bool "Overflow checks"
  2308. default y
  2309. depends on RUST
  2310. help
  2311. Enables rustc's `-Coverflow-checks` codegen option.
  2312. This flag allows you to control the behavior of runtime integer
  2313. overflow. When overflow-checks are enabled, a Rust panic will occur
  2314. on overflow.
  2315. Note that this will apply to all Rust code, including `core`.
  2316. If unsure, say Y.
  2317. endmenu # "Rust"
  2318. source "Documentation/Kconfig"
  2319. endmenu # Kernel hacking