diff options
author | Vegard Nossum <vegard.nossum@oracle.com> | 2016-08-02 17:07:30 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-08-02 19:35:43 -0400 |
commit | a4691deabf284a601149a067525759939cc563b2 (patch) | |
tree | 40524fe55bd55def7831a68e6a3d775b4a1ea3fd /lib | |
parent | f1cb637e75b59a07450cf81ad68b04f3f46b03d7 (diff) |
kcov: allow more fine-grained coverage instrumentation
For more targeted fuzzing, it's better to disable kernel-wide
instrumentation and instead enable it on a per-subsystem basis. This
follows the pattern of UBSAN and allows you to compile in the kcov
driver without instrumenting the whole kernel.
To instrument a part of the kernel, you can use either
# for a single file in the current directory
KCOV_INSTRUMENT_filename.o := y
or
# for all the files in the current directory (excluding subdirectories)
KCOV_INSTRUMENT := y
or
# (same as above)
ccflags-y += $(CFLAGS_KCOV)
or
# for all the files in the current directory (including subdirectories)
subdir-ccflags-y += $(CFLAGS_KCOV)
Link: http://lkml.kernel.org/r/1464008380-11405-1-git-send-email-vegard.nossum@oracle.com
Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Quentin Casasnovas <quentin.casasnovas@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Kconfig.debug | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index f07842e2d69f..cc02f282d05b 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug | |||
@@ -719,6 +719,17 @@ config KCOV | |||
719 | 719 | ||
720 | For more details, see Documentation/kcov.txt. | 720 | For more details, see Documentation/kcov.txt. |
721 | 721 | ||
722 | config KCOV_INSTRUMENT_ALL | ||
723 | bool "Instrument all code by default" | ||
724 | depends on KCOV | ||
725 | default y if KCOV | ||
726 | help | ||
727 | If you are doing generic system call fuzzing (like e.g. syzkaller), | ||
728 | then you will want to instrument the whole kernel and you should | ||
729 | say y here. If you are doing more targeted fuzzing (like e.g. | ||
730 | filesystem fuzzing with AFL) then you will want to enable coverage | ||
731 | for more specific subsets of files, and should say n here. | ||
732 | |||
722 | config DEBUG_SHIRQ | 733 | config DEBUG_SHIRQ |
723 | bool "Debug shared IRQ handlers" | 734 | bool "Debug shared IRQ handlers" |
724 | depends on DEBUG_KERNEL | 735 | depends on DEBUG_KERNEL |