x86/kernel: Increase kcov coverage under arch/x86/kernel folder
PATCH 1/1 x86/kernel: Increase kcov coverage under arch/x86/kernel folder
In reply to a message not in the archiveCurrently kcov instrument is disabled for object files under arch/x86/kernel folder.
For object files under arch/x86/kernel, actually just disabling the kcov instrument of files:"head32.o or head64.o and sev.o" could achieve successful booting and provide kcov coverage for object files that do not disable kcov instrument.
The additional kcov coverage collected from arch/x86/kernel folder helps kernel fuzzing efforts to find bugs.
Link to related improvement discussion is below:
https://groups.google.com/g/syzkaller/c/Dsl-RYGCqs8/m/x-tfpTyFBAAJ
Related ticket is as follow:
https://bugzilla.kernel.org/show_bug.cgi?id=198443
--- arch/x86/kernel/Makefile | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
arch/x86/kernel/Makefile +4 -5
@@ -33,11 +33,10 @@ KCSAN_SANITIZE := n KMSAN_SANITIZE_head$(BITS).o := n KMSAN_SANITIZE_nmi.o := n -# If instrumentation of this dir is enabled, boot hangs during first second. -# Probably could be more selective here, but note that files related to irqs, -# boot, dumpstack/stacktrace, etc are either non-interesting or can lead to -# non-deterministic coverage. -KCOV_INSTRUMENT := n +# If instrumentation of the following files is enabled, boot hangs during +# first second. +KCOV_INSTRUMENT_head$(BITS).o := n +KCOV_INSTRUMENT_sev.o := n CFLAGS_irq.o := -I $(srctree)/$(src)/../include/asm/trace
Signature · 1 line
2.31.1
Quoted 10 lines · Pengfei Xu
Currently kcov instrument is disabled for object files under
arch/x86/kernelfolder.
For object files underarch/x86/kernel, actually just disabling the kcov instrument of files:"head32.o or head64.o and sev.o" could achieve successful booting and provide kcov coverage for object files that do not disable kcov instrument.
The additional kcov coverage collected fromarch/x86/kernelfolder helps kernel fuzzing efforts to find bugs.
Quoted 6 lines
Link to related improvement discussion is below:
https://groups.google.com/g/syzkaller/c/Dsl-RYGCqs8/m/x-tfpTyFBAAJ
Related ticket is as follow:
https://bugzilla.kernel.org/show_bug.cgi?id=198443Signed-off-by Pengfei Xu <[email protected]>
I've run a local syzkaller instance with this and I don't see any additional kernel bugs caused by this and I see coverage in arch/x86/kernel/* now, in particular, dumpstack.c, perf_regs.c, signal.c.
Quoted 27 lines
--- arch/x86/kernel/Makefile | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)arch/x86/kernel/Makefile +4
-6@@ -33,11 +33,10 @@ KCSAN_SANITIZE := n KMSAN_SANITIZE_head$(BITS).o := n KMSAN_SANITIZE_nmi.o := n -# If instrumentation of this dir is enabled, boot hangs during first second. -# Probably could be more selective here, but note that files related to irqs, -# boot, dumpstack/stacktrace, etc are either non-interesting or can lead to -# non-deterministic coverage. -KCOV_INSTRUMENT := n +# If instrumentation of the following files is enabled, boot hangs during +# first second. +KCOV_INSTRUMENT_head$(BITS).o := n +KCOV_INSTRUMENT_sev.o := n CFLAGS_irq.o := -I $(srctree)/$(src)/../include/asm/trace --2.31.1
Hi Dmitry,
Quoted 16 lines · Dmitry Vyukov
Quoted 15 lines · Pengfei Xu
Currently kcov instrument is disabled for object files under
arch/x86/kernelfolder.
For object files underarch/x86/kernel, actually just disabling the kcov instrument of files:"head32.o or head64.o and sev.o" could achieve successful booting and provide kcov coverage for object files that do not disable kcov instrument.
The additional kcov coverage collected fromarch/x86/kernelfolder helps kernel fuzzing efforts to find bugs.Link to related improvement discussion is below:
https://groups.google.com/g/syzkaller/c/Dsl-RYGCqs8/m/x-tfpTyFBAAJ
Related ticket is as follow:
https://bugzilla.kernel.org/show_bug.cgi?id=198443
Quoted 8 lines
Quoted 1 line
Signed-off-by Pengfei Xu <[email protected]>Reviewed-and-tested-by Dmitry Vyukov <[email protected]>I've run a local syzkaller instance with this and I don't see any additional kernel bugs caused by this and I see coverage in
arch/x86/kernel/*now, in particular,dumpstack.c,perf_regs.c,signal.c.
Thanks for your tag! Yes, it can cover more code in arch/x86/kernel/.
Best Regards,
Thanks!
Quoted 29 lines
Quoted 29 lines
--- arch/x86/kernel/Makefile | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)arch/x86/kernel/Makefile +4
-6@@ -33,11 +33,10 @@ KCSAN_SANITIZE := n KMSAN_SANITIZE_head$(BITS).o := n KMSAN_SANITIZE_nmi.o := n -# If instrumentation of this dir is enabled, boot hangs during first second. -# Probably could be more selective here, but note that files related to irqs, -# boot, dumpstack/stacktrace, etc are either non-interesting or can lead to -# non-deterministic coverage. -KCOV_INSTRUMENT := n +# If instrumentation of the following files is enabled, boot hangs during +# first second. +KCOV_INSTRUMENT_head$(BITS).o := n +KCOV_INSTRUMENT_sev.o := n CFLAGS_irq.o := -I $(srctree)/$(src)/../include/asm/trace --2.31.1