1# SPDX-License-Identifier: GPL-2.0-only 2menu "Kernel hacking" 3 4menu "printk and dmesg options" 5 6config PRINTK_TIME 7 bool "Show timing information on printks" 8 depends on PRINTK 9 help 10 Selecting this option causes time stamps of the printk() 11 messages to be added to the output of the syslog() system 12 call and at the console. 13 14 The timestamp is always recorded internally, and exported 15 to /dev/kmsg. This flag just specifies if the timestamp should 16 be included, not that the timestamp is recorded. 17 18 The behavior is also controlled by the kernel command line 19 parameter printk.time=1. See Documentation/admin-guide/kernel-parameters.rst 20 21config PRINTK_CALLER 22 bool "Show caller information on printks" 23 depends on PRINTK 24 help 25 Selecting this option causes printk() to add a caller "thread id" (if 26 in task context) or a caller "processor id" (if not in task context) 27 to every message. 28 29 This option is intended for environments where multiple threads 30 concurrently call printk() for many times, for it is difficult to 31 interpret without knowing where these lines (or sometimes individual 32 line which was divided into multiple lines due to race) came from. 33 34 Since toggling after boot makes the code racy, currently there is 35 no option to enable/disable at the kernel command line parameter or 36 sysfs interface. 37 38config PRINTK_EXECUTION_CTX 39 bool 40 depends on PRINTK 41 help 42 This option extends struct printk_info to include extra execution 43 context in printk, such as task name and CPU number from where the 44 message originated. This is useful for correlating printk messages 45 with specific execution contexts. 46 47 This is automatically enabled when a console driver that supports 48 execution context is selected. 49 50config STACKTRACE_BUILD_ID 51 bool "Show build ID information in stacktraces" 52 depends on PRINTK 53 help 54 Selecting this option adds build ID information for symbols in 55 stacktraces printed with the printk format '%p[SR]b'. 56 57 This option is intended for distros where debuginfo is not easily 58 accessible but can be downloaded given the build ID of the vmlinux or 59 kernel module where the function is located. 60 61config CONSOLE_LOGLEVEL_DEFAULT 62 int "Default console loglevel (1-15)" 63 range 1 15 64 default "7" 65 help 66 Default loglevel to determine what will be printed on the console. 67 68 Setting a default here is equivalent to passing in loglevel=<x> in 69 the kernel bootargs. loglevel=<x> continues to override whatever 70 value is specified here as well. 71 72 Note: This does not affect the log level of un-prefixed printk() 73 usage in the kernel. That is controlled by the MESSAGE_LOGLEVEL_DEFAULT 74 option. 75 76config CONSOLE_LOGLEVEL_QUIET 77 int "quiet console loglevel (1-15)" 78 range 1 15 79 default "4" 80 help 81 loglevel to use when "quiet" is passed on the kernel commandline. 82 83 When "quiet" is passed on the kernel commandline this loglevel 84 will be used as the loglevel. IOW passing "quiet" will be the 85 equivalent of passing "loglevel=<CONSOLE_LOGLEVEL_QUIET>" 86 87config MESSAGE_LOGLEVEL_DEFAULT 88 int "Default message log level (1-7)" 89 range 1 7 90 default "4" 91 help 92 Default log level for printk statements with no specified priority. 93 94 This was hard-coded to KERN_WARNING since at least 2.6.10 but folks 95 that are auditing their logs closely may want to set it to a lower 96 priority. 97 98 Note: This does not affect what message level gets printed on the console 99 by default. To change that, use loglevel=<x> in the kernel bootargs, 100 or pick a different CONSOLE_LOGLEVEL_DEFAULT configuration value. 101 102config BOOT_PRINTK_DELAY 103 bool "Delay each boot printk message by N milliseconds" 104 depends on DEBUG_KERNEL && PRINTK && GENERIC_CALIBRATE_DELAY 105 help 106 This build option allows you to read kernel boot messages 107 by inserting a short delay after each one. The delay is 108 specified in milliseconds on the kernel command line, 109 using "boot_delay=N". 110 111 It is likely that you would also need to use "lpj=M" to preset 112 the "loops per jiffy" value. 113 See a previous boot log for the "lpj" value to use for your 114 system, and then set "lpj=M" before setting "boot_delay=N". 115 NOTE: Using this option may adversely affect SMP systems. 116 I.e., processors other than the first one may not boot up. 117 BOOT_PRINTK_DELAY also may cause LOCKUP_DETECTOR to detect 118 what it believes to be lockup conditions. 119 120config DYNAMIC_DEBUG 121 bool "Enable dynamic printk() support" 122 default n 123 depends on PRINTK 124 depends on (DEBUG_FS || PROC_FS) 125 select DYNAMIC_DEBUG_CORE 126 help 127 128 Compiles debug level messages into the kernel, which would not 129 otherwise be available at runtime. These messages can then be 130 enabled/disabled based on various levels of scope - per source file, 131 function, module, format string, and line number. This mechanism 132 implicitly compiles in all pr_debug() and dev_dbg() calls, which 133 enlarges the kernel text size by about 2%. 134 135 If a source file is compiled with DEBUG flag set, any 136 pr_debug() calls in it are enabled by default, but can be 137 disabled at runtime as below. Note that DEBUG flag is 138 turned on by many CONFIG_*DEBUG* options. 139 140 Usage: 141 142 Dynamic debugging is controlled via the 'dynamic_debug/control' file, 143 which is contained in the 'debugfs' filesystem or procfs. 144 Thus, the debugfs or procfs filesystem must first be mounted before 145 making use of this feature. 146 We refer the control file as: <debugfs>/dynamic_debug/control. This 147 file contains a list of the debug statements that can be enabled. The 148 format for each line of the file is: 149 150 filename:lineno [module]function flags format 151 152 filename : source file of the debug statement 153 lineno : line number of the debug statement 154 module : module that contains the debug statement 155 function : function that contains the debug statement 156 flags : '=p' means the line is turned 'on' for printing 157 format : the format used for the debug statement 158 159 From a live system: 160 161 nullarbor:~ # cat <debugfs>/dynamic_debug/control 162 # filename:lineno [module]function flags format 163 fs/aio.c:222 [aio]__put_ioctx =_ "__put_ioctx:\040freeing\040%p\012" 164 fs/aio.c:248 [aio]ioctx_alloc =_ "ENOMEM:\040nr_events\040too\040high\012" 165 fs/aio.c:1770 [aio]sys_io_cancel =_ "calling\040cancel\012" 166 167 Example usage: 168 169 // enable the message at line 1603 of file svcsock.c 170 nullarbor:~ # echo -n 'file svcsock.c line 1603 +p' > 171 <debugfs>/dynamic_debug/control 172 173 // enable all the messages in file svcsock.c 174 nullarbor:~ # echo -n 'file svcsock.c +p' > 175 <debugfs>/dynamic_debug/control 176 177 // enable all the messages in the NFS server module 178 nullarbor:~ # echo -n 'module nfsd +p' > 179 <debugfs>/dynamic_debug/control 180 181 // enable all 12 messages in the function svc_process() 182 nullarbor:~ # echo -n 'func svc_process +p' > 183 <debugfs>/dynamic_debug/control 184 185 // disable all 12 messages in the function svc_process() 186 nullarbor:~ # echo -n 'func svc_process -p' > 187 <debugfs>/dynamic_debug/control 188 189 See Documentation/admin-guide/dynamic-debug-howto.rst for additional 190 information. 191 192config DYNAMIC_DEBUG_CORE 193 bool "Enable core function of dynamic debug support" 194 depends on PRINTK 195 depends on (DEBUG_FS || PROC_FS) 196 help 197 Enable core functional support of dynamic debug. It is useful 198 when you want to tie dynamic debug to your kernel modules with 199 DYNAMIC_DEBUG_MODULE defined for each of them, especially for 200 the case of embedded system where the kernel image size is 201 sensitive for people. 202 203config SYMBOLIC_ERRNAME 204 bool "Support symbolic error names in printf" 205 default y if PRINTK 206 help 207 If you say Y here, the kernel's printf implementation will 208 be able to print symbolic error names such as ENOSPC instead 209 of the number 28. It makes the kernel image slightly larger 210 (about 3KB), but can make the kernel logs easier to read. 211 212config DEBUG_BUGVERBOSE 213 bool "Verbose BUG() reporting (adds 70K)" if DEBUG_KERNEL && EXPERT 214 depends on BUG && (GENERIC_BUG || HAVE_DEBUG_BUGVERBOSE) 215 default y 216 help 217 Say Y here to make BUG() panics output the file name and line number 218 of the BUG call as well as the EIP and oops trace. This aids 219 debugging but costs about 70-100K of memory. 220 221config DEBUG_BUGVERBOSE_DETAILED 222 bool "Verbose WARN_ON_ONCE() reporting (adds 100K)" if DEBUG_BUGVERBOSE 223 help 224 Say Y here to make WARN_ON_ONCE() output the condition string of the 225 warning, in addition to the file name and line number. 226 This helps debugging, but costs about 100K of memory. 227 228 Say N if unsure. 229 230 231endmenu # "printk and dmesg options" 232 233config DEBUG_KERNEL 234 bool "Kernel debugging" 235 help 236 Say Y here if you are developing drivers or trying to debug and 237 identify kernel problems. 238 239config DEBUG_MISC 240 bool "Miscellaneous debug code" 241 default DEBUG_KERNEL 242 depends on DEBUG_KERNEL 243 help 244 Say Y here if you need to enable miscellaneous debug code that should 245 be under a more specific debug option but isn't. 246 247menu "Compile-time checks and compiler options" 248 249config DEBUG_INFO 250 bool 251 help 252 A kernel debug info option other than "None" has been selected 253 in the "Debug information" choice below, indicating that debug 254 information will be generated for build targets. 255 256# Clang generates .uleb128 with label differences for DWARF v5, a feature that 257# older binutils ports do not support when utilizing RISC-V style linker 258# relaxation: https://sourceware.org/bugzilla/show_bug.cgi?id=27215 259config AS_HAS_NON_CONST_ULEB128 260 def_bool $(as-instr,.uleb128 .Lexpr_end4 - .Lexpr_start3\n.Lexpr_start3:\n.Lexpr_end4:) 261 262choice 263 prompt "Debug information" 264 depends on DEBUG_KERNEL 265 help 266 Selecting something other than "None" results in a kernel image 267 that will include debugging info resulting in a larger kernel image. 268 This adds debug symbols to the kernel and modules (gcc -g), and 269 is needed if you intend to use kernel crashdump or binary object 270 tools like crash, kgdb, LKCD, gdb, etc on the kernel. 271 272 Choose which version of DWARF debug info to emit. If unsure, 273 select "Toolchain default". 274 275config DEBUG_INFO_NONE 276 bool "Disable debug information" 277 help 278 Do not build the kernel with debugging information, which will 279 result in a faster and smaller build. 280 281config DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT 282 bool "Rely on the toolchain's implicit default DWARF version" 283 select DEBUG_INFO 284 depends on !CC_IS_CLANG || AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502 && AS_HAS_NON_CONST_ULEB128) 285 help 286 The implicit default version of DWARF debug info produced by a 287 toolchain changes over time. 288 289 This can break consumers of the debug info that haven't upgraded to 290 support newer revisions, and prevent testing newer versions, but 291 those should be less common scenarios. 292 293config DEBUG_INFO_DWARF4 294 bool "Generate DWARF Version 4 debuginfo" 295 select DEBUG_INFO 296 depends on !CC_IS_CLANG || AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502) 297 help 298 Generate DWARF v4 debug info. This requires gcc 4.5+, binutils 2.35.2 299 if using clang without clang's integrated assembler, and gdb 7.0+. 300 301 If you have consumers of DWARF debug info that are not ready for 302 newer revisions of DWARF, you may wish to choose this or have your 303 config select this. 304 305config DEBUG_INFO_DWARF5 306 bool "Generate DWARF Version 5 debuginfo" 307 select DEBUG_INFO 308 depends on !ARCH_HAS_BROKEN_DWARF5 309 depends on !CC_IS_CLANG || AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502 && AS_HAS_NON_CONST_ULEB128) 310 help 311 Generate DWARF v5 debug info. Requires binutils 2.35.2, gcc 5.0+ (gcc 312 5.0+ accepts the -gdwarf-5 flag but only had partial support for some 313 draft features until 7.0), and gdb 8.0+. 314 315 Changes to the structure of debug info in Version 5 allow for around 316 15-18% savings in resulting image and debug info section sizes as 317 compared to DWARF Version 4. DWARF Version 5 standardizes previous 318 extensions such as accelerators for symbol indexing and the format 319 for fission (.dwo/.dwp) files. Users may not want to select this 320 config if they rely on tooling that has not yet been updated to 321 support DWARF Version 5. 322 323endchoice # "Debug information" 324 325if DEBUG_INFO 326 327config DEBUG_INFO_REDUCED 328 bool "Reduce debugging information" 329 help 330 If you say Y here gcc is instructed to generate less debugging 331 information for structure types. This means that tools that 332 need full debugging information (like kgdb or systemtap) won't 333 be happy. But if you merely need debugging information to 334 resolve line numbers there is no loss. Advantage is that 335 build directory object sizes shrink dramatically over a full 336 DEBUG_INFO build and compile times are reduced too. 337 Only works with newer gcc versions. 338 339choice 340 prompt "Compressed Debug information" 341 help 342 Compress the resulting debug info. Results in smaller debug info sections, 343 but requires that consumers are able to decompress the results. 344 345 If unsure, choose DEBUG_INFO_COMPRESSED_NONE. 346 347config DEBUG_INFO_COMPRESSED_NONE 348 bool "Don't compress debug information" 349 help 350 Don't compress debug info sections. 351 352config DEBUG_INFO_COMPRESSED_ZLIB 353 bool "Compress debugging information with zlib" 354 depends on $(cc-option,-gz=zlib) 355 depends on $(ld-option,--compress-debug-sections=zlib) 356 help 357 Compress the debug information using zlib. 358 359 Users of dpkg-deb via debian/rules may find an increase in 360 size of their debug .deb packages with this config set, due to the 361 debug info being compressed with zlib, then the object files being 362 recompressed with a different compression scheme. But this is still 363 preferable to setting KDEB_COMPRESS or DPKG_DEB_COMPRESSOR_TYPE to 364 "none" which would be even larger. 365 366config DEBUG_INFO_COMPRESSED_ZSTD 367 bool "Compress debugging information with zstd" 368 depends on $(cc-option,-gz=zstd) 369 depends on $(ld-option,--compress-debug-sections=zstd) 370 help 371 Compress the debug information using zstd. This may provide better 372 compression than zlib, for about the same time costs, but requires newer 373 toolchain support. Requires GCC 13.0+ or Clang 16.0+, binutils 2.40+, and 374 zstd. 375 376endchoice # "Compressed Debug information" 377 378config DEBUG_INFO_SPLIT 379 bool "Produce split debuginfo in .dwo files" 380 depends on $(cc-option,-gsplit-dwarf) 381 # RISC-V linker relaxation + -gsplit-dwarf has issues with LLVM and GCC 382 # prior to 12.x: 383 # https://github.com/llvm/llvm-project/issues/56642 384 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99090 385 depends on !RISCV || GCC_VERSION >= 120000 386 help 387 Generate debug info into separate .dwo files. This significantly 388 reduces the build directory size for builds with DEBUG_INFO, 389 because it stores the information only once on disk in .dwo 390 files instead of multiple times in object files and executables. 391 In addition the debug information is also compressed. 392 393 Requires recent gcc (4.7+) and recent gdb/binutils. 394 Any tool that packages or reads debug information would need 395 to know about the .dwo files and include them. 396 Incompatible with older versions of ccache. 397 398config DEBUG_INFO_BTF 399 bool "Generate BTF type information" 400 depends on !DEBUG_INFO_SPLIT && !DEBUG_INFO_REDUCED 401 depends on !GCC_PLUGIN_RANDSTRUCT || COMPILE_TEST 402 depends on BPF_SYSCALL 403 depends on PAHOLE_VERSION >= 122 404 # pahole uses elfutils, which does not have support for Hexagon relocations 405 depends on !HEXAGON 406 help 407 Generate deduplicated BTF type information from DWARF debug info. 408 Turning this on requires pahole v1.22 or later, which will convert 409 DWARF type info into equivalent deduplicated BTF type info. 410 411config PAHOLE_HAS_BTF_TAG 412 def_bool PAHOLE_VERSION >= 123 413 depends on CC_IS_CLANG 414 help 415 Decide whether pahole emits btf_tag attributes (btf_type_tag and 416 btf_decl_tag) or not. Currently only clang compiler implements 417 these attributes, so make the config depend on CC_IS_CLANG. 418 419config PAHOLE_HAS_LANG_EXCLUDE 420 def_bool PAHOLE_VERSION >= 124 421 help 422 Support for the --lang_exclude flag which makes pahole exclude 423 compilation units from the supplied language. Used in Kbuild to 424 omit Rust CUs which are not supported in version 1.24 of pahole, 425 otherwise it would emit malformed kernel and module binaries when 426 using DEBUG_INFO_BTF_MODULES. 427 428config DEBUG_INFO_BTF_MODULES 429 bool "Generate BTF type information for kernel modules" 430 default y 431 depends on DEBUG_INFO_BTF && MODULES 432 help 433 Generate compact split BTF type information for kernel modules. 434 435config MODULE_ALLOW_BTF_MISMATCH 436 bool "Allow loading modules with non-matching BTF type info" 437 depends on DEBUG_INFO_BTF_MODULES 438 help 439 For modules whose split BTF does not match vmlinux, load without 440 BTF rather than refusing to load. The default behavior with 441 module BTF enabled is to reject modules with such mismatches; 442 this option will still load module BTF where possible but ignore 443 it when a mismatch is found. 444 445config GDB_SCRIPTS 446 bool "Provide GDB scripts for kernel debugging" 447 help 448 This creates the required links to GDB helper scripts in the 449 build directory. If you load vmlinux into gdb, the helper 450 scripts will be automatically imported by gdb as well, and 451 additional functions are available to analyze a Linux kernel 452 instance. See Documentation/process/debugging/gdb-kernel-debugging.rst 453 for further details. 454 455endif # DEBUG_INFO 456 457config FRAME_WARN 458 int "Warn for stack frames larger than" 459 range 0 8192 460 default 0 if KMSAN 461 default 2048 if GCC_PLUGIN_LATENT_ENTROPY 462 default 2048 if PARISC 463 default 1536 if (!64BIT && XTENSA) 464 default 1280 if !64BIT 465 default 2048 if 64BIT 466 help 467 Tell the compiler to warn at build time for stack frames larger than this. 468 Setting this too low will cause a lot of warnings. 469 Setting it to 0 disables the warning. 470 471config STRIP_ASM_SYMS 472 bool "Strip assembler-generated symbols during link" 473 default n 474 help 475 Strip internal assembler-generated symbols during a link (symbols 476 that look like '.Lxxx') so they don't pollute the output of 477 get_wchan() and suchlike. 478 479config READABLE_ASM 480 bool "Generate readable assembler code" 481 depends on DEBUG_KERNEL 482 depends on CC_IS_GCC 483 help 484 Disable some compiler optimizations that tend to generate human unreadable 485 assembler output. This may make the kernel slightly slower, but it helps 486 to keep kernel developers who have to stare a lot at assembler listings 487 sane. 488 489config HEADERS_INSTALL 490 bool "Install uapi headers to usr/include" 491 help 492 This option will install uapi headers (headers exported to user-space) 493 into the usr/include directory for use during the kernel build. 494 This is unneeded for building the kernel itself, but needed for some 495 user-space program samples. It is also needed by some features such 496 as uapi header sanity checks. 497 498config DEBUG_SECTION_MISMATCH 499 bool "Enable full Section mismatch analysis" 500 depends on CC_IS_GCC 501 help 502 The section mismatch analysis checks if there are illegal references 503 from one section to another. During linktime or runtime, some 504 sections are dropped; any use of code/data previously in these 505 sections would most likely result in an oops. 506 507 In the code, functions and variables are annotated with __init, 508 __initdata, and so on (see the full list in include/linux/init.h). 509 This directs the toolchain to place code/data in specific sections. 510 511 The section mismatch analysis is always performed after a full 512 kernel build, and enabling this option causes the option 513 -fno-inline-functions-called-once to be added to gcc commands. 514 515 However, when inlining a function annotated with __init in 516 a non-init function, we would lose the section information and thus 517 the analysis would not catch the illegal reference. This option 518 tells gcc to inline less (but it does result in a larger kernel). 519 520config SECTION_MISMATCH_WARN_ONLY 521 bool "Make section mismatch errors non-fatal" 522 default y 523 help 524 If you say N here, the build process will fail if there are any 525 section mismatch, instead of just throwing warnings. 526 527 If unsure, say Y. 528 529config DEBUG_FORCE_FUNCTION_ALIGN_64B 530 bool "Force all function address 64B aligned" 531 depends on EXPERT && (X86_64 || ARM64 || PPC32 || PPC64 || ARC || RISCV || S390) 532 select FUNCTION_ALIGNMENT_64B 533 help 534 There are cases that a commit from one domain changes the function 535 address alignment of other domains, and cause magic performance 536 bump (regression or improvement). Enable this option will help to 537 verify if the bump is caused by function alignment changes, while 538 it will slightly increase the kernel size and affect icache usage. 539 540 It is mainly for debug and performance tuning use. 541 542# 543# Select this config option from the architecture Kconfig, if it 544# is preferred to always offer frame pointers as a config 545# option on the architecture (regardless of KERNEL_DEBUG): 546# 547config ARCH_WANT_FRAME_POINTERS 548 bool 549 550config FRAME_POINTER 551 bool "Compile the kernel with frame pointers" 552 depends on DEBUG_KERNEL && (M68K || UML || SUPERH) || ARCH_WANT_FRAME_POINTERS 553 default y if (DEBUG_INFO && UML) || ARCH_WANT_FRAME_POINTERS 554 help 555 If you say Y here the resulting kernel image will be slightly 556 larger and slower, but it gives very useful debugging information 557 in case of kernel bugs. (precise oopses/stacktraces/warnings) 558 559config OBJTOOL 560 bool 561 562config OBJTOOL_WERROR 563 bool "Upgrade objtool warnings to errors" 564 depends on OBJTOOL && !COMPILE_TEST 565 help 566 Fail the build on objtool warnings. 567 568 Objtool warnings can indicate kernel instability, including boot 569 failures. This option is highly recommended. 570 571 If unsure, say Y. 572 573config STACK_VALIDATION 574 bool "Compile-time stack metadata validation" 575 depends on HAVE_STACK_VALIDATION && UNWINDER_FRAME_POINTER 576 select OBJTOOL 577 default n 578 help 579 Validate frame pointer rules at compile-time. This helps ensure that 580 runtime stack traces are more reliable. 581 582 For more information, see 583 tools/objtool/Documentation/objtool.txt. 584 585config NOINSTR_VALIDATION 586 bool 587 depends on HAVE_NOINSTR_VALIDATION && DEBUG_ENTRY 588 select OBJTOOL 589 default y 590 591config VMLINUX_MAP 592 bool "Generate vmlinux.map file when linking" 593 depends on EXPERT 594 help 595 Selecting this option will pass "-Map=vmlinux.map" to ld 596 when linking vmlinux. That file can be useful for verifying 597 and debugging magic section games, and for seeing which 598 pieces of code get eliminated with 599 CONFIG_LD_DEAD_CODE_DATA_ELIMINATION. 600 601config BUILTIN_MODULE_RANGES 602 bool "Generate address range information for builtin modules" 603 depends on !LTO 604 depends on VMLINUX_MAP 605 help 606 When modules are built into the kernel, there will be no module name 607 associated with its symbols in /proc/kallsyms. Tracers may want to 608 identify symbols by module name and symbol name regardless of whether 609 the module is configured as loadable or not. 610 611 This option generates modules.builtin.ranges in the build tree with 612 offset ranges (per ELF section) for the module(s) they belong to. 613 It also records an anchor symbol to determine the load address of the 614 section. 615 616config WARN_CONTEXT_ANALYSIS 617 bool "Compiler context-analysis warnings" 618 depends on CC_IS_CLANG && CLANG_VERSION >= 230000 619 # Branch profiling re-defines "if", which messes with the compiler's 620 # ability to analyze __cond_acquires(..), resulting in false positives. 621 depends on !TRACE_BRANCH_PROFILING 622 default y 623 help 624 Context Analysis is a language extension, which enables statically 625 checking that required contexts are active (or inactive) by acquiring 626 and releasing user-definable "context locks". 627 628 Clang's name of the feature is "Thread Safety Analysis". Requires 629 Clang 23 or later. 630 631 Produces warnings by default. Select CONFIG_WERROR if you wish to 632 turn these warnings into errors. 633 634 For more details, see Documentation/dev-tools/context-analysis.rst. 635 636config WARN_CONTEXT_ANALYSIS_ALL 637 bool "Enable context analysis for all source files" 638 depends on WARN_CONTEXT_ANALYSIS 639 depends on EXPERT && !COMPILE_TEST 640 help 641 Enable tree-wide context analysis. This is likely to produce a 642 large number of false positives - enable at your own risk. 643 644 If unsure, say N. 645 646endmenu # "Compiler options" 647 648menu "Generic Kernel Debugging Instruments" 649 650config MAGIC_SYSRQ 651 bool "Magic SysRq key" 652 depends on !UML || MCONSOLE 653 help 654 If you say Y here, you will have some control over the system even 655 if the system crashes for example during kernel debugging (e.g., you 656 will be able to flush the buffer cache to disk, reboot the system 657 immediately or dump some status information). This is accomplished 658 by pressing various keys while holding SysRq (Alt+PrintScreen). It 659 also works on a serial console (on PC hardware at least), if you 660 send a BREAK and then within 5 seconds a command keypress. On UML, 661 this is accomplished by sending a "sysrq" command with mconsole, 662 followed by the letter for the requested command. The keys are 663 documented in <file:Documentation/admin-guide/sysrq.rst>. Don't say 664 Y unless you really know what this hack does. 665 666config MAGIC_SYSRQ_DEFAULT_ENABLE 667 hex "Enable magic SysRq key functions by default" 668 depends on MAGIC_SYSRQ 669 default 0x1 670 help 671 Specifies which SysRq key functions are enabled by default. 672 This may be set to 1 or 0 to enable or disable them all, or 673 to a bitmask as described in Documentation/admin-guide/sysrq.rst. 674 675config MAGIC_SYSRQ_SERIAL 676 bool "Enable magic SysRq key over serial" 677 depends on MAGIC_SYSRQ 678 default y 679 help 680 Many embedded boards have a disconnected TTL level serial which can 681 generate some garbage that can lead to spurious false sysrq detects. 682 This option allows you to decide whether you want to enable the 683 magic SysRq key. 684 685config MAGIC_SYSRQ_SERIAL_SEQUENCE 686 string "Char sequence that enables magic SysRq over serial" 687 depends on MAGIC_SYSRQ_SERIAL 688 default "" 689 help 690 Specifies a sequence of characters that can follow BREAK to enable 691 SysRq on a serial console. 692 693 If unsure, leave an empty string and the option will not be enabled. 694 695config DEBUG_FS 696 bool "Debug Filesystem" 697 help 698 debugfs is a virtual file system that kernel developers use to put 699 debugging files into. Enable this option to be able to read and 700 write to these files. 701 702 For detailed documentation on the debugfs API, see 703 Documentation/filesystems/. 704 705 If unsure, say N. 706 707choice 708 prompt "Debugfs default access" 709 depends on DEBUG_FS 710 default DEBUG_FS_ALLOW_ALL 711 help 712 This selects the default access restrictions for debugfs. 713 It can be overridden with kernel command line option 714 debugfs=[on,off]. The restrictions apply for API access 715 and filesystem registration. 716 717config DEBUG_FS_ALLOW_ALL 718 bool "Access normal" 719 help 720 No restrictions apply. Both API and filesystem registration 721 is on. This is the normal default operation. 722 723config DEBUG_FS_ALLOW_NONE 724 bool "No access" 725 help 726 Access is off. Clients get -PERM when trying to create nodes in 727 debugfs tree and debugfs is not registered as a filesystem. 728 Client can then back-off or continue without debugfs access. 729 730endchoice 731 732source "lib/Kconfig.kgdb" 733source "lib/Kconfig.ubsan" 734source "lib/Kconfig.kcsan" 735 736endmenu 737 738menu "Networking Debugging" 739 740source "net/Kconfig.debug" 741 742endmenu # "Networking Debugging" 743 744menu "Memory Debugging" 745 746source "mm/Kconfig.debug" 747 748config DEBUG_OBJECTS 749 bool "Debug object operations" 750 depends on PREEMPT_COUNT || !DEFERRED_STRUCT_PAGE_INIT 751 depends on DEBUG_KERNEL 752 help 753 If you say Y here, additional code will be inserted into the 754 kernel to track the life time of various objects and validate 755 the operations on those objects. 756 757config DEBUG_OBJECTS_SELFTEST 758 bool "Debug objects selftest" 759 depends on DEBUG_OBJECTS 760 help 761 This enables the selftest of the object debug code. 762 763config DEBUG_OBJECTS_FREE 764 bool "Debug objects in freed memory" 765 depends on DEBUG_OBJECTS 766 help 767 This enables checks whether a k/v free operation frees an area 768 which contains an object which has not been deactivated 769 properly. This can make kmalloc/kfree-intensive workloads 770 much slower. 771 772config DEBUG_OBJECTS_TIMERS 773 bool "Debug timer objects" 774 depends on DEBUG_OBJECTS 775 help 776 If you say Y here, additional code will be inserted into the 777 timer routines to track the life time of timer objects and 778 validate the timer operations. 779 780config DEBUG_OBJECTS_WORK 781 bool "Debug work objects" 782 depends on DEBUG_OBJECTS 783 help 784 If you say Y here, additional code will be inserted into the 785 work queue routines to track the life time of work objects and 786 validate the work operations. 787 788config DEBUG_OBJECTS_RCU_HEAD 789 bool "Debug RCU callbacks objects" 790 depends on DEBUG_OBJECTS 791 help 792 Enable this to turn on debugging of RCU list heads (call_rcu() usage). 793 794config DEBUG_OBJECTS_PERCPU_COUNTER 795 bool "Debug percpu counter objects" 796 depends on DEBUG_OBJECTS 797 help 798 If you say Y here, additional code will be inserted into the 799 percpu counter routines to track the life time of percpu counter 800 objects and validate the percpu counter operations. 801 802config DEBUG_OBJECTS_ENABLE_DEFAULT 803 int "debug_objects bootup default value (0-1)" 804 range 0 1 805 default "1" 806 depends on DEBUG_OBJECTS 807 help 808 Debug objects boot parameter default value 809 810config SHRINKER_DEBUG 811 bool "Enable shrinker debugging support" 812 depends on DEBUG_FS 813 help 814 Say Y to enable the shrinker debugfs interface which provides 815 visibility into the kernel memory shrinkers subsystem. 816 Disable it to avoid an extra memory footprint. 817 818config DEBUG_STACK_USAGE 819 bool "Stack utilization instrumentation" 820 depends on DEBUG_KERNEL 821 help 822 Enables the display of the minimum amount of free stack which each 823 task has ever had available in the sysrq-T and sysrq-P debug output. 824 Also emits a message to dmesg when a process exits if that process 825 used more stack space than previously exiting processes. 826 827 This option will slow down process creation somewhat. 828 829config SCHED_STACK_END_CHECK 830 bool "Detect stack corruption on calls to schedule()" 831 depends on DEBUG_KERNEL 832 default n 833 help 834 This option checks for a stack overrun on calls to schedule(). 835 If the stack end location is found to be over written always panic as 836 the content of the corrupted region can no longer be trusted. 837 This is to ensure no erroneous behaviour occurs which could result in 838 data corruption or a sporadic crash at a later stage once the region 839 is examined. The runtime overhead introduced is minimal. 840 841config ARCH_HAS_DEBUG_VM_PGTABLE 842 bool 843 help 844 An architecture should select this when it can successfully 845 build and run DEBUG_VM_PGTABLE. 846 847config DEBUG_VFS 848 bool "Debug VFS" 849 depends on DEBUG_KERNEL 850 help 851 Enable this to turn on extended checks in the VFS layer that may impact 852 performance. 853 854 If unsure, say N. 855 856config DEBUG_VM_IRQSOFF 857 def_bool DEBUG_VM && !PREEMPT_RT 858 859config DEBUG_VM 860 bool "Debug VM" 861 depends on DEBUG_KERNEL 862 help 863 Enable this to turn on extended checks in the virtual-memory system 864 that may impact performance. 865 866 If unsure, say N. 867 868config DEBUG_VM_SHOOT_LAZIES 869 bool "Debug MMU_LAZY_TLB_SHOOTDOWN implementation" 870 depends on DEBUG_VM 871 depends on MMU_LAZY_TLB_SHOOTDOWN 872 help 873 Enable additional IPIs that ensure lazy tlb mm references are removed 874 before the mm is freed. 875 876 If unsure, say N. 877 878config DEBUG_VM_MAPLE_TREE 879 bool "Debug VM maple trees" 880 depends on DEBUG_VM 881 select DEBUG_MAPLE_TREE 882 help 883 Enable VM maple tree debugging information and extra validations. 884 885 If unsure, say N. 886 887config DEBUG_VM_RB 888 bool "Debug VM red-black trees" 889 depends on DEBUG_VM 890 help 891 Enable VM red-black tree debugging information and extra validations. 892 893 If unsure, say N. 894 895config DEBUG_VM_PGFLAGS 896 bool "Debug page-flags operations" 897 depends on DEBUG_VM 898 help 899 Enables extra validation on page flags operations. 900 901 If unsure, say N. 902 903config DEBUG_VM_PGTABLE 904 bool "Debug arch page table for semantics compliance" 905 depends on MMU 906 depends on ARCH_HAS_DEBUG_VM_PGTABLE 907 default y if DEBUG_VM 908 help 909 This option provides a debug method which can be used to test 910 architecture page table helper functions on various platforms in 911 verifying if they comply with expected generic MM semantics. This 912 will help architecture code in making sure that any changes or 913 new additions of these helpers still conform to expected 914 semantics of the generic MM. Platforms will have to opt in for 915 this through ARCH_HAS_DEBUG_VM_PGTABLE. 916 917 If unsure, say N. 918 919config ARCH_HAS_DEBUG_VIRTUAL 920 bool 921 922config DEBUG_VIRTUAL 923 bool "Debug VM translations" 924 depends on DEBUG_KERNEL && ARCH_HAS_DEBUG_VIRTUAL 925 help 926 Enable some costly sanity checks in virtual to page code. This can 927 catch mistakes with virt_to_page() and friends. 928 929 If unsure, say N. 930 931config DEBUG_NOMMU_REGIONS 932 bool "Debug the global anon/private NOMMU mapping region tree" 933 depends on DEBUG_KERNEL && !MMU 934 help 935 This option causes the global tree of anonymous and private mapping 936 regions to be regularly checked for invalid topology. 937 938config DEBUG_MEMORY_INIT 939 bool "Debug memory initialisation" if EXPERT 940 default !EXPERT 941 help 942 Enable this for additional checks during memory initialisation. 943 The sanity checks verify aspects of the VM such as the memory model 944 and other information provided by the architecture. Verbose 945 information will be printed at KERN_DEBUG loglevel depending 946 on the mminit_loglevel= command-line option. 947 948 If unsure, say Y 949 950config MEMORY_NOTIFIER_ERROR_INJECT 951 tristate "Memory hotplug notifier error injection module" 952 depends on MEMORY_HOTPLUG && NOTIFIER_ERROR_INJECTION 953 help 954 This option provides the ability to inject artificial errors to 955 memory hotplug notifier chain callbacks. It is controlled through 956 debugfs interface under /sys/kernel/debug/notifier-error-inject/memory 957 958 If the notifier call chain should be failed with some events 959 notified, write the error code to "actions/<notifier event>/error". 960 961 Example: Inject memory hotplug offline error (-12 == -ENOMEM) 962 963 # cd /sys/kernel/debug/notifier-error-inject/memory 964 # echo -12 > actions/MEM_GOING_OFFLINE/error 965 # echo offline > /sys/devices/system/memory/memoryXXX/state 966 bash: echo: write error: Cannot allocate memory 967 968 To compile this code as a module, choose M here: the module will 969 be called memory-notifier-error-inject. 970 971 If unsure, say N. 972 973config DEBUG_PER_CPU_MAPS 974 bool "Debug access to per_cpu maps" 975 depends on DEBUG_KERNEL 976 depends on SMP 977 help 978 Say Y to verify that the per_cpu map being accessed has 979 been set up. This adds a fair amount of code to kernel memory 980 and decreases performance. 981 982 Say N if unsure. 983 984config DEBUG_KMAP_LOCAL 985 bool "Debug kmap_local temporary mappings" 986 depends on DEBUG_KERNEL && KMAP_LOCAL 987 help 988 This option enables additional error checking for the kmap_local 989 infrastructure. Disable for production use. 990 991config ARCH_SUPPORTS_KMAP_LOCAL_FORCE_MAP 992 bool 993 994config DEBUG_KMAP_LOCAL_FORCE_MAP 995 bool "Enforce kmap_local temporary mappings" 996 depends on DEBUG_KERNEL && ARCH_SUPPORTS_KMAP_LOCAL_FORCE_MAP 997 select KMAP_LOCAL 998 select DEBUG_KMAP_LOCAL 999 help 1000 This option enforces temporary mappings through the kmap_local 1001 mechanism for non-highmem pages and on non-highmem systems. 1002 Disable this for production systems! 1003 1004config DEBUG_HIGHMEM 1005 bool "Highmem debugging" 1006 depends on DEBUG_KERNEL && HIGHMEM 1007 select DEBUG_KMAP_LOCAL_FORCE_MAP if ARCH_SUPPORTS_KMAP_LOCAL_FORCE_MAP 1008 select DEBUG_KMAP_LOCAL 1009 help 1010 This option enables additional error checking for high memory 1011 systems. Disable for production systems. 1012 1013config HAVE_DEBUG_STACKOVERFLOW 1014 bool 1015 1016config DEBUG_STACKOVERFLOW 1017 bool "Check for stack overflows" 1018 depends on DEBUG_KERNEL && HAVE_DEBUG_STACKOVERFLOW 1019 help 1020 Say Y here if you want to check for overflows of kernel, IRQ 1021 and exception stacks (if your architecture uses them). This 1022 option will show detailed messages if free stack space drops 1023 below a certain limit. 1024 1025 These kinds of bugs usually occur when call-chains in the 1026 kernel get too deep, especially when interrupts are 1027 involved. 1028 1029 Use this in cases where you see apparently random memory 1030 corruption, especially if it appears in 'struct thread_info' 1031 1032 If in doubt, say "N". 1033 1034config CODE_TAGGING 1035 bool 1036 select KALLSYMS 1037 1038source "lib/Kconfig.kasan" 1039source "lib/Kconfig.kfence" 1040source "lib/Kconfig.kmsan" 1041 1042endmenu # "Memory Debugging" 1043 1044config DEBUG_SHIRQ 1045 bool "Debug shared IRQ handlers" 1046 depends on DEBUG_KERNEL 1047 help 1048 Enable this to generate a spurious interrupt just before a shared 1049 interrupt handler is deregistered (generating one when registering 1050 is currently disabled). Drivers need to handle this correctly. Some 1051 don't and need to be caught. 1052 1053menu "Debug Oops, Lockups and Hangs" 1054 1055config PANIC_ON_OOPS 1056 bool "Panic on Oops" 1057 help 1058 Say Y here to enable the kernel to panic when it oopses. This 1059 has the same effect as setting oops=panic on the kernel command 1060 line. 1061 1062 This feature is useful to ensure that the kernel does not do 1063 anything erroneous after an oops which could result in data 1064 corruption or other issues. 1065 1066 Say N if unsure. 1067 1068config PANIC_TIMEOUT 1069 int "panic timeout" 1070 default 0 1071 help 1072 Set the timeout value (in seconds) until a reboot occurs when 1073 the kernel panics. If n = 0, then we wait forever. A timeout 1074 value n > 0 will wait n seconds before rebooting, while a timeout 1075 value n < 0 will reboot immediately. This setting can be overridden 1076 with the kernel command line option panic=, and from userspace via 1077 /proc/sys/kernel/panic. 1078 1079config LOCKUP_DETECTOR 1080 bool 1081 1082config SOFTLOCKUP_DETECTOR 1083 bool "Detect Soft Lockups" 1084 depends on DEBUG_KERNEL && !S390 1085 select LOCKUP_DETECTOR 1086 help 1087 Say Y here to enable the kernel to act as a watchdog to detect 1088 soft lockups. 1089 1090 Softlockups are bugs that cause the kernel to loop in kernel 1091 mode for more than 20 seconds, without giving other tasks a 1092 chance to run. The current stack trace is displayed upon 1093 detection and the system will stay locked up. 1094 1095config SOFTLOCKUP_DETECTOR_INTR_STORM 1096 bool "Detect Interrupt Storm in Soft Lockups" 1097 depends on SOFTLOCKUP_DETECTOR && IRQ_TIME_ACCOUNTING 1098 select GENERIC_IRQ_STAT_SNAPSHOT 1099 default y if NR_CPUS <= 128 1100 help 1101 Say Y here to enable the kernel to detect interrupt storm 1102 during "soft lockups". 1103 1104 "soft lockups" can be caused by a variety of reasons. If one is 1105 caused by an interrupt storm, then the storming interrupts will not 1106 be on the callstack. To detect this case, it is necessary to report 1107 the CPU stats and the interrupt counts during the "soft lockups". 1108 1109config BOOTPARAM_SOFTLOCKUP_PANIC 1110 int "Panic (Reboot) On Soft Lockups" 1111 depends on SOFTLOCKUP_DETECTOR 1112 default 0 1113 help 1114 Set to a non-zero value N to enable the kernel to panic on "soft 1115 lockups", which are bugs that cause the kernel to loop in kernel 1116 mode for more than (N * 20 seconds) (configurable using the 1117 watchdog_thresh sysctl), without giving other tasks a chance to run. 1118 1119 The panic can be used in combination with panic_timeout, 1120 to cause the system to reboot automatically after a 1121 lockup has been detected. This feature is useful for 1122 high-availability systems that have uptime guarantees and 1123 where a lockup must be resolved ASAP. 1124 1125 Say 0 if unsure. 1126 1127config HAVE_HARDLOCKUP_DETECTOR_BUDDY 1128 bool 1129 depends on SMP 1130 default y 1131 1132# 1133# Global switch whether to build a hardlockup detector at all. It is available 1134# only when the architecture supports at least one implementation. There are 1135# two exceptions. The hardlockup detector is never enabled on: 1136# 1137# s390: it reported many false positives there 1138# 1139# sparc64: has a custom implementation which is not using the common 1140# hardlockup command line options and sysctl interface. 1141# 1142config HARDLOCKUP_DETECTOR 1143 bool "Detect Hard Lockups" 1144 depends on DEBUG_KERNEL && !S390 && !HARDLOCKUP_DETECTOR_SPARC64 1145 depends on HAVE_HARDLOCKUP_DETECTOR_PERF || HAVE_HARDLOCKUP_DETECTOR_BUDDY || HAVE_HARDLOCKUP_DETECTOR_ARCH 1146 imply HARDLOCKUP_DETECTOR_PERF 1147 imply HARDLOCKUP_DETECTOR_BUDDY 1148 imply HARDLOCKUP_DETECTOR_ARCH 1149 select LOCKUP_DETECTOR 1150 1151 help 1152 Say Y here to enable the kernel to act as a watchdog to detect 1153 hard lockups. 1154 1155 Hardlockups are bugs that cause the CPU to loop in kernel mode 1156 for more than 10 seconds, without letting other interrupts have a 1157 chance to run. The current stack trace is displayed upon detection 1158 and the system will stay locked up. 1159 1160# 1161# Note that arch-specific variants are always preferred. 1162# 1163config HARDLOCKUP_DETECTOR_PREFER_BUDDY 1164 bool "Prefer the buddy CPU hardlockup detector" 1165 depends on HARDLOCKUP_DETECTOR 1166 depends on HAVE_HARDLOCKUP_DETECTOR_PERF && HAVE_HARDLOCKUP_DETECTOR_BUDDY 1167 depends on !HAVE_HARDLOCKUP_DETECTOR_ARCH 1168 help 1169 Say Y here to prefer the buddy hardlockup detector over the perf one. 1170 1171 With the buddy detector, each CPU uses its softlockup hrtimer 1172 to check that the next CPU is processing hrtimer interrupts by 1173 verifying that a counter is increasing. 1174 1175 This hardlockup detector is useful on systems that don't have 1176 an arch-specific hardlockup detector or if resources needed 1177 for the hardlockup detector are better used for other things. 1178 1179config HARDLOCKUP_DETECTOR_PERF 1180 bool 1181 depends on HARDLOCKUP_DETECTOR 1182 depends on HAVE_HARDLOCKUP_DETECTOR_PERF && !HARDLOCKUP_DETECTOR_PREFER_BUDDY 1183 depends on !HAVE_HARDLOCKUP_DETECTOR_ARCH 1184 select HARDLOCKUP_DETECTOR_COUNTS_HRTIMER 1185 1186config HARDLOCKUP_DETECTOR_BUDDY 1187 bool 1188 depends on HARDLOCKUP_DETECTOR 1189 depends on HAVE_HARDLOCKUP_DETECTOR_BUDDY 1190 depends on !HAVE_HARDLOCKUP_DETECTOR_PERF || HARDLOCKUP_DETECTOR_PREFER_BUDDY 1191 depends on !HAVE_HARDLOCKUP_DETECTOR_ARCH 1192 select HARDLOCKUP_DETECTOR_COUNTS_HRTIMER 1193 1194config HARDLOCKUP_DETECTOR_ARCH 1195 bool 1196 depends on HARDLOCKUP_DETECTOR 1197 depends on HAVE_HARDLOCKUP_DETECTOR_ARCH 1198 help 1199 The arch-specific implementation of the hardlockup detector will 1200 be used. 1201 1202# 1203# Both the "perf" and "buddy" hardlockup detectors count hrtimer 1204# interrupts. This config enables functions managing this common code. 1205# 1206config HARDLOCKUP_DETECTOR_COUNTS_HRTIMER 1207 bool 1208 select SOFTLOCKUP_DETECTOR 1209 1210# 1211# Enables a timestamp based low pass filter to compensate for perf based 1212# hard lockup detection which runs too fast due to turbo modes. 1213# 1214config HARDLOCKUP_CHECK_TIMESTAMP 1215 bool 1216 1217config BOOTPARAM_HARDLOCKUP_PANIC 1218 bool "Panic (Reboot) On Hard Lockups" 1219 depends on HARDLOCKUP_DETECTOR 1220 help 1221 Say Y here to enable the kernel to panic on "hard lockups", 1222 which are bugs that cause the kernel to loop in kernel 1223 mode with interrupts disabled for more than 10 seconds (configurable 1224 using the watchdog_thresh sysctl). 1225 1226 Say N if unsure. 1227 1228config DETECT_HUNG_TASK 1229 bool "Detect Hung Tasks" 1230 depends on DEBUG_KERNEL 1231 default SOFTLOCKUP_DETECTOR 1232 help 1233 Say Y here to enable the kernel to detect "hung tasks", 1234 which are bugs that cause the task to be stuck in 1235 uninterruptible "D" state indefinitely. 1236 1237 When a hung task is detected, the kernel will print the 1238 current stack trace (which you should report), but the 1239 task will stay in uninterruptible state. If lockdep is 1240 enabled then all held locks will also be reported. This 1241 feature has negligible overhead. 1242 1243config DEFAULT_HUNG_TASK_TIMEOUT 1244 int "Default timeout for hung task detection (in seconds)" 1245 depends on DETECT_HUNG_TASK 1246 default 120 1247 help 1248 This option controls the default timeout (in seconds) used 1249 to determine when a task has become non-responsive and should 1250 be considered hung. 1251 1252 It can be adjusted at runtime via the kernel.hung_task_timeout_secs 1253 sysctl or by writing a value to 1254 /proc/sys/kernel/hung_task_timeout_secs. 1255 1256 A timeout of 0 disables the check. The default is two minutes. 1257 Keeping the default should be fine in most cases. 1258 1259config BOOTPARAM_HUNG_TASK_PANIC 1260 int "Number of hung tasks to trigger kernel panic" 1261 depends on DETECT_HUNG_TASK 1262 default 0 1263 help 1264 When set to a non-zero value, a kernel panic will be triggered 1265 if the number of hung tasks found during a single scan reaches 1266 this value. 1267 1268 The panic can be used in combination with panic_timeout, 1269 to cause the system to reboot automatically after a 1270 hung task has been detected. This feature is useful for 1271 high-availability systems that have uptime guarantees and 1272 where a hung tasks must be resolved ASAP. 1273 1274 Say 0 if unsure. 1275 1276config DETECT_HUNG_TASK_BLOCKER 1277 bool "Dump Hung Tasks Blocker" 1278 depends on DETECT_HUNG_TASK 1279 depends on !PREEMPT_RT 1280 default y 1281 help 1282 Say Y here to show a possible blocker task's stacktrace when 1283 a hung task is waiting on a mutex, semaphore, or rwsem. 1284 This will add a bit of overhead but shows suspicious tasks and 1285 call traces for waits on one of these locks. 1286 1287config WQ_WATCHDOG 1288 bool "Detect Workqueue Stalls" 1289 depends on DEBUG_KERNEL 1290 help 1291 Say Y here to enable stall detection on workqueues. If a 1292 worker pool doesn't make forward progress on a pending work 1293 item for over a given amount of time, 30s by default, a 1294 warning message is printed along with dump of workqueue 1295 state. This can be configured through kernel parameter 1296 "workqueue.watchdog_thresh" and its sysfs counterpart. 1297 1298config BOOTPARAM_WQ_STALL_PANIC 1299 int "Panic on Nth workqueue stall" 1300 default 0 1301 range 0 100 1302 depends on WQ_WATCHDOG 1303 help 1304 Set the number of workqueue stalls to trigger a kernel panic. 1305 A workqueue stall occurs when a worker pool doesn't make forward 1306 progress on a pending work item for over 30 seconds (configurable 1307 using the workqueue.watchdog_thresh parameter). 1308 1309 If n = 0, the kernel will not panic on stall. If n > 0, the kernel 1310 will panic after n stall warnings. 1311 1312 The panic can be used in combination with panic_timeout, 1313 to cause the system to reboot automatically after a 1314 stall has been detected. This feature is useful for 1315 high-availability systems that have uptime guarantees and 1316 where a stall must be resolved ASAP. 1317 1318 This setting can be overridden at runtime via the 1319 workqueue.panic_on_stall kernel parameter. 1320 1321config WQ_CPU_INTENSIVE_REPORT 1322 bool "Report per-cpu work items which hog CPU for too long" 1323 depends on DEBUG_KERNEL 1324 help 1325 Say Y here to enable reporting of concurrency-managed per-cpu work 1326 items that hog CPUs for longer than 1327 workqueue.cpu_intensive_thresh_us. Workqueue automatically 1328 detects and excludes them from concurrency management to prevent 1329 them from stalling other per-cpu work items. Occassional 1330 triggering may not necessarily indicate a problem. Repeated 1331 triggering likely indicates that the work item should be switched 1332 to use an unbound workqueue. 1333 1334config TEST_CSD_LOCK 1335 tristate "Test module to stall a CPU on a CSD lock" 1336 depends on m 1337 depends on CSD_LOCK_WAIT_DEBUG 1338 help 1339 This builds the "test_csd_lock" module, which keeps one CPU from 1340 answering an IPI for as long as its stall_ms parameter says, so 1341 that the CSD-lock debug code has a stall to report. It needs 1342 csdlock_debug=1 to be of any use. 1343 1344 If unsure, say N. 1345 1346config TEST_LOCKUP 1347 tristate "Test module to generate lockups" 1348 depends on m 1349 help 1350 This builds the "test_lockup" module that helps to make sure 1351 that watchdogs and lockup detectors are working properly. 1352 1353 Depending on module parameters it could emulate soft or hard 1354 lockup, "hung task", or locking arbitrary lock for a long time. 1355 Also it could generate series of lockups with cooling-down periods. 1356 1357 If unsure, say N. 1358 1359endmenu # "Debug lockups and hangs" 1360 1361menu "Scheduler Debugging" 1362 1363config SCHED_INFO 1364 bool 1365 default n 1366 1367config SCHEDSTATS 1368 bool "Collect scheduler statistics" 1369 depends on PROC_FS 1370 select SCHED_INFO 1371 help 1372 If you say Y here, additional code will be inserted into the 1373 scheduler and related routines to collect statistics about 1374 scheduler behavior and provide them in /proc/schedstat. These 1375 stats may be useful for both tuning and debugging the scheduler 1376 If you aren't debugging the scheduler or trying to tune a specific 1377 application, you can say N to avoid the very slight overhead 1378 this adds. 1379 1380endmenu 1381 1382config DEBUG_PREEMPT 1383 bool "Debug preemptible kernel" 1384 depends on DEBUG_KERNEL && PREEMPTION && TRACE_IRQFLAGS_SUPPORT 1385 help 1386 If you say Y here then the kernel will use a debug variant of the 1387 commonly used smp_processor_id() function and will print warnings 1388 if kernel code uses it in a preemption-unsafe way. Also, the kernel 1389 will detect preemption count underflows. 1390 1391 This option has potential to introduce high runtime overhead, 1392 depending on workload as it triggers debugging routines for each 1393 this_cpu operation. It should only be used for debugging purposes. 1394 1395config DEBUG_ATOMIC 1396 bool "Debug atomic variables" 1397 depends on DEBUG_KERNEL 1398 help 1399 If you say Y here then the kernel will add a runtime alignment check 1400 to atomic accesses. Useful for architectures that do not have trap on 1401 mis-aligned access. 1402 1403 This option has potentially significant overhead. 1404 1405config DEBUG_ATOMIC_LARGEST_ALIGN 1406 bool "Check alignment only up to __aligned_largest" 1407 depends on DEBUG_ATOMIC 1408 help 1409 If you say Y here then the check for natural alignment of 1410 atomic accesses will be constrained to the compiler's largest 1411 alignment for scalar types. 1412 1413menu "Lock Debugging (spinlocks, mutexes, etc...)" 1414 1415config LOCK_DEBUGGING_SUPPORT 1416 bool 1417 depends on TRACE_IRQFLAGS_SUPPORT && STACKTRACE_SUPPORT && LOCKDEP_SUPPORT 1418 default y 1419 1420config PROVE_LOCKING 1421 bool "Lock debugging: prove locking correctness" 1422 depends on DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT 1423 select LOCKDEP 1424 select DEBUG_SPINLOCK 1425 select DEBUG_MUTEXES if !PREEMPT_RT 1426 select DEBUG_RT_MUTEXES if RT_MUTEXES 1427 select DEBUG_RWSEMS if !PREEMPT_RT 1428 select DEBUG_WW_MUTEX_SLOWPATH 1429 select DEBUG_LOCK_ALLOC 1430 select PREEMPT_COUNT if !ARCH_NO_PREEMPT 1431 select TRACE_IRQFLAGS 1432 default n 1433 help 1434 This feature enables the kernel to prove that all locking 1435 that occurs in the kernel runtime is mathematically 1436 correct: that under no circumstance could an arbitrary (and 1437 not yet triggered) combination of observed locking 1438 sequences (on an arbitrary number of CPUs, running an 1439 arbitrary number of tasks and interrupt contexts) cause a 1440 deadlock. 1441 1442 In short, this feature enables the kernel to report locking 1443 related deadlocks before they actually occur. 1444 1445 The proof does not depend on how hard and complex a 1446 deadlock scenario would be to trigger: how many 1447 participant CPUs, tasks and irq-contexts would be needed 1448 for it to trigger. The proof also does not depend on 1449 timing: if a race and a resulting deadlock is possible 1450 theoretically (no matter how unlikely the race scenario 1451 is), it will be proven so and will immediately be 1452 reported by the kernel (once the event is observed that 1453 makes the deadlock theoretically possible). 1454 1455 If a deadlock is impossible (i.e. the locking rules, as 1456 observed by the kernel, are mathematically correct), the 1457 kernel reports nothing. 1458 1459 NOTE: this feature can also be enabled for rwlocks, mutexes 1460 and rwsems - in which case all dependencies between these 1461 different locking variants are observed and mapped too, and 1462 the proof of observed correctness is also maintained for an 1463 arbitrary combination of these separate locking variants. 1464 1465 For more details, see Documentation/locking/lockdep-design.rst. 1466 1467config PROVE_RAW_LOCK_NESTING 1468 bool "Enable raw_spinlock - spinlock nesting checks" if !ARCH_SUPPORTS_RT 1469 depends on PROVE_LOCKING 1470 default y if ARCH_SUPPORTS_RT 1471 help 1472 Enable the raw_spinlock vs. spinlock nesting checks which ensure 1473 that the lock nesting rules for PREEMPT_RT enabled kernels are 1474 not violated. 1475 1476config LOCK_STAT 1477 bool "Lock usage statistics" 1478 depends on DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT 1479 select LOCKDEP 1480 select DEBUG_SPINLOCK 1481 select DEBUG_MUTEXES if !PREEMPT_RT 1482 select DEBUG_RT_MUTEXES if RT_MUTEXES 1483 select DEBUG_LOCK_ALLOC 1484 default n 1485 help 1486 This feature enables tracking lock contention points 1487 1488 For more details, see Documentation/locking/lockstat.rst 1489 1490 This also enables lock events required by "perf lock", 1491 subcommand of perf. 1492 If you want to use "perf lock", you also need to turn on 1493 CONFIG_EVENT_TRACING. 1494 1495 CONFIG_LOCK_STAT defines "contended" and "acquired" lock events. 1496 (CONFIG_LOCKDEP defines "acquire" and "release" events.) 1497 1498config DEBUG_RT_MUTEXES 1499 bool "RT Mutex debugging, deadlock detection" 1500 depends on DEBUG_KERNEL && RT_MUTEXES 1501 help 1502 This allows rt mutex semantics violations and rt mutex related 1503 deadlocks (lockups) to be detected and reported automatically. 1504 1505config DEBUG_SPINLOCK 1506 bool "Spinlock and rw-lock debugging: basic checks" 1507 depends on DEBUG_KERNEL 1508 select UNINLINE_SPIN_UNLOCK 1509 help 1510 Say Y here and build SMP to catch missing spinlock initialization 1511 and certain other kinds of spinlock errors commonly made. This is 1512 best used in conjunction with the NMI watchdog so that spinlock 1513 deadlocks are also debuggable. 1514 1515config DEBUG_MUTEXES 1516 bool "Mutex debugging: basic checks" 1517 depends on DEBUG_KERNEL && !PREEMPT_RT 1518 help 1519 This feature allows mutex semantics violations to be detected and 1520 reported. 1521 1522config DEBUG_WW_MUTEX_SLOWPATH 1523 bool "Wait/wound mutex debugging: Slowpath testing" 1524 depends on DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT 1525 select DEBUG_LOCK_ALLOC 1526 select DEBUG_SPINLOCK 1527 select DEBUG_MUTEXES if !PREEMPT_RT 1528 select DEBUG_RT_MUTEXES if PREEMPT_RT 1529 help 1530 This feature enables slowpath testing for w/w mutex users by 1531 injecting additional -EDEADLK wound/backoff cases. Together with 1532 the full mutex checks enabled with (CONFIG_PROVE_LOCKING) this 1533 will test all possible w/w mutex interface abuse with the 1534 exception of simply not acquiring all the required locks. 1535 Note that this feature can introduce significant overhead, so 1536 it really should not be enabled in a production or distro kernel, 1537 even a debug kernel. If you are a driver writer, enable it. If 1538 you are a distro, do not. 1539 1540config DEBUG_RWSEMS 1541 bool "RW Semaphore debugging: basic checks" 1542 depends on DEBUG_KERNEL && !PREEMPT_RT 1543 help 1544 This debugging feature allows mismatched rw semaphore locks 1545 and unlocks to be detected and reported. 1546 1547config DEBUG_LOCK_ALLOC 1548 bool "Lock debugging: detect incorrect freeing of live locks" 1549 depends on DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT 1550 select DEBUG_SPINLOCK 1551 select DEBUG_MUTEXES if !PREEMPT_RT 1552 select DEBUG_RT_MUTEXES if RT_MUTEXES 1553 select LOCKDEP 1554 help 1555 This feature will check whether any held lock (spinlock, rwlock, 1556 mutex or rwsem) is incorrectly freed by the kernel, via any of the 1557 memory-freeing routines (kfree(), kmem_cache_free(), free_pages(), 1558 vfree(), etc.), whether a live lock is incorrectly reinitialized via 1559 spin_lock_init()/mutex_init()/etc., or whether there is any lock 1560 held during task exit. 1561 1562config LOCKDEP 1563 bool 1564 depends on DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT 1565 select STACKTRACE 1566 select KALLSYMS 1567 select KALLSYMS_ALL 1568 1569config LOCKDEP_SMALL 1570 bool 1571 1572config LOCKDEP_BITS 1573 int "Size for MAX_LOCKDEP_ENTRIES (as Nth power of 2)" 1574 depends on LOCKDEP && !LOCKDEP_SMALL 1575 range 10 24 1576 default 15 1577 help 1578 Try increasing this value if you hit "BUG: MAX_LOCKDEP_ENTRIES too low!" message. 1579 1580config LOCKDEP_CHAINS_BITS 1581 int "Size for MAX_LOCKDEP_CHAINS (as Nth power of 2)" 1582 depends on LOCKDEP && !LOCKDEP_SMALL 1583 range 10 21 1584 default 16 1585 help 1586 Try increasing this value if you hit "BUG: MAX_LOCKDEP_CHAINS too low!" message. 1587 1588config LOCKDEP_STACK_TRACE_BITS 1589 int "Size for MAX_STACK_TRACE_ENTRIES (as Nth power of 2)" 1590 depends on LOCKDEP && !LOCKDEP_SMALL 1591 range 10 26 1592 default 21 if KASAN 1593 default 19 1594 help 1595 Try increasing this value if you hit "BUG: MAX_STACK_TRACE_ENTRIES too low!" message. 1596 1597 KASAN significantly increases stack trace consumption because its 1598 slab tracking interacts with lockdep's dependency validation under 1599 PREEMPT_FULL, creating a feedback loop. The higher default when 1600 KASAN is enabled costs ~12MB extra, which is negligible compared to 1601 KASAN's own shadow memory overhead. 1602 1603config LOCKDEP_STACK_TRACE_HASH_BITS 1604 int "Size for STACK_TRACE_HASH_SIZE (as Nth power of 2)" 1605 depends on LOCKDEP && !LOCKDEP_SMALL 1606 range 10 26 1607 default 16 if KASAN 1608 default 14 1609 help 1610 Try increasing this value if you need large STACK_TRACE_HASH_SIZE. 1611 1612config LOCKDEP_CIRCULAR_QUEUE_BITS 1613 int "Size for elements in circular_queue struct (as Nth power of 2)" 1614 depends on LOCKDEP 1615 range 10 26 1616 default 12 1617 help 1618 Try increasing this value if you hit "lockdep bfs error:-1" warning due to __cq_enqueue() failure. 1619 1620config DEBUG_LOCKDEP 1621 bool "Lock dependency engine debugging" 1622 depends on DEBUG_KERNEL && LOCKDEP 1623 select DEBUG_IRQFLAGS 1624 help 1625 If you say Y here, the lock dependency engine will do 1626 additional runtime checks to debug itself, at the price 1627 of more runtime overhead. 1628 1629config DEBUG_ATOMIC_SLEEP 1630 bool "Sleep inside atomic section checking" 1631 select PREEMPT_COUNT 1632 depends on DEBUG_KERNEL 1633 depends on !ARCH_NO_PREEMPT 1634 help 1635 If you say Y here, various routines which may sleep will become very 1636 noisy if they are called inside atomic sections: when a spinlock is 1637 held, inside an rcu read side critical section, inside preempt disabled 1638 sections, inside an interrupt, etc... 1639 1640config DEBUG_LOCKING_API_SELFTESTS 1641 bool "Locking API boot-time self-tests" 1642 depends on DEBUG_KERNEL 1643 help 1644 Say Y here if you want the kernel to run a short self-test during 1645 bootup. The self-test checks whether common types of locking bugs 1646 are detected by debugging mechanisms or not. (if you disable 1647 lock debugging then those bugs won't be detected of course.) 1648 The following locking APIs are covered: spinlocks, rwlocks, 1649 mutexes and rwsems. 1650 1651config LOCK_TORTURE_TEST 1652 tristate "torture tests for locking" 1653 depends on DEBUG_KERNEL 1654 select TORTURE_TEST 1655 help 1656 This option provides a kernel module that runs torture tests 1657 on kernel locking primitives. The kernel module may be built 1658 after the fact on the running kernel to be tested, if desired. 1659 1660 Say Y here if you want kernel locking-primitive torture tests 1661 to be built into the kernel. 1662 Say M if you want these torture tests to build as a module. 1663 Say N if you are unsure. 1664 1665config WW_MUTEX_SELFTEST 1666 tristate "Wait/wound mutex selftests" 1667 help 1668 This option provides a kernel module that runs tests on the 1669 on the struct ww_mutex locking API. 1670 1671 It is recommended to enable DEBUG_WW_MUTEX_SLOWPATH in conjunction 1672 with this test harness. 1673 1674 Say M if you want these self tests to build as a module. 1675 Say N if you are unsure. 1676 1677config SCF_TORTURE_TEST 1678 tristate "torture tests for smp_call_function*()" 1679 depends on DEBUG_KERNEL 1680 select TORTURE_TEST 1681 help 1682 This option provides a kernel module that runs torture tests 1683 on the smp_call_function() family of primitives. The kernel 1684 module may be built after the fact on the running kernel to 1685 be tested, if desired. 1686 1687config CSD_LOCK_WAIT_DEBUG 1688 bool "Debugging for csd_lock_wait(), called from smp_call_function*()" 1689 depends on DEBUG_KERNEL 1690 depends on SMP 1691 depends on 64BIT 1692 default n 1693 help 1694 This option enables debug prints when CPUs are slow to respond 1695 to the smp_call_function*() IPI wrappers. These debug prints 1696 include the IPI handler function currently executing (if any) 1697 and relevant stack traces. 1698 1699config CSD_LOCK_WAIT_DEBUG_DEFAULT 1700 bool "Default csd_lock_wait() debugging on at boot time" 1701 depends on CSD_LOCK_WAIT_DEBUG 1702 depends on 64BIT 1703 default n 1704 help 1705 This option causes the csdlock_debug= kernel boot parameter to 1706 default to 1 (basic debugging) instead of 0 (no debugging). 1707 1708endmenu # lock debugging 1709 1710config TRACE_IRQFLAGS 1711 depends on TRACE_IRQFLAGS_SUPPORT 1712 bool 1713 help 1714 Enables hooks to interrupt enabling and disabling for 1715 either tracing or lock debugging. 1716 1717config TRACE_IRQFLAGS_NMI 1718 def_bool y 1719 depends on TRACE_IRQFLAGS 1720 depends on TRACE_IRQFLAGS_NMI_SUPPORT 1721 1722config NMI_CHECK_CPU 1723 bool "Debugging for CPUs failing to respond to backtrace requests" 1724 depends on DEBUG_KERNEL 1725 depends on X86 1726 default n 1727 help 1728 Enables debug prints when a CPU fails to respond to a given 1729 backtrace NMI. These prints provide some reasons why a CPU 1730 might legitimately be failing to respond, for example, if it 1731 is offline of if ignore_nmis is set. 1732 1733config DEBUG_IRQFLAGS 1734 bool "Debug IRQ flag manipulation" 1735 help 1736 Enables checks for potentially unsafe enabling or disabling of 1737 interrupts, such as calling raw_local_irq_restore() when interrupts 1738 are enabled. 1739 1740config STACKTRACE 1741 bool "Stack backtrace support" 1742 depends on STACKTRACE_SUPPORT 1743 help 1744 This option causes the kernel to create a /proc/pid/stack for 1745 every process, showing its current stack trace. 1746 It is also used by various kernel debugging features that require 1747 stack trace generation. 1748 1749config DEBUG_KOBJECT 1750 bool "kobject debugging" 1751 depends on DEBUG_KERNEL 1752 help 1753 If you say Y here, some extra kobject debugging messages will be sent 1754 to the syslog. 1755 1756config DEBUG_KOBJECT_RELEASE 1757 bool "kobject release debugging" 1758 depends on DEBUG_OBJECTS_TIMERS 1759 help 1760 kobjects are reference counted objects. This means that their 1761 last reference count put is not predictable, and the kobject can 1762 live on past the point at which a driver decides to drop its 1763 initial reference to the kobject gained on allocation. An 1764 example of this would be a struct device which has just been 1765 unregistered. 1766 1767 However, some buggy drivers assume that after such an operation, 1768 the memory backing the kobject can be immediately freed. This 1769 goes completely against the principles of a refcounted object. 1770 1771 If you say Y here, the kernel will delay the release of kobjects 1772 on the last reference count to improve the visibility of this 1773 kind of kobject release bug. 1774 1775config HAVE_DEBUG_BUGVERBOSE 1776 bool 1777 1778menu "Debug kernel data structures" 1779 1780config DEBUG_LIST 1781 bool "Debug linked list manipulation" 1782 depends on DEBUG_KERNEL 1783 select LIST_HARDENED 1784 help 1785 Enable this to turn on extended checks in the linked-list walking 1786 routines. 1787 1788 This option trades better quality error reports for performance, and 1789 is more suitable for kernel debugging. If you care about performance, 1790 you should only enable CONFIG_LIST_HARDENED instead. 1791 1792 If unsure, say N. 1793 1794config DEBUG_PLIST 1795 bool "Debug priority linked list manipulation" 1796 depends on DEBUG_KERNEL 1797 help 1798 Enable this to turn on extended checks in the priority-ordered 1799 linked-list (plist) walking routines. This checks the entire 1800 list multiple times during each manipulation. 1801 1802 If unsure, say N. 1803 1804config DEBUG_SG 1805 bool "Debug SG table operations" 1806 depends on DEBUG_KERNEL 1807 help 1808 Enable this to turn on checks on scatter-gather tables. This can 1809 help find problems with drivers that do not properly initialize 1810 their sg tables. 1811 1812 If unsure, say N. 1813 1814config DEBUG_NOTIFIERS 1815 bool "Debug notifier call chains" 1816 depends on DEBUG_KERNEL 1817 help 1818 Enable this to turn on sanity checking for notifier call chains. 1819 This is most useful for kernel developers to make sure that 1820 modules properly unregister themselves from notifier chains. 1821 This is a relatively cheap check but if you care about maximum 1822 performance, say N. 1823 1824config DEBUG_CLOSURES 1825 bool "Debug closures (bcache async widgits)" 1826 depends on CLOSURES 1827 select DEBUG_FS 1828 help 1829 Keeps all active closures in a linked list and provides a debugfs 1830 interface to list them, which makes it possible to see asynchronous 1831 operations that get stuck. 1832 1833config DEBUG_MAPLE_TREE 1834 bool "Debug maple trees" 1835 depends on DEBUG_KERNEL 1836 help 1837 Enable maple tree debugging information and extra validations. 1838 1839 If unsure, say N. 1840 1841endmenu 1842 1843source "kernel/rcu/Kconfig.debug" 1844 1845config DEBUG_WQ_FORCE_RR_CPU 1846 bool "Force round-robin CPU selection for unbound work items" 1847 depends on DEBUG_KERNEL 1848 default n 1849 help 1850 Workqueue used to implicitly guarantee that work items queued 1851 without explicit CPU specified are put on the local CPU. This 1852 guarantee is no longer true and while local CPU is still 1853 preferred work items may be put on foreign CPUs. Kernel 1854 parameter "workqueue.debug_force_rr_cpu" is added to force 1855 round-robin CPU selection to flush out usages which depend on the 1856 now broken guarantee. This config option enables the debug 1857 feature by default. When enabled, memory and cache locality will 1858 be impacted. 1859 1860config CPU_HOTPLUG_STATE_CONTROL 1861 bool "Enable CPU hotplug state control" 1862 depends on DEBUG_KERNEL 1863 depends on HOTPLUG_CPU 1864 default n 1865 help 1866 Allows to write steps between "offline" and "online" to the CPUs 1867 sysfs target file so states can be stepped granular. This is a debug 1868 option for now as the hotplug machinery cannot be stopped and 1869 restarted at arbitrary points yet. 1870 1871 Say N if your are unsure. 1872 1873config LATENCYTOP 1874 bool "Latency measuring infrastructure" 1875 depends on DEBUG_KERNEL 1876 depends on STACKTRACE_SUPPORT 1877 depends on PROC_FS 1878 depends on FRAME_POINTER || MIPS || PPC || S390 || MICROBLAZE || ARM || ARC || X86 1879 select KALLSYMS 1880 select KALLSYMS_ALL 1881 select STACKTRACE 1882 select SCHEDSTATS 1883 help 1884 Enable this option if you want to use the LatencyTOP tool 1885 to find out which userspace is blocking on what kernel operations. 1886 1887config DEBUG_CGROUP_REF 1888 bool "Disable inlining of cgroup css reference count functions" 1889 depends on DEBUG_KERNEL 1890 depends on CGROUPS 1891 depends on KPROBES 1892 default n 1893 help 1894 Force cgroup css reference count functions to not be inlined so 1895 that they can be kprobed for debugging. 1896 1897source "kernel/trace/Kconfig" 1898 1899config PROVIDE_OHCI1394_DMA_INIT 1900 bool "Remote debugging over FireWire early on boot" 1901 depends on PCI && X86 1902 help 1903 If you want to debug problems which hang or crash the kernel early 1904 on boot and the crashing machine has a FireWire port, you can use 1905 this feature to remotely access the memory of the crashed machine 1906 over FireWire. This employs remote DMA as part of the OHCI1394 1907 specification which is now the standard for FireWire controllers. 1908 1909 With remote DMA, you can monitor the printk buffer remotely using 1910 firescope and access all memory below 4GB using fireproxy from gdb. 1911 Even controlling a kernel debugger is possible using remote DMA. 1912 1913 Usage: 1914 1915 If ohci1394_dma=early is used as boot parameter, it will initialize 1916 all OHCI1394 controllers which are found in the PCI config space. 1917 1918 As all changes to the FireWire bus such as enabling and disabling 1919 devices cause a bus reset and thereby disable remote DMA for all 1920 devices, be sure to have the cable plugged and FireWire enabled on 1921 the debugging host before booting the debug target for debugging. 1922 1923 This code (~1k) is freed after boot. By then, the firewire stack 1924 in charge of the OHCI-1394 controllers should be used instead. 1925 1926 See Documentation/core-api/debugging-via-ohci1394.rst for more information. 1927 1928source "samples/Kconfig" 1929 1930config ARCH_HAS_DEVMEM_IS_ALLOWED 1931 bool 1932 1933config STRICT_DEVMEM 1934 bool "Filter access to /dev/mem" 1935 depends on MMU && DEVMEM 1936 depends on ARCH_HAS_DEVMEM_IS_ALLOWED || GENERIC_LIB_DEVMEM_IS_ALLOWED 1937 default y if PPC || X86 || ARM64 || S390 1938 help 1939 If this option is disabled, you allow userspace (root) access to all 1940 of memory, including kernel and userspace memory. Accidental 1941 access to this is obviously disastrous, but specific access can 1942 be used by people debugging the kernel. Note that with PAT support 1943 enabled, even in this case there are restrictions on /dev/mem 1944 use due to the cache aliasing requirements. 1945 1946 If this option is switched on, and IO_STRICT_DEVMEM=n, the /dev/mem 1947 file only allows userspace access to PCI space and the BIOS code and 1948 data regions. This is sufficient for dosemu and X and all common 1949 users of /dev/mem. 1950 1951 If in doubt, say Y. 1952 1953config IO_STRICT_DEVMEM 1954 bool "Filter I/O access to /dev/mem" 1955 depends on STRICT_DEVMEM 1956 help 1957 If this option is disabled, you allow userspace (root) access to all 1958 io-memory regardless of whether a driver is actively using that 1959 range. Accidental access to this is obviously disastrous, but 1960 specific access can be used by people debugging kernel drivers. 1961 1962 If this option is switched on, the /dev/mem file only allows 1963 userspace access to *idle* io-memory ranges (see /proc/iomem) This 1964 may break traditional users of /dev/mem (dosemu, legacy X, etc...) 1965 if the driver using a given range cannot be disabled. 1966 1967 If in doubt, say Y. 1968 1969menu "$(SRCARCH) Debugging" 1970 1971source "arch/$(SRCARCH)/Kconfig.debug" 1972 1973endmenu 1974 1975menu "Kernel Testing and Coverage" 1976 1977source "lib/kunit/Kconfig" 1978 1979config NOTIFIER_ERROR_INJECTION 1980 tristate "Notifier error injection" 1981 depends on DEBUG_KERNEL 1982 select DEBUG_FS 1983 help 1984 This option provides the ability to inject artificial errors to 1985 specified notifier chain callbacks. It is useful to test the error 1986 handling of notifier call chain failures. 1987 1988 Say N if unsure. 1989 1990config PM_NOTIFIER_ERROR_INJECT 1991 tristate "PM notifier error injection module" 1992 depends on PM && NOTIFIER_ERROR_INJECTION 1993 default m if PM_DEBUG 1994 help 1995 This option provides the ability to inject artificial errors to 1996 PM notifier chain callbacks. It is controlled through debugfs 1997 interface /sys/kernel/debug/notifier-error-inject/pm 1998 1999 If the notifier call chain should be failed with some events 2000 notified, write the error code to "actions/<notifier event>/error". 2001 2002 Example: Inject PM suspend error (-12 = -ENOMEM) 2003 2004 # cd /sys/kernel/debug/notifier-error-inject/pm/ 2005 # echo -12 > actions/PM_SUSPEND_PREPARE/error 2006 # echo mem > /sys/power/state 2007 bash: echo: write error: Cannot allocate memory 2008 2009 To compile this code as a module, choose M here: the module will 2010 be called pm-notifier-error-inject. 2011 2012 If unsure, say N. 2013 2014config OF_RECONFIG_NOTIFIER_ERROR_INJECT 2015 tristate "OF reconfig notifier error injection module" 2016 depends on OF_DYNAMIC && NOTIFIER_ERROR_INJECTION 2017 help 2018 This option provides the ability to inject artificial errors to 2019 OF reconfig notifier chain callbacks. It is controlled 2020 through debugfs interface under 2021 /sys/kernel/debug/notifier-error-inject/OF-reconfig/ 2022 2023 If the notifier call chain should be failed with some events 2024 notified, write the error code to "actions/<notifier event>/error". 2025 2026 To compile this code as a module, choose M here: the module will 2027 be called of-reconfig-notifier-error-inject. 2028 2029 If unsure, say N. 2030 2031config NETDEV_NOTIFIER_ERROR_INJECT 2032 tristate "Netdev notifier error injection module" 2033 depends on NET && NOTIFIER_ERROR_INJECTION 2034 help 2035 This option provides the ability to inject artificial errors to 2036 netdevice notifier chain callbacks. It is controlled through debugfs 2037 interface /sys/kernel/debug/notifier-error-inject/netdev 2038 2039 If the notifier call chain should be failed with some events 2040 notified, write the error code to "actions/<notifier event>/error". 2041 2042 Example: Inject netdevice mtu change error (-22 = -EINVAL) 2043 2044 # cd /sys/kernel/debug/notifier-error-inject/netdev 2045 # echo -22 > actions/NETDEV_CHANGEMTU/error 2046 # ip link set eth0 mtu 1024 2047 RTNETLINK answers: Invalid argument 2048 2049 To compile this code as a module, choose M here: the module will 2050 be called netdev-notifier-error-inject. 2051 2052 If unsure, say N. 2053 2054config FUNCTION_ERROR_INJECTION 2055 bool "Fault-injections of functions" 2056 depends on HAVE_FUNCTION_ERROR_INJECTION && KPROBES 2057 help 2058 Add fault injections into various functions that are annotated with 2059 ALLOW_ERROR_INJECTION() in the kernel. BPF may also modify the return 2060 value of these functions. This is useful to test error paths of code. 2061 2062 If unsure, say N 2063 2064config FAULT_INJECTION 2065 bool "Fault-injection framework" 2066 depends on DEBUG_KERNEL 2067 help 2068 Provide fault-injection framework. 2069 For more details, see Documentation/fault-injection/. 2070 2071config FAILSLAB 2072 bool "Fault-injection capability for kmalloc" 2073 depends on FAULT_INJECTION 2074 help 2075 Provide fault-injection capability for kmalloc. 2076 2077config FAIL_PAGE_ALLOC 2078 bool "Fault-injection capability for alloc_pages()" 2079 depends on FAULT_INJECTION 2080 help 2081 Provide fault-injection capability for alloc_pages(). 2082 2083config FAULT_INJECTION_USERCOPY 2084 bool "Fault injection capability for usercopy functions" 2085 depends on FAULT_INJECTION 2086 help 2087 Provides fault-injection capability to inject failures 2088 in usercopy functions (copy_from_user(), get_user(), ...). 2089 2090config FAIL_MAKE_REQUEST 2091 bool "Fault-injection capability for disk IO" 2092 depends on FAULT_INJECTION && BLOCK 2093 help 2094 Provide fault-injection capability for disk IO. 2095 2096config FAIL_IO_TIMEOUT 2097 bool "Fault-injection capability for faking disk interrupts" 2098 depends on FAULT_INJECTION && BLOCK 2099 help 2100 Provide fault-injection capability on end IO handling. This 2101 will make the block layer "forget" an interrupt as configured, 2102 thus exercising the error handling. 2103 2104 Only works with drivers that use the generic timeout handling, 2105 for others it won't do anything. 2106 2107config FAIL_FUTEX 2108 bool "Fault-injection capability for futexes" 2109 select DEBUG_FS 2110 depends on FAULT_INJECTION && FUTEX 2111 help 2112 Provide fault-injection capability for futexes. 2113 2114config FAULT_INJECTION_DEBUG_FS 2115 bool "Debugfs entries for fault-injection capabilities" 2116 depends on FAULT_INJECTION && SYSFS && DEBUG_FS 2117 help 2118 Enable configuration of fault-injection capabilities via debugfs. 2119 2120config FAIL_FUNCTION 2121 bool "Fault-injection capability for functions" 2122 depends on FAULT_INJECTION_DEBUG_FS && FUNCTION_ERROR_INJECTION 2123 help 2124 Provide function-based fault-injection capability. 2125 This will allow you to override a specific function with a return 2126 with given return value. As a result, function caller will see 2127 an error value and have to handle it. This is useful to test the 2128 error handling in various subsystems. 2129 2130config FAIL_MMC_REQUEST 2131 bool "Fault-injection capability for MMC IO" 2132 depends on FAULT_INJECTION_DEBUG_FS && MMC 2133 help 2134 Provide fault-injection capability for MMC IO. 2135 This will make the mmc core return data errors. This is 2136 useful to test the error handling in the mmc block device 2137 and to test how the mmc host driver handles retries from 2138 the block device. 2139 2140config FAIL_SUNRPC 2141 bool "Fault-injection capability for SunRPC" 2142 depends on FAULT_INJECTION_DEBUG_FS && SUNRPC_DEBUG 2143 help 2144 Provide fault-injection capability for SunRPC and 2145 its consumers. 2146 2147config FAIL_SKB_REALLOC 2148 bool "Fault-injection capability forcing skb to reallocate" 2149 depends on FAULT_INJECTION_DEBUG_FS 2150 help 2151 Provide fault-injection capability that forces the skb to be 2152 reallocated, catching possible invalid pointers to the skb. 2153 2154 For more information, check 2155 Documentation/fault-injection/fault-injection.rst 2156 2157config FAULT_INJECTION_CONFIGFS 2158 bool "Configfs interface for fault-injection capabilities" 2159 depends on FAULT_INJECTION 2160 select CONFIGFS_FS 2161 help 2162 This option allows configfs-based drivers to dynamically configure 2163 fault-injection via configfs. Each parameter for driver-specific 2164 fault-injection can be made visible as a configfs attribute in a 2165 configfs group. 2166 2167 2168config FAULT_INJECTION_STACKTRACE_FILTER 2169 bool "stacktrace filter for fault-injection capabilities" 2170 depends on FAULT_INJECTION 2171 depends on (FAULT_INJECTION_DEBUG_FS || FAULT_INJECTION_CONFIGFS) && STACKTRACE_SUPPORT 2172 select STACKTRACE 2173 depends on FRAME_POINTER || MIPS || PPC || S390 || MICROBLAZE || ARM || ARC || X86 2174 help 2175 Provide stacktrace filter for fault-injection capabilities 2176 2177config ARCH_HAS_KCOV 2178 bool 2179 help 2180 An architecture should select this when it can successfully 2181 build and run with CONFIG_KCOV. This typically requires 2182 disabling instrumentation for some early boot code. 2183 2184config KCOV 2185 bool "Code coverage for fuzzing" 2186 depends on ARCH_HAS_KCOV 2187 depends on !ARCH_WANTS_NO_INSTR || HAVE_NOINSTR_HACK || \ 2188 GCC_VERSION >= 120000 || CC_IS_CLANG 2189 select DEBUG_FS 2190 select OBJTOOL if HAVE_NOINSTR_HACK 2191 help 2192 KCOV exposes kernel code coverage information in a form suitable 2193 for coverage-guided fuzzing (randomized testing). 2194 2195 For more details, see Documentation/dev-tools/kcov.rst. 2196 2197config KCOV_ENABLE_COMPARISONS 2198 bool "Enable comparison operands collection by KCOV" 2199 depends on KCOV 2200 depends on $(cc-option,-fsanitize-coverage=trace-cmp) 2201 help 2202 KCOV also exposes operands of every comparison in the instrumented 2203 code along with operand sizes and PCs of the comparison instructions. 2204 These operands can be used by fuzzing engines to improve the quality 2205 of fuzzing coverage. 2206 2207config KCOV_INSTRUMENT_ALL 2208 bool "Instrument all code by default" 2209 depends on KCOV 2210 default y 2211 help 2212 If you are doing generic system call fuzzing (like e.g. syzkaller), 2213 then you will want to instrument the whole kernel and you should 2214 say y here. If you are doing more targeted fuzzing (like e.g. 2215 filesystem fuzzing with AFL) then you will want to enable coverage 2216 for more specific subsets of files, and should say n here. 2217 2218config KCOV_IRQ_AREA_SIZE 2219 hex "Size of interrupt coverage collection area in words" 2220 depends on KCOV 2221 range 0x80 0x1000000 2222 default 0x40000 2223 help 2224 KCOV uses preallocated areas to collect coverage from soft 2225 interrupts. This specifies the size of those areas in the 2226 number of unsigned long words. 2227 2228config KCOV_SELFTEST 2229 bool "Perform short selftests on boot" 2230 depends on KCOV 2231 help 2232 Run short KCOV coverage collection selftests on boot. 2233 On test failure, causes the kernel to panic. Recommended to be 2234 enabled, ensuring critical functionality works as intended. 2235 2236menuconfig RUNTIME_TESTING_MENU 2237 bool "Runtime Testing" 2238 default y 2239 2240if RUNTIME_TESTING_MENU 2241 2242config 842_DECOMPRESS_KUNIT_TEST 2243 tristate "KUnit tests for the 842 decompressor" if !KUNIT_ALL_TESTS 2244 depends on KUNIT 2245 depends on 842_DECOMPRESS 2246 default KUNIT_ALL_TESTS 2247 help 2248 Enable stream-validation and boundary tests for the software 842 2249 decompressor. The tests exercise indexed copies, short data and 2250 repeat operations at valid and invalid output or history boundaries. 2251 2252 For more information on KUnit and unit tests in general, refer to 2253 Documentation/dev-tools/kunit/. 2254 2255 If unsure, say N. 2256 2257config TEST_DHRY 2258 tristate "Dhrystone benchmark test" 2259 help 2260 Enable this to include the Dhrystone 2.1 benchmark. This test 2261 calculates the number of Dhrystones per second, and the number of 2262 DMIPS (Dhrystone MIPS) obtained when the Dhrystone score is divided 2263 by 1757 (the number of Dhrystones per second obtained on the VAX 2264 11/780, nominally a 1 MIPS machine). 2265 2266 To run the benchmark, it needs to be enabled explicitly, either from 2267 the kernel command line (when built-in), or from userspace (when 2268 built-in or modular). 2269 2270 Run once during kernel boot: 2271 2272 test_dhry.run 2273 2274 Set number of iterations from kernel command line: 2275 2276 test_dhry.iterations=<n> 2277 2278 Set number of iterations from userspace: 2279 2280 echo <n> > /sys/module/test_dhry/parameters/iterations 2281 2282 Trigger manual run from userspace: 2283 2284 echo y > /sys/module/test_dhry/parameters/run 2285 2286 If the number of iterations is <= 0, the test will devise a suitable 2287 number of iterations (test runs for at least 2s) automatically. 2288 This process takes ca. 4s. 2289 2290 If unsure, say N. 2291 2292config LKDTM 2293 tristate "Linux Kernel Dump Test Tool Module" 2294 depends on DEBUG_FS 2295 help 2296 This module enables testing of the different dumping mechanisms by 2297 inducing system failures at predefined crash points. 2298 If you don't need it: say N 2299 Choose M here to compile this code as a module. The module will be 2300 called lkdtm. 2301 2302 Documentation on how to use the module can be found in 2303 Documentation/fault-injection/provoke-crashes.rst 2304 2305config CPUMASK_KUNIT_TEST 2306 tristate "KUnit test for cpumask" if !KUNIT_ALL_TESTS 2307 depends on KUNIT 2308 default KUNIT_ALL_TESTS 2309 help 2310 Enable to turn on cpumask tests, running at boot or module load time. 2311 2312 For more information on KUnit and unit tests in general, please refer 2313 to the KUnit documentation in Documentation/dev-tools/kunit/. 2314 2315 If unsure, say N. 2316 2317config TEST_LIST_SORT 2318 tristate "Linked list sorting test" if !KUNIT_ALL_TESTS 2319 depends on KUNIT 2320 default KUNIT_ALL_TESTS 2321 help 2322 Enable this to turn on 'list_sort()' function test. This test is 2323 executed only once during system boot (so affects only boot time), 2324 or at module load time. 2325 2326 If unsure, say N. 2327 2328config TEST_SORT 2329 tristate "Array-based sort test" if !KUNIT_ALL_TESTS 2330 depends on KUNIT 2331 default KUNIT_ALL_TESTS 2332 help 2333 This option enables the self-test function of 'sort()' at boot, 2334 or at module load time. 2335 2336 If unsure, say N. 2337 2338config TEST_DIV64 2339 tristate "64bit/32bit division and modulo test" 2340 depends on DEBUG_KERNEL || m 2341 help 2342 Enable this to turn on 'do_div()' function test. This test is 2343 executed only once during system boot (so affects only boot time), 2344 or at module load time. 2345 2346 If unsure, say N. 2347 2348config TEST_MULDIV64 2349 tristate "mul_u64_u64_div_u64() test" 2350 depends on DEBUG_KERNEL || m 2351 help 2352 Enable this to turn on 'mul_u64_u64_div_u64()' function test. 2353 This test is executed only once during system boot (so affects 2354 only boot time), or at module load time. 2355 2356 If unsure, say N. 2357 2358config TEST_IOV_ITER 2359 tristate "Test iov_iter operation" if !KUNIT_ALL_TESTS 2360 depends on KUNIT 2361 depends on MMU 2362 default KUNIT_ALL_TESTS 2363 help 2364 Enable this to turn on testing of the operation of the I/O iterator 2365 (iov_iter). This test is executed only once during system boot (so 2366 affects only boot time), or at module load time. 2367 2368 If unsure, say N. 2369 2370config KPROBES_SANITY_TEST 2371 tristate "Kprobes sanity tests" if !KUNIT_ALL_TESTS 2372 depends on DEBUG_KERNEL 2373 depends on KPROBES 2374 depends on KUNIT 2375 select STACKTRACE if ARCH_CORRECT_STACKTRACE_ON_KRETPROBE 2376 default KUNIT_ALL_TESTS 2377 help 2378 This option provides for testing basic kprobes functionality on 2379 boot. Samples of kprobe and kretprobe are inserted and 2380 verified for functionality. 2381 2382 Say N if you are unsure. 2383 2384config FPROBE_SANITY_TEST 2385 bool "Self test for fprobe" 2386 depends on DEBUG_KERNEL 2387 depends on FPROBE 2388 depends on KUNIT=y 2389 help 2390 This option will enable testing the fprobe when the system boot. 2391 A series of tests are made to verify that the fprobe is functioning 2392 properly. 2393 2394 Say N if you are unsure. 2395 2396config BACKTRACE_SELF_TEST 2397 tristate "Self test for the backtrace code" 2398 depends on DEBUG_KERNEL 2399 help 2400 This option provides a kernel module that can be used to test 2401 the kernel stack backtrace code. This option is not useful 2402 for distributions or general kernels, but only for kernel 2403 developers working on architecture code. 2404 2405 Note that if you want to also test saved backtraces, you will 2406 have to enable STACKTRACE as well. 2407 2408 Say N if you are unsure. 2409 2410config TEST_REF_TRACKER 2411 tristate "Self test for reference tracker" 2412 depends on DEBUG_KERNEL && STACKTRACE_SUPPORT 2413 select REF_TRACKER 2414 help 2415 This option provides a kernel module performing tests 2416 using reference tracker infrastructure. 2417 2418 Say N if you are unsure. 2419 2420config RBTREE_TEST 2421 tristate "Red-Black tree test" 2422 depends on DEBUG_KERNEL 2423 help 2424 A benchmark measuring the performance of the rbtree library. 2425 Also includes rbtree invariant checks. 2426 2427config REED_SOLOMON_TEST 2428 tristate "Reed-Solomon library test" 2429 depends on DEBUG_KERNEL || m 2430 select REED_SOLOMON 2431 select REED_SOLOMON_ENC16 2432 select REED_SOLOMON_DEC16 2433 help 2434 This option enables the self-test function of rslib at boot, 2435 or at module load time. 2436 2437 If unsure, say N. 2438 2439config INTERVAL_TREE_TEST 2440 tristate "Interval tree test" 2441 depends on DEBUG_KERNEL 2442 select INTERVAL_TREE 2443 help 2444 A benchmark measuring the performance of the interval tree library 2445 2446config PERCPU_TEST 2447 tristate "Per cpu operations test" 2448 depends on m && DEBUG_KERNEL 2449 help 2450 Enable this option to build test module which validates per-cpu 2451 operations. 2452 2453 If unsure, say N. 2454 2455config ATOMIC64_SELFTEST 2456 tristate "Perform an atomic64_t self-test" 2457 help 2458 Enable this option to test the atomic64_t functions at boot or 2459 at module load time. 2460 2461 If unsure, say N. 2462 2463config ASYNC_RAID6_TEST 2464 tristate "Self test for hardware accelerated raid6 recovery" 2465 depends on ASYNC_RAID6_RECOV 2466 select ASYNC_MEMCPY 2467 help 2468 This is a one-shot self test that permutes through the 2469 recovery of all the possible two disk failure scenarios for a 2470 N-disk array. Recovery is performed with the asynchronous 2471 raid6 recovery routines, and will optionally use an offload 2472 engine if one is available. 2473 2474 If unsure, say N. 2475 2476config TEST_HEXDUMP 2477 tristate "Test functions located in the hexdump module at runtime" 2478 2479config PRINTF_KUNIT_TEST 2480 tristate "KUnit test printf() family of functions at runtime" if !KUNIT_ALL_TESTS 2481 depends on KUNIT 2482 default KUNIT_ALL_TESTS 2483 help 2484 Enable this option to test the printf functions at runtime. 2485 2486 If unsure, say N. 2487 2488config SCANF_KUNIT_TEST 2489 tristate "KUnit test scanf() family of functions at runtime" if !KUNIT_ALL_TESTS 2490 depends on KUNIT 2491 default KUNIT_ALL_TESTS 2492 help 2493 Enable this option to test the scanf functions at runtime. 2494 2495 If unsure, say N. 2496 2497config SEQ_BUF_KUNIT_TEST 2498 tristate "KUnit test for seq_buf" if !KUNIT_ALL_TESTS 2499 depends on KUNIT 2500 default KUNIT_ALL_TESTS 2501 help 2502 This builds unit tests for the seq_buf library. 2503 2504 If unsure, say N. 2505 2506config STRING_KUNIT_TEST 2507 tristate "KUnit test string functions at runtime" if !KUNIT_ALL_TESTS 2508 depends on KUNIT 2509 default KUNIT_ALL_TESTS 2510 2511config STRING_HELPERS_KUNIT_TEST 2512 tristate "KUnit test string helpers at runtime" if !KUNIT_ALL_TESTS 2513 depends on KUNIT 2514 default KUNIT_ALL_TESTS 2515 2516config STRING_KUNIT_BENCH 2517 bool "Benchmark string functions at runtime" 2518 depends on STRING_KUNIT_TEST 2519 help 2520 Enable performance measurement for string functions. 2521 2522 This measures the execution efficiency of string functions 2523 during the KUnit test run. 2524 2525 If unsure, say N. 2526 2527config FFS_KUNIT_TEST 2528 tristate "KUnit test ffs-family functions at runtime" if !KUNIT_ALL_TESTS 2529 depends on KUNIT 2530 default KUNIT_ALL_TESTS 2531 help 2532 This builds KUnit tests for ffs-family bit manipulation functions 2533 including ffs(), __ffs(), fls(), __fls(), fls64(), and __ffs64(). 2534 2535 These tests validate mathematical correctness, edge case handling, 2536 and cross-architecture consistency of bit scanning functions. 2537 2538 For more information on KUnit and unit tests in general, 2539 please refer to Documentation/dev-tools/kunit/. 2540 2541config TEST_KSTRTOX 2542 tristate "Test kstrto*() family of functions at runtime" 2543 2544config TEST_BITMAP 2545 tristate "Test bitmap_*() family of functions at runtime" 2546 help 2547 Enable this option to test the bitmap functions at boot. 2548 2549 If unsure, say N. 2550 2551config TEST_XARRAY 2552 tristate "Test the XArray code at runtime" 2553 2554config TEST_MAPLE_TREE 2555 tristate "Test the Maple Tree code at runtime or module load" 2556 help 2557 Enable this option to test the maple tree code functions at boot, or 2558 when the module is loaded. Enable "Debug Maple Trees" will enable 2559 more verbose output on failures. 2560 2561 If unsure, say N. 2562 2563config TEST_RHASHTABLE 2564 tristate "Perform selftest on resizable hash table" 2565 help 2566 Enable this option to test the rhashtable functions at boot. 2567 2568 If unsure, say N. 2569 2570config TEST_IDA 2571 tristate "Perform selftest on IDA functions" 2572 2573config TEST_MISC_MINOR 2574 bool "miscdevice KUnit test" if !KUNIT_ALL_TESTS 2575 depends on KUNIT=y 2576 default KUNIT_ALL_TESTS 2577 help 2578 Kunit test for miscdevice API, specially its behavior in respect to 2579 static and dynamic minor numbers. 2580 2581 KUnit tests run during boot and output the results to the debug log 2582 in TAP format (https://testanything.org/). Only useful for kernel devs 2583 running the KUnit test harness, and not intended for inclusion into a 2584 production build. 2585 2586 For more information on KUnit and unit tests in general please refer 2587 to the KUnit documentation in Documentation/dev-tools/kunit/. 2588 2589 If unsure, say N. 2590 2591config TEST_PARMAN 2592 tristate "Perform selftest on priority array manager" 2593 depends on PARMAN 2594 help 2595 Enable this option to test priority array manager on boot 2596 (or module load). 2597 2598 If unsure, say N. 2599 2600config TEST_LKM 2601 tristate "Test module loading with 'hello world' module" 2602 depends on m 2603 help 2604 This builds the "test_module" module that emits "Hello, world" 2605 on printk when loaded. It is designed to be used for basic 2606 evaluation of the module loading subsystem (for example when 2607 validating module verification). It lacks any extra dependencies, 2608 and will not normally be loaded by the system unless explicitly 2609 requested by name. 2610 2611 If unsure, say N. 2612 2613config TEST_BITOPS 2614 tristate "Test module for compilation of bitops operations" 2615 help 2616 This builds the "test_bitops" module that is much like the 2617 TEST_LKM module except that it does a basic exercise of the 2618 set/clear_bit macros and get_count_order/long to make sure there are 2619 no compiler warnings from C=1 sparse checker or -Wextra 2620 compilations. It has no dependencies and doesn't run or load unless 2621 explicitly requested by name. for example: modprobe test_bitops. 2622 2623 If unsure, say N. 2624 2625config TEST_VMALLOC 2626 tristate "Test module for stress/performance analysis of vmalloc allocator" 2627 default n 2628 depends on MMU 2629 help 2630 This builds the "test_vmalloc" module that should be used for 2631 stress and performance analysis. So, any new change for vmalloc 2632 subsystem can be evaluated from performance and stability point 2633 of view. 2634 2635 If unsure, say N. 2636 2637config TEST_WORKQUEUE 2638 tristate "Test module for stress/performance analysis of workqueue" 2639 depends on m 2640 default n 2641 help 2642 This builds the "test_workqueue" module for benchmarking 2643 workqueue throughput under contention. Useful for evaluating 2644 affinity scope changes (e.g., cache_shard vs cache). 2645 2646 The test drives sysfs to switch affinity scopes, so it must be 2647 loaded after userspace has mounted sysfs; building it in (=y) 2648 would run module_init before /sys is available. 2649 2650 If unsure, say N. 2651 2652config TEST_BPF 2653 tristate "Test BPF filter functionality" 2654 depends on m && NET 2655 help 2656 This builds the "test_bpf" module that runs various test vectors 2657 against the BPF interpreter or BPF JIT compiler depending on the 2658 current setting. This is in particular useful for BPF JIT compiler 2659 development, but also to run regression tests against changes in 2660 the interpreter code. It also enables test stubs for eBPF maps and 2661 verifier used by user space verifier testsuite. 2662 2663 If unsure, say N. 2664 2665config FIND_BIT_BENCHMARK 2666 tristate "Test find_bit functions" 2667 help 2668 This builds the "test_find_bit" module that measure find_*_bit() 2669 functions performance. 2670 2671 If unsure, say N. 2672 2673config REGION_ALLOC_BENCHMARK 2674 tristate "Benchmark bitmap, IDA and Maple Tree region allocation" 2675 help 2676 This builds a microbenchmark comparing variable-sized region 2677 allocation using bitmaps, IDA and Maple Tree. The benchmark 2678 runs at initialization time. 2679 2680 Usage: 2681 insmod region_alloc_benchmark.ko 2682 insmod region_alloc_benchmark.ko capacities=1024,2048,4096,65536 2683 2684 If unsure, say N. 2685 2686config FIND_BIT_BENCHMARK_RUST 2687 tristate "Test find_bit functions in Rust" 2688 depends on RUST 2689 help 2690 This builds the "find_bit_benchmark_rust" module. It is a micro 2691 benchmark that measures the performance of Rust functions that 2692 correspond to the find_*_bit() operations in C. It follows the 2693 FIND_BIT_BENCHMARK closely but will in general not yield same 2694 numbers due to extra bounds checks and overhead of foreign 2695 function calls. 2696 2697 If unsure, say N. 2698 2699config TEST_FIRMWARE 2700 tristate "Test firmware loading via userspace interface" 2701 depends on FW_LOADER 2702 help 2703 This builds the "test_firmware" module that creates a userspace 2704 interface for testing firmware loading. This can be used to 2705 control the triggering of firmware loading without needing an 2706 actual firmware-using device. The contents can be rechecked by 2707 userspace. 2708 2709 If unsure, say N. 2710 2711config TEST_SYSCTL 2712 tristate "sysctl test driver" 2713 depends on SYSCTL 2714 help 2715 This builds the "test_sysctl" module. This driver enables to test the 2716 proc sysctl interfaces available to drivers safely without affecting 2717 production knobs which might alter system functionality. 2718 2719 If unsure, say N. 2720 2721config BITOPS_KUNIT 2722 tristate "KUnit test for bitops" if !KUNIT_ALL_TESTS 2723 depends on KUNIT 2724 default KUNIT_ALL_TESTS 2725 help 2726 This option enables the KUnit test for the bitops library 2727 which provides functions for bit operations. 2728 2729 Note that this is derived from the original test_bitops module. 2730 For micro-benchmarks and compiler warning checks, enable TEST_BITOPS. 2731 2732 If unsure, say N. 2733 2734config BITFIELD_KUNIT 2735 tristate "KUnit test bitfield functions at runtime" if !KUNIT_ALL_TESTS 2736 depends on KUNIT 2737 default KUNIT_ALL_TESTS 2738 help 2739 Enable this option to test the bitfield functions at boot. 2740 2741 KUnit tests run during boot and output the results to the debug log 2742 in TAP format (http://testanything.org/). Only useful for kernel devs 2743 running the KUnit test harness, and not intended for inclusion into a 2744 production build. 2745 2746 For more information on KUnit and unit tests in general please refer 2747 to the KUnit documentation in Documentation/dev-tools/kunit/. 2748 2749 If unsure, say N. 2750 2751config CHECKSUM_KUNIT 2752 tristate "KUnit test checksum functions at runtime" if !KUNIT_ALL_TESTS 2753 depends on KUNIT 2754 default KUNIT_ALL_TESTS 2755 help 2756 Enable this option to test the checksum functions at boot. 2757 2758 KUnit tests run during boot and output the results to the debug log 2759 in TAP format (http://testanything.org/). Only useful for kernel devs 2760 running the KUnit test harness, and not intended for inclusion into a 2761 production build. 2762 2763 For more information on KUnit and unit tests in general please refer 2764 to the KUnit documentation in Documentation/dev-tools/kunit/. 2765 2766 If unsure, say N. 2767 2768config UTIL_MACROS_KUNIT 2769 tristate "KUnit test util_macros.h functions at runtime" if !KUNIT_ALL_TESTS 2770 depends on KUNIT 2771 default KUNIT_ALL_TESTS 2772 help 2773 Enable this option to test the util_macros.h function at boot. 2774 2775 KUnit tests run during boot and output the results to the debug log 2776 in TAP format (http://testanything.org/). Only useful for kernel devs 2777 running the KUnit test harness, and not intended for inclusion into a 2778 production build. 2779 2780 For more information on KUnit and unit tests in general please refer 2781 to the KUnit documentation in Documentation/dev-tools/kunit/. 2782 2783 If unsure, say N. 2784 2785config HASH_KUNIT_TEST 2786 tristate "KUnit Test for integer hash functions" if !KUNIT_ALL_TESTS 2787 depends on KUNIT 2788 default KUNIT_ALL_TESTS 2789 help 2790 Enable this option to test the kernel's string (<linux/stringhash.h>), and 2791 integer (<linux/hash.h>) hash functions on boot. 2792 2793 KUnit tests run during boot and output the results to the debug log 2794 in TAP format (https://testanything.org/). Only useful for kernel devs 2795 running the KUnit test harness, and not intended for inclusion into a 2796 production build. 2797 2798 For more information on KUnit and unit tests in general please refer 2799 to the KUnit documentation in Documentation/dev-tools/kunit/. 2800 2801 This is intended to help people writing architecture-specific 2802 optimized versions. If unsure, say N. 2803 2804config RESOURCE_KUNIT_TEST 2805 tristate "KUnit test for resource API" if !KUNIT_ALL_TESTS 2806 depends on KUNIT 2807 default KUNIT_ALL_TESTS 2808 select GET_FREE_REGION 2809 help 2810 This builds the resource API unit test. 2811 Tests the logic of API provided by resource.c and ioport.h. 2812 For more information on KUnit and unit tests in general please refer 2813 to the KUnit documentation in Documentation/dev-tools/kunit/. 2814 2815 If unsure, say N. 2816 2817config SYSCTL_KUNIT_TEST 2818 tristate "KUnit test for sysctl" if !KUNIT_ALL_TESTS 2819 depends on KUNIT 2820 default KUNIT_ALL_TESTS 2821 help 2822 This builds the proc sysctl unit test, which runs on boot. 2823 Tests the API contract and implementation correctness of sysctl. 2824 For more information on KUnit and unit tests in general please refer 2825 to the KUnit documentation in Documentation/dev-tools/kunit/. 2826 2827 If unsure, say N. 2828 2829config KFIFO_KUNIT_TEST 2830 tristate "KUnit Test for the generic kernel FIFO implementation" if !KUNIT_ALL_TESTS 2831 depends on KUNIT 2832 default KUNIT_ALL_TESTS 2833 help 2834 This builds the generic FIFO implementation KUnit test suite. 2835 It tests that the API and basic functionality of the kfifo type 2836 and associated macros. 2837 2838 For more information on KUnit and unit tests in general please refer 2839 to the KUnit documentation in Documentation/dev-tools/kunit/. 2840 2841 If unsure, say N. 2842 2843config LIST_KUNIT_TEST 2844 tristate "KUnit Test for Kernel Linked-list structures" if !KUNIT_ALL_TESTS 2845 depends on KUNIT 2846 default KUNIT_ALL_TESTS 2847 help 2848 This builds the linked list KUnit test suite. 2849 It tests that the API and basic functionality of the list_head type 2850 and associated macros. 2851 2852 KUnit tests run during boot and output the results to the debug log 2853 in TAP format (https://testanything.org/). Only useful for kernel devs 2854 running the KUnit test harness, and not intended for inclusion into a 2855 production build. 2856 2857 For more information on KUnit and unit tests in general please refer 2858 to the KUnit documentation in Documentation/dev-tools/kunit/. 2859 2860 If unsure, say N. 2861 2862config LIST_PRIVATE_KUNIT_TEST 2863 tristate "KUnit Test for Kernel Private Linked-list structures" if !KUNIT_ALL_TESTS 2864 depends on KUNIT 2865 default KUNIT_ALL_TESTS 2866 help 2867 This builds the KUnit test for the private linked-list primitives 2868 defined in include/linux/list_private.h. 2869 2870 These primitives allow manipulation of list_head members that are 2871 marked as private and require special accessors (ACCESS_PRIVATE) 2872 to strip qualifiers or handle encapsulation. 2873 2874 If unsure, say N. 2875 2876config HASHTABLE_KUNIT_TEST 2877 tristate "KUnit Test for Kernel Hashtable structures" if !KUNIT_ALL_TESTS 2878 depends on KUNIT 2879 default KUNIT_ALL_TESTS 2880 help 2881 This builds the hashtable KUnit test suite. 2882 It tests the basic functionality of the API defined in 2883 include/linux/hashtable.h. For more information on KUnit and 2884 unit tests in general please refer to the KUnit documentation 2885 in Documentation/dev-tools/kunit/. 2886 2887 If unsure, say N. 2888 2889config LINEAR_RANGES_TEST 2890 tristate "KUnit test for linear_ranges" 2891 depends on KUNIT 2892 select LINEAR_RANGES 2893 help 2894 This builds the linear_ranges unit test, which runs on boot. 2895 Tests the linear_ranges logic correctness. 2896 For more information on KUnit and unit tests in general please refer 2897 to the KUnit documentation in Documentation/dev-tools/kunit/. 2898 2899 If unsure, say N. 2900 2901config CONTEXT_ANALYSIS_TEST 2902 bool "Compiler context-analysis warnings test" 2903 depends on EXPERT 2904 help 2905 This builds the test for compiler-based context analysis. The test 2906 does not add executable code to the kernel, but is meant to test that 2907 common patterns supported by the analysis do not result in false 2908 positive warnings. 2909 2910 When adding support for new context locks, it is strongly recommended 2911 to add supported patterns to this test. 2912 2913 If unsure, say N. 2914 2915config LIVEUPDATE_TEST 2916 bool "Live Update Kernel Test" 2917 default n 2918 depends on LIVEUPDATE 2919 help 2920 Enable a built-in kernel test module for the Live Update 2921 Orchestrator. 2922 2923 This module validates the File-Lifecycle-Bound subsystem by 2924 registering a set of mock FLB objects with any real file handlers 2925 that support live update (such as the memfd handler). 2926 2927 When live update operations are performed, this test module will 2928 output messages to the kernel log (dmesg), confirming that its 2929 registration and various callback functions (preserve, retrieve, 2930 finish, etc.) are being invoked correctly. 2931 2932 This is a debugging and regression testing tool for developers 2933 working on the Live Update subsystem. It should not be enabled in 2934 production kernels. 2935 2936 If unsure, say N 2937 2938config DIMLIB_KUNIT_TEST 2939 tristate "KUnit test for the DIM library" if !KUNIT_ALL_TESTS 2940 depends on KUNIT && NET 2941 select DIMLIB 2942 default KUNIT_ALL_TESTS 2943 help 2944 This builds the KUnit test for the Dynamic Interrupt Moderation 2945 library (lib/dim/), which checks the rate statistics computed by 2946 dim_calc_stats(). 2947 2948 For more information on KUnit and unit tests in general please refer 2949 to the KUnit documentation in Documentation/dev-tools/kunit/. 2950 2951 If unsure, say N. 2952 2953config CMDLINE_KUNIT_TEST 2954 tristate "KUnit test for cmdline API" if !KUNIT_ALL_TESTS 2955 depends on KUNIT 2956 default KUNIT_ALL_TESTS 2957 help 2958 This builds the cmdline API unit test. 2959 Tests the logic of API provided by cmdline.c. 2960 For more information on KUnit and unit tests in general please refer 2961 to the KUnit documentation in Documentation/dev-tools/kunit/. 2962 2963 If unsure, say N. 2964 2965config BASE64_KUNIT 2966 tristate "KUnit test for base64 decoding and encoding" if !KUNIT_ALL_TESTS 2967 depends on KUNIT 2968 default KUNIT_ALL_TESTS 2969 help 2970 This builds the base64 unit tests. 2971 2972 The tests cover the encoding and decoding logic of Base64 functions 2973 in the kernel. 2974 In addition to correctness checks, simple performance benchmarks 2975 for both encoding and decoding are also included. 2976 2977 For more information on KUnit and unit tests in general please refer 2978 to the KUnit documentation in Documentation/dev-tools/kunit/. 2979 2980 If unsure, say N. 2981 2982config BITS_TEST 2983 tristate "KUnit test for bit functions and macros" if !KUNIT_ALL_TESTS 2984 depends on KUNIT 2985 default KUNIT_ALL_TESTS 2986 help 2987 This builds the bits unit test. 2988 Tests the logic of macros defined in bits.h. 2989 For more information on KUnit and unit tests in general please refer 2990 to the KUnit documentation in Documentation/dev-tools/kunit/. 2991 2992 If unsure, say N. 2993 2994config SHDI3_KUNIT_TEST 2995 tristate "KUnit test for __ashldi3(), __ashrdi3(), and __lshrdi3()" 2996 depends on KUNIT 2997 depends on ARM || XTENSA || MICROBLAZE || ((RISCV || SPARC) && !64BIT) 2998 help 2999 This builds the unit test for __ashldi3(), __ashrdi3(), and 3000 __lshrdi3() helper functions used to implement 64-bit arithmetic 3001 shift left, arithmetic shift right and logical shift right, 3002 respectively, on a 32-bit CPUs. 3003 3004config SLUB_KUNIT_TEST 3005 tristate "KUnit test for SLUB cache error detection" if !KUNIT_ALL_TESTS 3006 depends on SLUB_DEBUG && KUNIT 3007 default KUNIT_ALL_TESTS 3008 help 3009 This builds SLUB allocator unit test. 3010 Tests SLUB cache debugging functionality. 3011 For more information on KUnit and unit tests in general please refer 3012 to the KUnit documentation in Documentation/dev-tools/kunit/. 3013 3014 If unsure, say N. 3015 3016config RATIONAL_KUNIT_TEST 3017 tristate "KUnit test for rational.c" if !KUNIT_ALL_TESTS 3018 depends on KUNIT && RATIONAL 3019 default KUNIT_ALL_TESTS 3020 help 3021 This builds the rational math unit test. 3022 For more information on KUnit and unit tests in general please refer 3023 to the KUnit documentation in Documentation/dev-tools/kunit/. 3024 3025 If unsure, say N. 3026 3027config MEMCPY_KUNIT_TEST 3028 tristate "Test memcpy(), memmove(), and memset() functions at runtime" if !KUNIT_ALL_TESTS 3029 depends on KUNIT 3030 default KUNIT_ALL_TESTS 3031 help 3032 Builds unit tests for memcpy(), memmove(), and memset() functions. 3033 For more information on KUnit and unit tests in general please refer 3034 to the KUnit documentation in Documentation/dev-tools/kunit/. 3035 3036 If unsure, say N. 3037 3038config MIN_HEAP_KUNIT_TEST 3039 tristate "Min heap test" if !KUNIT_ALL_TESTS 3040 depends on KUNIT 3041 default KUNIT_ALL_TESTS 3042 help 3043 This option enables the KUnit test suite for the min heap library 3044 which provides functions for creating and managing min heaps. 3045 The test suite checks the functionality of the min heap library. 3046 3047 If unsure, say N 3048 3049config IS_SIGNED_TYPE_KUNIT_TEST 3050 tristate "Test is_signed_type() macro" if !KUNIT_ALL_TESTS 3051 depends on KUNIT 3052 default KUNIT_ALL_TESTS 3053 help 3054 Builds unit tests for the is_signed_type() macro. 3055 3056 For more information on KUnit and unit tests in general please refer 3057 to the KUnit documentation in Documentation/dev-tools/kunit/. 3058 3059 If unsure, say N. 3060 3061config OVERFLOW_KUNIT_TEST 3062 tristate "Test check_*_overflow() functions at runtime" if !KUNIT_ALL_TESTS 3063 depends on KUNIT 3064 default KUNIT_ALL_TESTS 3065 help 3066 Builds unit tests for the check_*_overflow(), size_*(), allocation, and 3067 related functions. 3068 3069 For more information on KUnit and unit tests in general please refer 3070 to the KUnit documentation in Documentation/dev-tools/kunit/. 3071 3072 If unsure, say N. 3073 3074config RANDSTRUCT_KUNIT_TEST 3075 tristate "Test randstruct structure layout randomization at runtime" if !KUNIT_ALL_TESTS 3076 depends on KUNIT 3077 default KUNIT_ALL_TESTS 3078 help 3079 Builds unit tests for the checking CONFIG_RANDSTRUCT=y, which 3080 randomizes structure layouts. 3081 3082config STACKINIT_KUNIT_TEST 3083 tristate "Test level of stack variable initialization" if !KUNIT_ALL_TESTS 3084 depends on KUNIT 3085 default KUNIT_ALL_TESTS 3086 help 3087 Test if the kernel is zero-initializing stack variables and 3088 padding. Coverage is controlled by compiler flags, 3089 CONFIG_INIT_STACK_ALL_PATTERN or CONFIG_INIT_STACK_ALL_ZERO. 3090 3091config FORTIFY_KUNIT_TEST 3092 tristate "Test fortified str*() and mem*() function internals at runtime" if !KUNIT_ALL_TESTS 3093 depends on KUNIT 3094 default KUNIT_ALL_TESTS 3095 help 3096 Builds unit tests for checking internals of FORTIFY_SOURCE as used 3097 by the str*() and mem*() family of functions. For testing runtime 3098 traps of FORTIFY_SOURCE, see LKDTM's "FORTIFY_*" tests. 3099 3100config LONGEST_SYM_KUNIT_TEST 3101 tristate "Test the longest symbol possible" if !KUNIT_ALL_TESTS 3102 depends on KUNIT && KPROBES 3103 depends on !CALL_PADDING && !CFI && !GCOV_KERNEL 3104 default KUNIT_ALL_TESTS 3105 help 3106 Tests the longest symbol possible 3107 3108 If unsure, say N. 3109 3110config HW_BREAKPOINT_KUNIT_TEST 3111 bool "Test hw_breakpoint constraints accounting" if !KUNIT_ALL_TESTS 3112 depends on HAVE_HW_BREAKPOINT 3113 depends on KUNIT=y 3114 default KUNIT_ALL_TESTS 3115 help 3116 Tests for hw_breakpoint constraints accounting. 3117 3118 If unsure, say N. 3119 3120source "lib/crypto/tests/Kconfig" 3121 3122config USERCOPY_KUNIT_TEST 3123 tristate "KUnit Test for user/kernel boundary protections" 3124 depends on KUNIT 3125 default KUNIT_ALL_TESTS 3126 help 3127 This builds the "usercopy_kunit" module that runs sanity checks 3128 on the copy_to/from_user infrastructure, making sure basic 3129 user/kernel boundary testing is working. 3130 3131config BLACKHOLE_DEV_KUNIT_TEST 3132 tristate "Test blackhole netdev functionality" if !KUNIT_ALL_TESTS 3133 depends on NET 3134 depends on KUNIT 3135 default KUNIT_ALL_TESTS 3136 help 3137 This builds the "blackhole_dev_kunit" module that validates the 3138 data path through this blackhole netdev. 3139 3140 If unsure, say N. 3141 3142config TEST_UDELAY 3143 tristate "udelay test driver" 3144 help 3145 This builds the "udelay_test" module that helps to make sure 3146 that udelay() is working properly. 3147 3148 If unsure, say N. 3149 3150config TEST_STATIC_KEYS 3151 tristate "Test static keys" 3152 depends on m 3153 help 3154 Test the static key interfaces. 3155 3156 If unsure, say N. 3157 3158config TEST_DYNAMIC_DEBUG 3159 tristate "Test DYNAMIC_DEBUG" 3160 depends on DYNAMIC_DEBUG 3161 help 3162 This module registers a tracer callback to count enabled 3163 pr_debugs in a 'do_debugging' function, then alters their 3164 enablements, calls the function, and compares counts. 3165 3166 If unsure, say N. 3167 3168config TEST_KMOD 3169 tristate "kmod stress tester" 3170 depends on m 3171 select TEST_LKM 3172 help 3173 Test the kernel's module loading mechanism: kmod. kmod implements 3174 support to load modules using the Linux kernel's usermode helper. 3175 This test provides a series of tests against kmod. 3176 3177 Although technically you can either build test_kmod as a module or 3178 into the kernel we disallow building it into the kernel since 3179 it stress tests request_module() and this will very likely cause 3180 some issues by taking over precious threads available from other 3181 module load requests, ultimately this could be fatal. 3182 3183 To run tests run: 3184 3185 tools/testing/selftests/kmod/kmod.sh --help 3186 3187 If unsure, say N. 3188 3189config TEST_RUNTIME 3190 bool 3191 3192config TEST_RUNTIME_MODULE 3193 bool 3194 3195config TEST_KALLSYMS 3196 tristate "module kallsyms find_symbol() test" 3197 depends on m 3198 select TEST_RUNTIME 3199 select TEST_RUNTIME_MODULE 3200 select TEST_KALLSYMS_A 3201 select TEST_KALLSYMS_B 3202 select TEST_KALLSYMS_C 3203 select TEST_KALLSYMS_D 3204 help 3205 This allows us to stress test find_symbol() through the kallsyms 3206 used to place symbols on the kernel ELF kallsyms and modules kallsyms 3207 where we place kernel symbols such as exported symbols. 3208 3209 We have four test modules: 3210 3211 A: has KALLSYSMS_NUMSYMS exported symbols 3212 B: uses one of A's symbols 3213 C: adds KALLSYMS_SCALE_FACTOR * KALLSYSMS_NUMSYMS exported 3214 D: adds 2 * the symbols than C 3215 3216 We stress test find_symbol() through two means: 3217 3218 1) Upon load of B it will trigger simplify_symbols() to look for the 3219 one symbol it uses from the module A with tons of symbols. This is an 3220 indirect way for us to have B call resolve_symbol_wait() upon module 3221 load. This will eventually call find_symbol() which will eventually 3222 try to find the symbols used with find_exported_symbol_in_section(). 3223 find_exported_symbol_in_section() uses bsearch() so a binary search 3224 for each symbol. Binary search will at worst be O(log(n)) so the 3225 larger TEST_MODULE_KALLSYSMS the worse the search. 3226 3227 2) The selftests should load C first, before B. Upon B's load towards 3228 the end right before we call module B's init routine we get 3229 complete_formation() called on the module. That will first check 3230 for duplicate symbols with the call to verify_exported_symbols(). 3231 That is when we'll force iteration on module C's insane symbol list. 3232 Since it has 10 * KALLSYMS_NUMSYMS it means we can first test 3233 just loading B without C. The amount of time it takes to load C Vs 3234 B can give us an idea of the impact growth of the symbol space and 3235 give us projection. Module A only uses one symbol from B so to allow 3236 this scaling in module C to be proportional, if it used more symbols 3237 then the first test would be doing more and increasing just the 3238 search space would be slightly different. The last module, module D 3239 will just increase the search space by twice the number of symbols in 3240 C so to allow for full projects. 3241 3242 tools/testing/selftests/module/find_symbol.sh 3243 3244 The current defaults will incur a build delay of about 7 minutes 3245 on an x86_64 with only 8 cores. Enable this only if you want to 3246 stress test find_symbol() with thousands of symbols. At the same 3247 time this is also useful to test building modules with thousands of 3248 symbols, and if BTF is enabled this also stress tests adding BTF 3249 information for each module. Currently enabling many more symbols 3250 will segfault the build system. 3251 3252 If unsure, say N. 3253 3254if TEST_KALLSYMS 3255 3256config TEST_KALLSYMS_A 3257 tristate 3258 depends on m 3259 3260config TEST_KALLSYMS_B 3261 tristate 3262 depends on m 3263 3264config TEST_KALLSYMS_C 3265 tristate 3266 depends on m 3267 3268config TEST_KALLSYMS_D 3269 tristate 3270 depends on m 3271 3272choice 3273 prompt "Kallsym test range" 3274 default TEST_KALLSYMS_LARGE 3275 help 3276 Selecting something other than "Fast" will enable tests which slow 3277 down the build and may crash your build. 3278 3279config TEST_KALLSYMS_FAST 3280 bool "Fast builds" 3281 help 3282 You won't really be testing kallsysms, so this just helps fast builds 3283 when allmodconfig is used.. 3284 3285config TEST_KALLSYMS_LARGE 3286 bool "Enable testing kallsyms with large exports" 3287 help 3288 This will enable larger number of symbols. This will slow down 3289 your build considerably. 3290 3291config TEST_KALLSYMS_MAX 3292 bool "Known kallsysms limits" 3293 help 3294 This will enable exports to the point we know we'll start crashing 3295 builds. 3296 3297endchoice 3298 3299config TEST_KALLSYMS_NUMSYMS 3300 int "test kallsyms number of symbols" 3301 range 2 10000 3302 default 2 if TEST_KALLSYMS_FAST 3303 default 100 if TEST_KALLSYMS_LARGE 3304 default 10000 if TEST_KALLSYMS_MAX 3305 help 3306 The number of symbols to create on TEST_KALLSYMS_A, only one of which 3307 module TEST_KALLSYMS_B will use. This also will be used 3308 for how many symbols TEST_KALLSYMS_C will have, scaled up by 3309 TEST_KALLSYMS_SCALE_FACTOR. Note that setting this to 10,000 will 3310 trigger a segfault today, don't use anything close to it unless 3311 you are aware that this should not be used for automated build tests. 3312 3313config TEST_KALLSYMS_SCALE_FACTOR 3314 int "test kallsyms scale factor" 3315 default 8 3316 help 3317 How many more unusued symbols will TEST_KALLSYSMS_C have than 3318 TEST_KALLSYMS_A. If 8, then module C will have 8 * syms 3319 than module A. Then TEST_KALLSYMS_D will have double the amount 3320 of symbols than C so to allow projections. 3321 3322endif # TEST_KALLSYMS 3323 3324config TEST_DEBUG_VIRTUAL 3325 tristate "Test CONFIG_DEBUG_VIRTUAL feature" 3326 depends on DEBUG_VIRTUAL 3327 help 3328 Test the kernel's ability to detect incorrect calls to 3329 virt_to_phys() done against the non-linear part of the 3330 kernel's virtual address map. 3331 3332 If unsure, say N. 3333 3334config TEST_MEMCAT_P 3335 tristate "Test memcat_p() helper function" 3336 help 3337 Test the memcat_p() helper for correctly merging two 3338 pointer arrays together. 3339 3340 If unsure, say N. 3341 3342config TEST_OBJAGG 3343 tristate "Perform selftest on object aggreration manager" 3344 default n 3345 depends on OBJAGG 3346 help 3347 Enable this option to test object aggregation manager on boot 3348 (or module load). 3349 3350config TEST_MEMINIT 3351 tristate "Test heap/page initialization" 3352 help 3353 Test if the kernel is zero-initializing heap and page allocations. 3354 This can be useful to test init_on_alloc and init_on_free features. 3355 3356 If unsure, say N. 3357 3358config TEST_HMM 3359 tristate "Test HMM (Heterogeneous Memory Management)" 3360 depends on TRANSPARENT_HUGEPAGE 3361 depends on DEVICE_PRIVATE 3362 select HMM_MIRROR 3363 select MMU_NOTIFIER 3364 help 3365 This is a pseudo device driver solely for testing HMM. 3366 Say M here if you want to build the HMM test module. 3367 Doing so will allow you to run tools/testing/selftest/vm/hmm-tests. 3368 3369 If unsure, say N. 3370 3371config TEST_FREE_PAGES 3372 tristate "Test freeing pages" 3373 help 3374 Test that a memory leak does not occur due to a race between 3375 freeing a block of pages and a speculative page reference. 3376 Loading this module is safe if your kernel has the bug fixed. 3377 If the bug is not fixed, it will leak gigabytes of memory and 3378 probably OOM your system. 3379 3380config TEST_FPU 3381 tristate "Test floating point operations in kernel space" 3382 depends on ARCH_HAS_KERNEL_FPU_SUPPORT && !KCOV_INSTRUMENT_ALL 3383 help 3384 Enable this option to add /sys/kernel/debug/selftest_helpers/test_fpu 3385 which will trigger a sequence of floating point operations. This is used 3386 for self-testing floating point control register setting in 3387 kernel_fpu_begin(). 3388 3389 If unsure, say N. 3390 3391config TEST_CLOCKSOURCE_WATCHDOG 3392 tristate "Test clocksource watchdog in kernel space" 3393 depends on CLOCKSOURCE_WATCHDOG 3394 help 3395 Enable this option to create a kernel module that will trigger 3396 a test of the clocksource watchdog. This module may be loaded 3397 via modprobe or insmod in which case it will run upon being 3398 loaded, or it may be built in, in which case it will run 3399 shortly after boot. 3400 3401 If unsure, say N. 3402 3403config TEST_OBJPOOL 3404 tristate "Test module for correctness and stress of objpool" 3405 default n 3406 depends on m && DEBUG_KERNEL 3407 help 3408 This builds the "test_objpool" module that should be used for 3409 correctness verification and concurrent testings of objects 3410 allocation and reclamation. 3411 3412 If unsure, say N. 3413 3414config TEST_KEXEC_HANDOVER 3415 bool "Test for Kexec HandOver" 3416 default n 3417 depends on KEXEC_HANDOVER 3418 help 3419 This option enables test for Kexec HandOver (KHO). 3420 The test consists of two parts: saving kernel data before kexec and 3421 restoring the data after kexec and verifying that it was properly 3422 handed over. This test module creates and saves data on the boot of 3423 the first kernel and restores and verifies the data on the boot of 3424 kexec'ed kernel. 3425 3426 For detailed documentation about KHO, see Documentation/core-api/kho. 3427 3428 To run the test run: 3429 3430 tools/testing/selftests/kho/vmtest.sh -h 3431 3432 If unsure, say N. 3433 3434config RATELIMIT_KUNIT_TEST 3435 tristate "KUnit Test for correctness and stress of ratelimit" if !KUNIT_ALL_TESTS 3436 depends on KUNIT 3437 default KUNIT_ALL_TESTS 3438 help 3439 This builds the "test_ratelimit" module that should be used 3440 for correctness verification and concurrent testings of rate 3441 limiting. 3442 3443 If unsure, say N. 3444 3445config UUID_KUNIT_TEST 3446 tristate "KUnit test for UUID" if !KUNIT_ALL_TESTS 3447 depends on KUNIT 3448 default KUNIT_ALL_TESTS 3449 help 3450 This option enables the KUnit test suite for the uuid library, 3451 which provides functions for generating and parsing UUID and GUID. 3452 The test suite checks parsing of UUID and GUID strings. 3453 3454 If unsure, say N. 3455 3456config INT_POW_KUNIT_TEST 3457 tristate "Integer exponentiation (int_pow) test" if !KUNIT_ALL_TESTS 3458 depends on KUNIT 3459 default KUNIT_ALL_TESTS 3460 help 3461 This option enables the KUnit test suite for the int_pow function, 3462 which performs integer exponentiation. The test suite is designed to 3463 verify that the implementation of int_pow correctly computes the power 3464 of a given base raised to a given exponent. 3465 3466 Enabling this option will include tests that check various scenarios 3467 and edge cases to ensure the accuracy and reliability of the exponentiation 3468 function. 3469 3470 If unsure, say N 3471 3472config INT_SQRT_KUNIT_TEST 3473 tristate "Integer square root test" if !KUNIT_ALL_TESTS 3474 depends on KUNIT 3475 default KUNIT_ALL_TESTS 3476 help 3477 This option enables the KUnit test suite for the int_sqrt() function, 3478 which performs square root calculation. The test suite checks 3479 various scenarios, including edge cases, to ensure correctness. 3480 3481 Enabling this option will include tests that check various scenarios 3482 and edge cases to ensure the accuracy and reliability of the square root 3483 function. 3484 3485 If unsure, say N 3486 3487config INT_LOG_KUNIT_TEST 3488 tristate "Integer log (int_log) test" if !KUNIT_ALL_TESTS 3489 depends on KUNIT 3490 default KUNIT_ALL_TESTS 3491 help 3492 This option enables the KUnit test suite for the int_log library, which 3493 provides two functions to compute the integer logarithm in base 2 and 3494 base 10, called respectively as intlog2 and intlog10. 3495 3496 If unsure, say N 3497 3498config GCD_KUNIT_TEST 3499 tristate "Greatest common divisor test" if !KUNIT_ALL_TESTS 3500 depends on KUNIT 3501 default KUNIT_ALL_TESTS 3502 help 3503 This option enables the KUnit test suite for the gcd() function, 3504 which computes the greatest common divisor of two numbers. 3505 3506 This test suite verifies the correctness of gcd() across various 3507 scenarios, including edge cases. 3508 3509 If unsure, say N 3510 3511config POLYNOMIAL_KUNIT_TEST 3512 tristate "Polynomial calculation (polynomial_calc) test" if !KUNIT_ALL_TESTS 3513 depends on KUNIT 3514 select POLYNOMIAL 3515 default KUNIT_ALL_TESTS 3516 help 3517 This option enables the KUnit test suite for the polynomial_calc() 3518 function, which evaluates integer polynomials using factor 3519 redistribution to avoid overflow. 3520 3521 The test suite verifies correctness for constant, linear, and 3522 quadratic polynomials, negative coefficients, per-step dividers, 3523 divider_leftover, total_divider scaling, and a real sensor 3524 N-to-temperature conversion polynomial. 3525 3526 If unsure, say N 3527 3528config PRIME_NUMBERS_KUNIT_TEST 3529 tristate "Prime number generator test" if !KUNIT_ALL_TESTS 3530 depends on KUNIT 3531 depends on PRIME_NUMBERS 3532 default KUNIT_ALL_TESTS 3533 help 3534 This option enables the KUnit test suite for the {is,next}_prime_number 3535 functions. 3536 3537 Enabling this option will include tests that compare the prime number 3538 generator functions against a brute force implementation. 3539 3540 If unsure, say N 3541 3542config GLOB_KUNIT_TEST 3543 tristate "Glob matching test" if !KUNIT_ALL_TESTS 3544 depends on GLOB 3545 depends on KUNIT 3546 default KUNIT_ALL_TESTS 3547 help 3548 Enable this option to test the glob functions at runtime. 3549 3550 This test suite verifies the correctness of glob_match() across various 3551 scenarios, including edge cases. 3552 3553 If unsure, say N 3554 3555config PRANDOM_KUNIT_TEST 3556 tristate "KUnit test for prandom" if !KUNIT_ALL_TESTS 3557 depends on KUNIT 3558 default KUNIT_ALL_TESTS 3559 help 3560 Enable this option to test the prandom functions at runtime. 3561 3562 If unsure, say N 3563 3564endif # RUNTIME_TESTING_MENU 3565 3566config ARCH_USE_MEMTEST 3567 bool 3568 help 3569 An architecture should select this when it uses early_memtest() 3570 during boot process. 3571 3572config MEMTEST 3573 bool "Memtest" 3574 depends on ARCH_USE_MEMTEST 3575 help 3576 This option adds a kernel parameter 'memtest', which allows memtest 3577 to be set and executed. 3578 memtest=0, mean disabled; -- default 3579 memtest=1, mean do 1 test pattern; 3580 ... 3581 memtest=17, mean do 17 test patterns. 3582 If you are unsure how to answer this question, answer N. 3583 3584 3585 3586config HYPERV_TESTING 3587 bool "Microsoft Hyper-V driver testing" 3588 default n 3589 depends on HYPERV && DEBUG_FS 3590 help 3591 Select this option to enable Hyper-V vmbus testing. 3592 3593endmenu # "Kernel Testing and Coverage" 3594 3595menu "Rust hacking" 3596 3597config RUST_DEBUG_ASSERTIONS 3598 bool "Debug assertions" 3599 depends on RUST 3600 help 3601 Enables rustc's `-Cdebug-assertions` codegen option. 3602 3603 This flag lets you turn `cfg(debug_assertions)` conditional 3604 compilation on or off. This can be used to enable extra debugging 3605 code in development but not in production. For example, it controls 3606 the behavior of the standard library's `debug_assert!` macro. 3607 3608 Note that this will apply to all Rust code, including `core`. 3609 3610 If unsure, say N. 3611 3612config RUST_OVERFLOW_CHECKS 3613 bool "Overflow checks" 3614 default y 3615 depends on RUST 3616 help 3617 Enables rustc's `-Coverflow-checks` codegen option. 3618 3619 This flag allows you to control the behavior of runtime integer 3620 overflow. When overflow-checks are enabled, a Rust panic will occur 3621 on overflow. 3622 3623 Note that this will apply to all Rust code, including `core`. 3624 3625 If unsure, say Y. 3626 3627config RUST_BUILD_ASSERT_ALLOW 3628 bool "Allow unoptimized build-time assertions" 3629 depends on RUST 3630 help 3631 Controls how `build_error!` and `build_assert!` are handled during the build. 3632 3633 If calls to them exist in the binary, it may indicate a violated invariant 3634 or that the optimizer failed to verify the invariant during compilation. 3635 3636 This should not happen, thus by default the build is aborted. However, 3637 as an escape hatch, you can choose Y here to ignore them during build 3638 and let the check be carried at runtime (with `panic!` being called if 3639 the check fails). 3640 3641 If unsure, say N. 3642 3643config RUST_KERNEL_DOCTESTS 3644 bool "Doctests for the `kernel` crate" if !KUNIT_ALL_TESTS 3645 depends on RUST && KUNIT=y 3646 default KUNIT_ALL_TESTS 3647 help 3648 This builds the documentation tests of the `kernel` crate 3649 as KUnit tests. 3650 3651 For more information on KUnit and unit tests in general, 3652 please refer to the KUnit documentation in Documentation/dev-tools/kunit/. 3653 3654 If unsure, say N. 3655 3656config RUST_INLINE_HELPERS 3657 bool "Inline C helpers into Rust code (EXPERIMENTAL)" 3658 depends on RUST && RUSTC_CLANG_LLVM_COMPATIBLE 3659 depends on EXPERT 3660 depends on ARM64 || X86_64 3661 depends on !UML 3662 help 3663 Inlines C helpers into Rust code using Link Time Optimization. 3664 3665 If this option is enabled, C helper functions declared in 3666 rust/helpers/ are inlined into Rust code, which is helpful for 3667 performance of Rust code. This requires a matching LLVM version for 3668 Clang and rustc. 3669 3670 If you are sure that you're using Clang and rustc with matching LLVM 3671 versions, say Y. Otherwise say N. 3672 3673endmenu # "Rust" 3674 3675endmenu # Kernel hacking 3676