public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/1] x86/kernel: Increase kcov coverage under arch/x86/kernel folder
       [not found] <cover.1688460800.git.pengfei.xu@intel.com>
@ 2023-07-04  9:00 ` Pengfei Xu
  2023-07-05  4:28   ` Dmitry Vyukov
  0 siblings, 1 reply; 3+ messages in thread
From: Pengfei Xu @ 2023-07-04  9:00 UTC (permalink / raw)
  To: dvyukov, nogikh, linux-kernel
  Cc: Pengfei Xu, Heng Su, syzkaller, keescook, Mehta Sohil,
	kirill.shutemov, akpm

Currently 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

Signed-off-by: Pengfei Xu <pengfei.xu@intel.com>
---
 arch/x86/kernel/Makefile | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index 4070a01c11b7..00df34c263cc 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v1 1/1] x86/kernel: Increase kcov coverage under arch/x86/kernel folder
  2023-07-04  9:00 ` [PATCH v1 1/1] x86/kernel: Increase kcov coverage under arch/x86/kernel folder Pengfei Xu
@ 2023-07-05  4:28   ` Dmitry Vyukov
  2023-07-05 11:38     ` Pengfei Xu
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Vyukov @ 2023-07-05  4:28 UTC (permalink / raw)
  To: Pengfei Xu
  Cc: nogikh, linux-kernel, Heng Su, syzkaller, keescook, Mehta Sohil,
	kirill.shutemov, akpm

On Tue, 4 Jul 2023 at 10:58, Pengfei Xu <pengfei.xu@intel.com> wrote:
>
> Currently 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
>
> Signed-off-by: Pengfei Xu <pengfei.xu@intel.com>

Reviewed-and-tested-by: Dmitry Vyukov <dvyukov@google.com>

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.


> ---
>  arch/x86/kernel/Makefile | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
> index 4070a01c11b7..00df34c263cc 100644
> --- a/arch/x86/kernel/Makefile
> +++ b/arch/x86/kernel/Makefile
> @@ -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
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1 1/1] x86/kernel: Increase kcov coverage under arch/x86/kernel folder
  2023-07-05  4:28   ` Dmitry Vyukov
@ 2023-07-05 11:38     ` Pengfei Xu
  0 siblings, 0 replies; 3+ messages in thread
From: Pengfei Xu @ 2023-07-05 11:38 UTC (permalink / raw)
  To: Dmitry Vyukov
  Cc: nogikh, linux-kernel, Heng Su, syzkaller, keescook, Mehta Sohil,
	kirill.shutemov, akpm

Hi Dmitry,

On 2023-07-05 at 06:28:10 +0200, Dmitry Vyukov wrote:
> On Tue, 4 Jul 2023 at 10:58, Pengfei Xu <pengfei.xu@intel.com> wrote:
> >
> > Currently 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
> >
> > Signed-off-by: Pengfei Xu <pengfei.xu@intel.com>
> 
> Reviewed-and-tested-by: Dmitry Vyukov <dvyukov@google.com>
> 
> 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!

> 
> 
> > ---
> >  arch/x86/kernel/Makefile | 9 ++++-----
> >  1 file changed, 4 insertions(+), 5 deletions(-)
> >
> > diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
> > index 4070a01c11b7..00df34c263cc 100644
> > --- a/arch/x86/kernel/Makefile
> > +++ b/arch/x86/kernel/Makefile
> > @@ -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
> >

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-07-05 11:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <cover.1688460800.git.pengfei.xu@intel.com>
2023-07-04  9:00 ` [PATCH v1 1/1] x86/kernel: Increase kcov coverage under arch/x86/kernel folder Pengfei Xu
2023-07-05  4:28   ` Dmitry Vyukov
2023-07-05 11:38     ` Pengfei Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox