Skip to content

Commit 09a7495

Browse files
changbindutorvalds
authored andcommitted
kernel-hacking: move kernel testing and coverage options to same submenu
Move error injection, coverage, testing options to a new top level submenu 'Kernel Testing and Coverage'. They are all for test purpose. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Changbin Du <[email protected]> Acked-by: Randy Dunlap <[email protected]> Tested-by: Randy Dunlap <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 3be5cbc commit 09a7495

File tree

1 file changed

+89
-84
lines changed

1 file changed

+89
-84
lines changed

lib/Kconfig.debug

Lines changed: 89 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -764,53 +764,6 @@ source "lib/Kconfig.kasan"
764764

765765
endmenu # "Memory Debugging"
766766

767-
config ARCH_HAS_KCOV
768-
bool
769-
help
770-
An architecture should select this when it can successfully
771-
build and run with CONFIG_KCOV. This typically requires
772-
disabling instrumentation for some early boot code.
773-
774-
config CC_HAS_SANCOV_TRACE_PC
775-
def_bool $(cc-option,-fsanitize-coverage=trace-pc)
776-
777-
config KCOV
778-
bool "Code coverage for fuzzing"
779-
depends on ARCH_HAS_KCOV
780-
depends on CC_HAS_SANCOV_TRACE_PC || GCC_PLUGINS
781-
select DEBUG_FS
782-
select GCC_PLUGIN_SANCOV if !CC_HAS_SANCOV_TRACE_PC
783-
help
784-
KCOV exposes kernel code coverage information in a form suitable
785-
for coverage-guided fuzzing (randomized testing).
786-
787-
If RANDOMIZE_BASE is enabled, PC values will not be stable across
788-
different machines and across reboots. If you need stable PC values,
789-
disable RANDOMIZE_BASE.
790-
791-
For more details, see Documentation/dev-tools/kcov.rst.
792-
793-
config KCOV_ENABLE_COMPARISONS
794-
bool "Enable comparison operands collection by KCOV"
795-
depends on KCOV
796-
depends on $(cc-option,-fsanitize-coverage=trace-cmp)
797-
help
798-
KCOV also exposes operands of every comparison in the instrumented
799-
code along with operand sizes and PCs of the comparison instructions.
800-
These operands can be used by fuzzing engines to improve the quality
801-
of fuzzing coverage.
802-
803-
config KCOV_INSTRUMENT_ALL
804-
bool "Instrument all code by default"
805-
depends on KCOV
806-
default y
807-
help
808-
If you are doing generic system call fuzzing (like e.g. syzkaller),
809-
then you will want to instrument the whole kernel and you should
810-
say y here. If you are doing more targeted fuzzing (like e.g.
811-
filesystem fuzzing with AFL) then you will want to enable coverage
812-
for more specific subsets of files, and should say n here.
813-
814767
config DEBUG_SHIRQ
815768
bool "Debug shared IRQ handlers"
816769
depends on DEBUG_KERNEL
@@ -1480,6 +1433,54 @@ config CPU_HOTPLUG_STATE_CONTROL
14801433

14811434
Say N if your are unsure.
14821435

1436+
config LATENCYTOP
1437+
bool "Latency measuring infrastructure"
1438+
depends on DEBUG_KERNEL
1439+
depends on STACKTRACE_SUPPORT
1440+
depends on PROC_FS
1441+
select FRAME_POINTER if !MIPS && !PPC && !S390 && !MICROBLAZE && !ARM && !ARC && !X86
1442+
select KALLSYMS
1443+
select KALLSYMS_ALL
1444+
select STACKTRACE
1445+
select SCHEDSTATS
1446+
select SCHED_DEBUG
1447+
help
1448+
Enable this option if you want to use the LatencyTOP tool
1449+
to find out which userspace is blocking on what kernel operations.
1450+
1451+
source "kernel/trace/Kconfig"
1452+
1453+
config PROVIDE_OHCI1394_DMA_INIT
1454+
bool "Remote debugging over FireWire early on boot"
1455+
depends on PCI && X86
1456+
help
1457+
If you want to debug problems which hang or crash the kernel early
1458+
on boot and the crashing machine has a FireWire port, you can use
1459+
this feature to remotely access the memory of the crashed machine
1460+
over FireWire. This employs remote DMA as part of the OHCI1394
1461+
specification which is now the standard for FireWire controllers.
1462+
1463+
With remote DMA, you can monitor the printk buffer remotely using
1464+
firescope and access all memory below 4GB using fireproxy from gdb.
1465+
Even controlling a kernel debugger is possible using remote DMA.
1466+
1467+
Usage:
1468+
1469+
If ohci1394_dma=early is used as boot parameter, it will initialize
1470+
all OHCI1394 controllers which are found in the PCI config space.
1471+
1472+
As all changes to the FireWire bus such as enabling and disabling
1473+
devices cause a bus reset and thereby disable remote DMA for all
1474+
devices, be sure to have the cable plugged and FireWire enabled on
1475+
the debugging host before booting the debug target for debugging.
1476+
1477+
This code (~1k) is freed after boot. By then, the firewire stack
1478+
in charge of the OHCI-1394 controllers should be used instead.
1479+
1480+
See Documentation/debugging-via-ohci1394.txt for more information.
1481+
1482+
source "lib/kunit/Kconfig"
1483+
14831484
config NOTIFIER_ERROR_INJECTION
14841485
tristate "Notifier error injection"
14851486
depends on DEBUG_KERNEL
@@ -1638,53 +1639,57 @@ config FAULT_INJECTION_STACKTRACE_FILTER
16381639
help
16391640
Provide stacktrace filter for fault-injection capabilities
16401641

1641-
config LATENCYTOP
1642-
bool "Latency measuring infrastructure"
1643-
depends on DEBUG_KERNEL
1644-
depends on STACKTRACE_SUPPORT
1645-
depends on PROC_FS
1646-
select FRAME_POINTER if !MIPS && !PPC && !S390 && !MICROBLAZE && !ARM && !ARC && !X86
1647-
select KALLSYMS
1648-
select KALLSYMS_ALL
1649-
select STACKTRACE
1650-
select SCHEDSTATS
1651-
select SCHED_DEBUG
1652-
help
1653-
Enable this option if you want to use the LatencyTOP tool
1654-
to find out which userspace is blocking on what kernel operations.
1642+
endmenu # "Kernel Testing and Coverage"
16551643

1656-
source "kernel/trace/Kconfig"
1644+
menu "Kernel Testing and Coverage"
16571645

1658-
config PROVIDE_OHCI1394_DMA_INIT
1659-
bool "Remote debugging over FireWire early on boot"
1660-
depends on PCI && X86
1646+
config ARCH_HAS_KCOV
1647+
bool
16611648
help
1662-
If you want to debug problems which hang or crash the kernel early
1663-
on boot and the crashing machine has a FireWire port, you can use
1664-
this feature to remotely access the memory of the crashed machine
1665-
over FireWire. This employs remote DMA as part of the OHCI1394
1666-
specification which is now the standard for FireWire controllers.
1649+
An architecture should select this when it can successfully
1650+
build and run with CONFIG_KCOV. This typically requires
1651+
disabling instrumentation for some early boot code.
16671652

1668-
With remote DMA, you can monitor the printk buffer remotely using
1669-
firescope and access all memory below 4GB using fireproxy from gdb.
1670-
Even controlling a kernel debugger is possible using remote DMA.
1653+
config CC_HAS_SANCOV_TRACE_PC
1654+
def_bool $(cc-option,-fsanitize-coverage=trace-pc)
16711655

1672-
Usage:
16731656

1674-
If ohci1394_dma=early is used as boot parameter, it will initialize
1675-
all OHCI1394 controllers which are found in the PCI config space.
1657+
config KCOV
1658+
bool "Code coverage for fuzzing"
1659+
depends on ARCH_HAS_KCOV
1660+
depends on CC_HAS_SANCOV_TRACE_PC || GCC_PLUGINS
1661+
select DEBUG_FS
1662+
select GCC_PLUGIN_SANCOV if !CC_HAS_SANCOV_TRACE_PC
1663+
help
1664+
KCOV exposes kernel code coverage information in a form suitable
1665+
for coverage-guided fuzzing (randomized testing).
16761666

1677-
As all changes to the FireWire bus such as enabling and disabling
1678-
devices cause a bus reset and thereby disable remote DMA for all
1679-
devices, be sure to have the cable plugged and FireWire enabled on
1680-
the debugging host before booting the debug target for debugging.
1667+
If RANDOMIZE_BASE is enabled, PC values will not be stable across
1668+
different machines and across reboots. If you need stable PC values,
1669+
disable RANDOMIZE_BASE.
16811670

1682-
This code (~1k) is freed after boot. By then, the firewire stack
1683-
in charge of the OHCI-1394 controllers should be used instead.
1671+
For more details, see Documentation/dev-tools/kcov.rst.
16841672

1685-
See Documentation/debugging-via-ohci1394.txt for more information.
1673+
config KCOV_ENABLE_COMPARISONS
1674+
bool "Enable comparison operands collection by KCOV"
1675+
depends on KCOV
1676+
depends on $(cc-option,-fsanitize-coverage=trace-cmp)
1677+
help
1678+
KCOV also exposes operands of every comparison in the instrumented
1679+
code along with operand sizes and PCs of the comparison instructions.
1680+
These operands can be used by fuzzing engines to improve the quality
1681+
of fuzzing coverage.
16861682

1687-
source "lib/kunit/Kconfig"
1683+
config KCOV_INSTRUMENT_ALL
1684+
bool "Instrument all code by default"
1685+
depends on KCOV
1686+
default y
1687+
help
1688+
If you are doing generic system call fuzzing (like e.g. syzkaller),
1689+
then you will want to instrument the whole kernel and you should
1690+
say y here. If you are doing more targeted fuzzing (like e.g.
1691+
filesystem fuzzing with AFL) then you will want to enable coverage
1692+
for more specific subsets of files, and should say n here.
16881693

16891694
menuconfig RUNTIME_TESTING_MENU
16901695
bool "Runtime Testing"

0 commit comments

Comments
 (0)