* [PATCH v2] kcov: rust: add flags for KCOV with Rust
@ 2025-05-01 12:16 Alice Ryhl
2025-05-02 12:36 ` Aleksandr Nogikh
2025-05-15 12:01 ` Dmitry Vyukov
0 siblings, 2 replies; 6+ messages in thread
From: Alice Ryhl @ 2025-05-01 12:16 UTC (permalink / raw)
To: Dmitry Vyukov, Andrey Konovalov, Masahiro Yamada,
Nathan Chancellor, Miguel Ojeda
Cc: Nicolas Schier, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Trevor Gross, Danilo Krummrich,
Aleksandr Nogikh, Nick Desaulniers, Bill Wendling, Justin Stitt,
kasan-dev, linux-kbuild, linux-kernel, rust-for-linux, llvm,
Matthew Maurer, Alexander Potapenko, Alice Ryhl
Rust code is currently not instrumented properly when KCOV is enabled.
Thus, add the relevant flags to perform instrumentation correctly. This
is necessary for efficient fuzzing of Rust code.
The sanitizer-coverage features of LLVM have existed for long enough
that they are available on any LLVM version supported by rustc, so we do
not need any Kconfig feature detection. The coverage level is set to 3,
as that is the level needed by trace-pc.
We do not instrument `core` since when we fuzz the kernel, we are
looking for bugs in the kernel, not the Rust stdlib.
Co-developed-by: Matthew Maurer <mmaurer@google.com>
Signed-off-by: Matthew Maurer <mmaurer@google.com>
Reviewed-by: Alexander Potapenko <glider@google.com>
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
---
I did not pick up the Tested-by due to the changes. I verified that it
looks right under objdump, but I don't have a syzkaller setup I can try
it with.
---
Changes in v2:
- Ignore `core` in KCOV.
- Link to v1: https://lore.kernel.org/r/20250430-rust-kcov-v1-1-b9ae94148175@google.com
---
rust/Makefile | 1 +
scripts/Makefile.kcov | 6 ++++++
scripts/Makefile.lib | 3 +++
3 files changed, 10 insertions(+)
diff --git a/rust/Makefile b/rust/Makefile
index 3aca903a7d08cfbf4d4e0f172dab66e9115001e3..80c84749d734842774a3ac2aabbc944a68d02484 100644
--- a/rust/Makefile
+++ b/rust/Makefile
@@ -492,6 +492,7 @@ $(obj)/core.o: $(RUST_LIB_SRC)/core/src/lib.rs \
ifneq ($(or $(CONFIG_X86_64),$(CONFIG_X86_32)),)
$(obj)/core.o: scripts/target.json
endif
+KCOV_INSTRUMENT_core.o := n
$(obj)/compiler_builtins.o: private skip_gendwarfksyms = 1
$(obj)/compiler_builtins.o: private rustc_objcopy = -w -W '__*'
diff --git a/scripts/Makefile.kcov b/scripts/Makefile.kcov
index 67e8cfe3474b7dcf7552e675cffe356788e6c3a2..ddcc3c6dc513e1988aeaf07b8efa106e8dffa640 100644
--- a/scripts/Makefile.kcov
+++ b/scripts/Makefile.kcov
@@ -3,4 +3,10 @@ kcov-flags-$(CONFIG_CC_HAS_SANCOV_TRACE_PC) += -fsanitize-coverage=trace-pc
kcov-flags-$(CONFIG_KCOV_ENABLE_COMPARISONS) += -fsanitize-coverage=trace-cmp
kcov-flags-$(CONFIG_GCC_PLUGIN_SANCOV) += -fplugin=$(objtree)/scripts/gcc-plugins/sancov_plugin.so
+kcov-rflags-y += -Cpasses=sancov-module
+kcov-rflags-y += -Cllvm-args=-sanitizer-coverage-level=3
+kcov-rflags-y += -Cllvm-args=-sanitizer-coverage-trace-pc
+kcov-rflags-$(CONFIG_KCOV_ENABLE_COMPARISONS) += -Cllvm-args=-sanitizer-coverage-trace-compares
+
export CFLAGS_KCOV := $(kcov-flags-y)
+export RUSTFLAGS_KCOV := $(kcov-rflags-y)
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 2fe73cda0bddb9dcf709d0a9ae541318d54754d2..520905f19a9b19631394cfb5e129effb8846d5b8 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -169,6 +169,9 @@ ifeq ($(CONFIG_KCOV),y)
_c_flags += $(if $(patsubst n%,, \
$(KCOV_INSTRUMENT_$(target-stem).o)$(KCOV_INSTRUMENT)$(if $(is-kernel-object),$(CONFIG_KCOV_INSTRUMENT_ALL))), \
$(CFLAGS_KCOV))
+_rust_flags += $(if $(patsubst n%,, \
+ $(KCOV_INSTRUMENT_$(target-stem).o)$(KCOV_INSTRUMENT)$(if $(is-kernel-object),$(CONFIG_KCOV_INSTRUMENT_ALL))), \
+ $(RUSTFLAGS_KCOV))
endif
#
---
base-commit: 9c32cda43eb78f78c73aee4aa344b777714e259b
change-id: 20250430-rust-kcov-6c74fd0f1f06
Best regards,
--
Alice Ryhl <aliceryhl@google.com>
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2] kcov: rust: add flags for KCOV with Rust
2025-05-01 12:16 [PATCH v2] kcov: rust: add flags for KCOV with Rust Alice Ryhl
@ 2025-05-02 12:36 ` Aleksandr Nogikh
2025-05-02 13:47 ` Miguel Ojeda
2025-05-15 12:01 ` Dmitry Vyukov
1 sibling, 1 reply; 6+ messages in thread
From: Aleksandr Nogikh @ 2025-05-02 12:36 UTC (permalink / raw)
To: Alice Ryhl
Cc: Dmitry Vyukov, Andrey Konovalov, Masahiro Yamada,
Nathan Chancellor, Miguel Ojeda, Nicolas Schier, Boqun Feng,
Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg,
Trevor Gross, Danilo Krummrich, Nick Desaulniers, Bill Wendling,
Justin Stitt, kasan-dev, linux-kbuild, linux-kernel,
rust-for-linux, llvm, Matthew Maurer, Alexander Potapenko
On Thu, May 1, 2025 at 2:16 PM Alice Ryhl <aliceryhl@google.com> wrote:
>
> Rust code is currently not instrumented properly when KCOV is enabled.
> Thus, add the relevant flags to perform instrumentation correctly. This
> is necessary for efficient fuzzing of Rust code.
>
> The sanitizer-coverage features of LLVM have existed for long enough
> that they are available on any LLVM version supported by rustc, so we do
> not need any Kconfig feature detection. The coverage level is set to 3,
> as that is the level needed by trace-pc.
>
> We do not instrument `core` since when we fuzz the kernel, we are
> looking for bugs in the kernel, not the Rust stdlib.
>
> Co-developed-by: Matthew Maurer <mmaurer@google.com>
> Signed-off-by: Matthew Maurer <mmaurer@google.com>
> Reviewed-by: Alexander Potapenko <glider@google.com>
> Signed-off-by: Alice Ryhl <aliceryhl@google.com>
> ---
> I did not pick up the Tested-by due to the changes. I verified that it
> looks right under objdump, but I don't have a syzkaller setup I can try
> it with.
Thanks for incorporating the core.o change!
I've tested the v2 patch on my local setup and it works well.
Tested-by: Aleksandr Nogikh <nogikh@google.com>
> ---
> Changes in v2:
> - Ignore `core` in KCOV.
> - Link to v1: https://lore.kernel.org/r/20250430-rust-kcov-v1-1-b9ae94148175@google.com
> ---
> rust/Makefile | 1 +
> scripts/Makefile.kcov | 6 ++++++
> scripts/Makefile.lib | 3 +++
> 3 files changed, 10 insertions(+)
>
> diff --git a/rust/Makefile b/rust/Makefile
> index 3aca903a7d08cfbf4d4e0f172dab66e9115001e3..80c84749d734842774a3ac2aabbc944a68d02484 100644
> --- a/rust/Makefile
> +++ b/rust/Makefile
> @@ -492,6 +492,7 @@ $(obj)/core.o: $(RUST_LIB_SRC)/core/src/lib.rs \
> ifneq ($(or $(CONFIG_X86_64),$(CONFIG_X86_32)),)
> $(obj)/core.o: scripts/target.json
> endif
> +KCOV_INSTRUMENT_core.o := n
>
> $(obj)/compiler_builtins.o: private skip_gendwarfksyms = 1
> $(obj)/compiler_builtins.o: private rustc_objcopy = -w -W '__*'
> diff --git a/scripts/Makefile.kcov b/scripts/Makefile.kcov
> index 67e8cfe3474b7dcf7552e675cffe356788e6c3a2..ddcc3c6dc513e1988aeaf07b8efa106e8dffa640 100644
> --- a/scripts/Makefile.kcov
> +++ b/scripts/Makefile.kcov
> @@ -3,4 +3,10 @@ kcov-flags-$(CONFIG_CC_HAS_SANCOV_TRACE_PC) += -fsanitize-coverage=trace-pc
> kcov-flags-$(CONFIG_KCOV_ENABLE_COMPARISONS) += -fsanitize-coverage=trace-cmp
> kcov-flags-$(CONFIG_GCC_PLUGIN_SANCOV) += -fplugin=$(objtree)/scripts/gcc-plugins/sancov_plugin.so
>
> +kcov-rflags-y += -Cpasses=sancov-module
> +kcov-rflags-y += -Cllvm-args=-sanitizer-coverage-level=3
> +kcov-rflags-y += -Cllvm-args=-sanitizer-coverage-trace-pc
> +kcov-rflags-$(CONFIG_KCOV_ENABLE_COMPARISONS) += -Cllvm-args=-sanitizer-coverage-trace-compares
> +
> export CFLAGS_KCOV := $(kcov-flags-y)
> +export RUSTFLAGS_KCOV := $(kcov-rflags-y)
> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> index 2fe73cda0bddb9dcf709d0a9ae541318d54754d2..520905f19a9b19631394cfb5e129effb8846d5b8 100644
> --- a/scripts/Makefile.lib
> +++ b/scripts/Makefile.lib
> @@ -169,6 +169,9 @@ ifeq ($(CONFIG_KCOV),y)
> _c_flags += $(if $(patsubst n%,, \
> $(KCOV_INSTRUMENT_$(target-stem).o)$(KCOV_INSTRUMENT)$(if $(is-kernel-object),$(CONFIG_KCOV_INSTRUMENT_ALL))), \
> $(CFLAGS_KCOV))
> +_rust_flags += $(if $(patsubst n%,, \
> + $(KCOV_INSTRUMENT_$(target-stem).o)$(KCOV_INSTRUMENT)$(if $(is-kernel-object),$(CONFIG_KCOV_INSTRUMENT_ALL))), \
> + $(RUSTFLAGS_KCOV))
> endif
>
> #
>
> ---
> base-commit: 9c32cda43eb78f78c73aee4aa344b777714e259b
> change-id: 20250430-rust-kcov-6c74fd0f1f06
>
> Best regards,
> --
> Alice Ryhl <aliceryhl@google.com>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] kcov: rust: add flags for KCOV with Rust
2025-05-02 12:36 ` Aleksandr Nogikh
@ 2025-05-02 13:47 ` Miguel Ojeda
2025-05-05 5:59 ` Dmitry Vyukov
0 siblings, 1 reply; 6+ messages in thread
From: Miguel Ojeda @ 2025-05-02 13:47 UTC (permalink / raw)
To: Aleksandr Nogikh
Cc: Alice Ryhl, Dmitry Vyukov, Andrey Konovalov, Masahiro Yamada,
Nathan Chancellor, Miguel Ojeda, Nicolas Schier, Boqun Feng,
Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg,
Trevor Gross, Danilo Krummrich, Nick Desaulniers, Bill Wendling,
Justin Stitt, kasan-dev, linux-kbuild, linux-kernel,
rust-for-linux, llvm, Matthew Maurer, Alexander Potapenko
On Fri, May 2, 2025 at 2:36 PM Aleksandr Nogikh <nogikh@google.com> wrote:
>
> Thanks for incorporating the core.o change!
> I've tested the v2 patch on my local setup and it works well.
>
> Tested-by: Aleksandr Nogikh <nogikh@google.com>
Thanks for testing, very much appreciated.
Dmitry/Andrey: I guess you may want this to go through your tree
(although I don't see a `M:` there), but if not, please let me know:
Acked-by: Miguel Ojeda <ojeda@kernel.org>
Cheers,
Miguel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] kcov: rust: add flags for KCOV with Rust
2025-05-02 13:47 ` Miguel Ojeda
@ 2025-05-05 5:59 ` Dmitry Vyukov
0 siblings, 0 replies; 6+ messages in thread
From: Dmitry Vyukov @ 2025-05-05 5:59 UTC (permalink / raw)
To: Miguel Ojeda
Cc: Aleksandr Nogikh, Alice Ryhl, Andrey Konovalov, Masahiro Yamada,
Nathan Chancellor, Miguel Ojeda, Nicolas Schier, Boqun Feng,
Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg,
Trevor Gross, Danilo Krummrich, Nick Desaulniers, Bill Wendling,
Justin Stitt, kasan-dev, linux-kbuild, linux-kernel,
rust-for-linux, llvm, Matthew Maurer, Alexander Potapenko
On Fri, 2 May 2025 at 15:47, Miguel Ojeda
<miguel.ojeda.sandonis@gmail.com> wrote:
>
> On Fri, May 2, 2025 at 2:36 PM Aleksandr Nogikh <nogikh@google.com> wrote:
> >
> > Thanks for incorporating the core.o change!
> > I've tested the v2 patch on my local setup and it works well.
> >
> > Tested-by: Aleksandr Nogikh <nogikh@google.com>
>
> Thanks for testing, very much appreciated.
>
> Dmitry/Andrey: I guess you may want this to go through your tree
> (although I don't see a `M:` there), but if not, please let me know:
KCOV does not have its own tree, it's merged via MM tree with MM
maintainers effectively serving as final accepting maintainers.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] kcov: rust: add flags for KCOV with Rust
2025-05-01 12:16 [PATCH v2] kcov: rust: add flags for KCOV with Rust Alice Ryhl
2025-05-02 12:36 ` Aleksandr Nogikh
@ 2025-05-15 12:01 ` Dmitry Vyukov
2025-05-15 12:03 ` Aleksandr Nogikh
1 sibling, 1 reply; 6+ messages in thread
From: Dmitry Vyukov @ 2025-05-15 12:01 UTC (permalink / raw)
To: Alice Ryhl
Cc: Andrey Konovalov, Masahiro Yamada, Nathan Chancellor,
Miguel Ojeda, Nicolas Schier, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg,
Trevor Gross, Danilo Krummrich, Aleksandr Nogikh,
Nick Desaulniers, Bill Wendling, Justin Stitt, kasan-dev,
linux-kbuild, linux-kernel, rust-for-linux, llvm, Matthew Maurer,
Alexander Potapenko
On Thu, 1 May 2025 at 14:16, Alice Ryhl <aliceryhl@google.com> wrote:
>
> Rust code is currently not instrumented properly when KCOV is enabled.
> Thus, add the relevant flags to perform instrumentation correctly. This
> is necessary for efficient fuzzing of Rust code.
>
> The sanitizer-coverage features of LLVM have existed for long enough
> that they are available on any LLVM version supported by rustc, so we do
> not need any Kconfig feature detection. The coverage level is set to 3,
> as that is the level needed by trace-pc.
>
> We do not instrument `core` since when we fuzz the kernel, we are
> looking for bugs in the kernel, not the Rust stdlib.
>
> Co-developed-by: Matthew Maurer <mmaurer@google.com>
> Signed-off-by: Matthew Maurer <mmaurer@google.com>
> Reviewed-by: Alexander Potapenko <glider@google.com>
> Signed-off-by: Alice Ryhl <aliceryhl@google.com>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
> ---
> I did not pick up the Tested-by due to the changes. I verified that it
> looks right under objdump, but I don't have a syzkaller setup I can try
> it with.
> ---
> Changes in v2:
> - Ignore `core` in KCOV.
> - Link to v1: https://lore.kernel.org/r/20250430-rust-kcov-v1-1-b9ae94148175@google.com
> ---
> rust/Makefile | 1 +
> scripts/Makefile.kcov | 6 ++++++
> scripts/Makefile.lib | 3 +++
> 3 files changed, 10 insertions(+)
>
> diff --git a/rust/Makefile b/rust/Makefile
> index 3aca903a7d08cfbf4d4e0f172dab66e9115001e3..80c84749d734842774a3ac2aabbc944a68d02484 100644
> --- a/rust/Makefile
> +++ b/rust/Makefile
> @@ -492,6 +492,7 @@ $(obj)/core.o: $(RUST_LIB_SRC)/core/src/lib.rs \
> ifneq ($(or $(CONFIG_X86_64),$(CONFIG_X86_32)),)
> $(obj)/core.o: scripts/target.json
> endif
> +KCOV_INSTRUMENT_core.o := n
>
> $(obj)/compiler_builtins.o: private skip_gendwarfksyms = 1
> $(obj)/compiler_builtins.o: private rustc_objcopy = -w -W '__*'
> diff --git a/scripts/Makefile.kcov b/scripts/Makefile.kcov
> index 67e8cfe3474b7dcf7552e675cffe356788e6c3a2..ddcc3c6dc513e1988aeaf07b8efa106e8dffa640 100644
> --- a/scripts/Makefile.kcov
> +++ b/scripts/Makefile.kcov
> @@ -3,4 +3,10 @@ kcov-flags-$(CONFIG_CC_HAS_SANCOV_TRACE_PC) += -fsanitize-coverage=trace-pc
> kcov-flags-$(CONFIG_KCOV_ENABLE_COMPARISONS) += -fsanitize-coverage=trace-cmp
> kcov-flags-$(CONFIG_GCC_PLUGIN_SANCOV) += -fplugin=$(objtree)/scripts/gcc-plugins/sancov_plugin.so
>
> +kcov-rflags-y += -Cpasses=sancov-module
> +kcov-rflags-y += -Cllvm-args=-sanitizer-coverage-level=3
> +kcov-rflags-y += -Cllvm-args=-sanitizer-coverage-trace-pc
> +kcov-rflags-$(CONFIG_KCOV_ENABLE_COMPARISONS) += -Cllvm-args=-sanitizer-coverage-trace-compares
> +
> export CFLAGS_KCOV := $(kcov-flags-y)
> +export RUSTFLAGS_KCOV := $(kcov-rflags-y)
> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> index 2fe73cda0bddb9dcf709d0a9ae541318d54754d2..520905f19a9b19631394cfb5e129effb8846d5b8 100644
> --- a/scripts/Makefile.lib
> +++ b/scripts/Makefile.lib
> @@ -169,6 +169,9 @@ ifeq ($(CONFIG_KCOV),y)
> _c_flags += $(if $(patsubst n%,, \
> $(KCOV_INSTRUMENT_$(target-stem).o)$(KCOV_INSTRUMENT)$(if $(is-kernel-object),$(CONFIG_KCOV_INSTRUMENT_ALL))), \
> $(CFLAGS_KCOV))
> +_rust_flags += $(if $(patsubst n%,, \
> + $(KCOV_INSTRUMENT_$(target-stem).o)$(KCOV_INSTRUMENT)$(if $(is-kernel-object),$(CONFIG_KCOV_INSTRUMENT_ALL))), \
> + $(RUSTFLAGS_KCOV))
> endif
>
> #
>
> ---
> base-commit: 9c32cda43eb78f78c73aee4aa344b777714e259b
> change-id: 20250430-rust-kcov-6c74fd0f1f06
>
> Best regards,
> --
> Alice Ryhl <aliceryhl@google.com>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] kcov: rust: add flags for KCOV with Rust
2025-05-15 12:01 ` Dmitry Vyukov
@ 2025-05-15 12:03 ` Aleksandr Nogikh
0 siblings, 0 replies; 6+ messages in thread
From: Aleksandr Nogikh @ 2025-05-15 12:03 UTC (permalink / raw)
To: Dmitry Vyukov
Cc: Alice Ryhl, Andrey Konovalov, Masahiro Yamada, Nathan Chancellor,
Miguel Ojeda, Nicolas Schier, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg,
Trevor Gross, Danilo Krummrich, Nick Desaulniers, Bill Wendling,
Justin Stitt, kasan-dev, linux-kbuild, linux-kernel,
rust-for-linux, llvm, Matthew Maurer, Alexander Potapenko,
Andrew Morton, linux-mm
+mm
On Thu, May 15, 2025 at 2:01 PM Dmitry Vyukov <dvyukov@google.com> wrote:
>
> On Thu, 1 May 2025 at 14:16, Alice Ryhl <aliceryhl@google.com> wrote:
> >
> > Rust code is currently not instrumented properly when KCOV is enabled.
> > Thus, add the relevant flags to perform instrumentation correctly. This
> > is necessary for efficient fuzzing of Rust code.
> >
> > The sanitizer-coverage features of LLVM have existed for long enough
> > that they are available on any LLVM version supported by rustc, so we do
> > not need any Kconfig feature detection. The coverage level is set to 3,
> > as that is the level needed by trace-pc.
> >
> > We do not instrument `core` since when we fuzz the kernel, we are
> > looking for bugs in the kernel, not the Rust stdlib.
> >
> > Co-developed-by: Matthew Maurer <mmaurer@google.com>
> > Signed-off-by: Matthew Maurer <mmaurer@google.com>
> > Reviewed-by: Alexander Potapenko <glider@google.com>
> > Signed-off-by: Alice Ryhl <aliceryhl@google.com>
>
> Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
>
> > ---
> > I did not pick up the Tested-by due to the changes. I verified that it
> > looks right under objdump, but I don't have a syzkaller setup I can try
> > it with.
> > ---
> > Changes in v2:
> > - Ignore `core` in KCOV.
> > - Link to v1: https://lore.kernel.org/r/20250430-rust-kcov-v1-1-b9ae94148175@google.com
> > ---
> > rust/Makefile | 1 +
> > scripts/Makefile.kcov | 6 ++++++
> > scripts/Makefile.lib | 3 +++
> > 3 files changed, 10 insertions(+)
> >
> > diff --git a/rust/Makefile b/rust/Makefile
> > index 3aca903a7d08cfbf4d4e0f172dab66e9115001e3..80c84749d734842774a3ac2aabbc944a68d02484 100644
> > --- a/rust/Makefile
> > +++ b/rust/Makefile
> > @@ -492,6 +492,7 @@ $(obj)/core.o: $(RUST_LIB_SRC)/core/src/lib.rs \
> > ifneq ($(or $(CONFIG_X86_64),$(CONFIG_X86_32)),)
> > $(obj)/core.o: scripts/target.json
> > endif
> > +KCOV_INSTRUMENT_core.o := n
> >
> > $(obj)/compiler_builtins.o: private skip_gendwarfksyms = 1
> > $(obj)/compiler_builtins.o: private rustc_objcopy = -w -W '__*'
> > diff --git a/scripts/Makefile.kcov b/scripts/Makefile.kcov
> > index 67e8cfe3474b7dcf7552e675cffe356788e6c3a2..ddcc3c6dc513e1988aeaf07b8efa106e8dffa640 100644
> > --- a/scripts/Makefile.kcov
> > +++ b/scripts/Makefile.kcov
> > @@ -3,4 +3,10 @@ kcov-flags-$(CONFIG_CC_HAS_SANCOV_TRACE_PC) += -fsanitize-coverage=trace-pc
> > kcov-flags-$(CONFIG_KCOV_ENABLE_COMPARISONS) += -fsanitize-coverage=trace-cmp
> > kcov-flags-$(CONFIG_GCC_PLUGIN_SANCOV) += -fplugin=$(objtree)/scripts/gcc-plugins/sancov_plugin.so
> >
> > +kcov-rflags-y += -Cpasses=sancov-module
> > +kcov-rflags-y += -Cllvm-args=-sanitizer-coverage-level=3
> > +kcov-rflags-y += -Cllvm-args=-sanitizer-coverage-trace-pc
> > +kcov-rflags-$(CONFIG_KCOV_ENABLE_COMPARISONS) += -Cllvm-args=-sanitizer-coverage-trace-compares
> > +
> > export CFLAGS_KCOV := $(kcov-flags-y)
> > +export RUSTFLAGS_KCOV := $(kcov-rflags-y)
> > diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> > index 2fe73cda0bddb9dcf709d0a9ae541318d54754d2..520905f19a9b19631394cfb5e129effb8846d5b8 100644
> > --- a/scripts/Makefile.lib
> > +++ b/scripts/Makefile.lib
> > @@ -169,6 +169,9 @@ ifeq ($(CONFIG_KCOV),y)
> > _c_flags += $(if $(patsubst n%,, \
> > $(KCOV_INSTRUMENT_$(target-stem).o)$(KCOV_INSTRUMENT)$(if $(is-kernel-object),$(CONFIG_KCOV_INSTRUMENT_ALL))), \
> > $(CFLAGS_KCOV))
> > +_rust_flags += $(if $(patsubst n%,, \
> > + $(KCOV_INSTRUMENT_$(target-stem).o)$(KCOV_INSTRUMENT)$(if $(is-kernel-object),$(CONFIG_KCOV_INSTRUMENT_ALL))), \
> > + $(RUSTFLAGS_KCOV))
> > endif
> >
> > #
> >
> > ---
> > base-commit: 9c32cda43eb78f78c73aee4aa344b777714e259b
> > change-id: 20250430-rust-kcov-6c74fd0f1f06
> >
> > Best regards,
> > --
> > Alice Ryhl <aliceryhl@google.com>
> >
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-05-15 12:03 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-01 12:16 [PATCH v2] kcov: rust: add flags for KCOV with Rust Alice Ryhl
2025-05-02 12:36 ` Aleksandr Nogikh
2025-05-02 13:47 ` Miguel Ojeda
2025-05-05 5:59 ` Dmitry Vyukov
2025-05-15 12:01 ` Dmitry Vyukov
2025-05-15 12:03 ` Aleksandr Nogikh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox