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