* [PATCH] rust: Do not export generated KASAN ODR symbols
@ 2025-01-22 0:14 Matthew Maurer
2025-01-22 8:38 ` Alice Ryhl
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Matthew Maurer @ 2025-01-22 0:14 UTC (permalink / raw)
To: Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross
Cc: rust-for-linux, linux-kernel, Matthew Maurer
ASAN generates sppecial synthetic symbols to help check for ODR
violations. These synthetic symbols lack debug information, so
gendwarfksyms emits warnings when processing them. No code should ever
have a dependency on these symbols, so we should not be exporting them,
just like the __cfi symbols.
Signed-off-by: Matthew Maurer <mmaurer@google.com>
---
rust/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/rust/Makefile b/rust/Makefile
index ab300bfb46f6a3e386b86d58120d7aeddc57da37..4f212bd41e74ec9f25445d3af76818332f288e15 100644
--- a/rust/Makefile
+++ b/rust/Makefile
@@ -329,7 +329,7 @@ $(obj)/bindings/bindings_helpers_generated.rs: private bindgen_target_extra = ;
$(obj)/bindings/bindings_helpers_generated.rs: $(src)/helpers/helpers.c FORCE
$(call if_changed_dep,bindgen)
-rust_exports = $(NM) -p --defined-only $(1) | awk '$$2~/(T|R|D|B)/ && $$3!~/__cfi/ { printf $(2),$$3 }'
+rust_exports = $(NM) -p --defined-only $(1) | awk '$$2~/(T|R|D|B)/ && $$3!~/__cfi/ && $$3!~/__odr_asan/ { printf $(2),$$3 }'
quiet_cmd_exports = EXPORTS $@
cmd_exports = \
---
base-commit: 0939156bc07c9fd2b554d9813352c386dacfc3d9
change-id: 20250116-gendwarfksyms-kasan-rust-2bdbac027f88
Best regards,
--
Matthew Maurer <mmaurer@google.com>
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH] rust: Do not export generated KASAN ODR symbols
2025-01-22 0:14 [PATCH] rust: Do not export generated KASAN ODR symbols Matthew Maurer
@ 2025-01-22 8:38 ` Alice Ryhl
2025-01-22 9:11 ` Miguel Ojeda
2025-02-06 23:04 ` Miguel Ojeda
2 siblings, 0 replies; 10+ messages in thread
From: Alice Ryhl @ 2025-01-22 8:38 UTC (permalink / raw)
To: Matthew Maurer
Cc: Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg,
Trevor Gross, rust-for-linux, linux-kernel
On Wed, Jan 22, 2025 at 1:14 AM Matthew Maurer <mmaurer@google.com> wrote:
>
> ASAN generates sppecial synthetic symbols to help check for ODR
Typo: sppecial
> violations. These synthetic symbols lack debug information, so
> gendwarfksyms emits warnings when processing them. No code should ever
> have a dependency on these symbols, so we should not be exporting them,
> just like the __cfi symbols.
>
> Signed-off-by: Matthew Maurer <mmaurer@google.com>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
> rust/Makefile | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/rust/Makefile b/rust/Makefile
> index ab300bfb46f6a3e386b86d58120d7aeddc57da37..4f212bd41e74ec9f25445d3af76818332f288e15 100644
> --- a/rust/Makefile
> +++ b/rust/Makefile
> @@ -329,7 +329,7 @@ $(obj)/bindings/bindings_helpers_generated.rs: private bindgen_target_extra = ;
> $(obj)/bindings/bindings_helpers_generated.rs: $(src)/helpers/helpers.c FORCE
> $(call if_changed_dep,bindgen)
>
> -rust_exports = $(NM) -p --defined-only $(1) | awk '$$2~/(T|R|D|B)/ && $$3!~/__cfi/ { printf $(2),$$3 }'
> +rust_exports = $(NM) -p --defined-only $(1) | awk '$$2~/(T|R|D|B)/ && $$3!~/__cfi/ && $$3!~/__odr_asan/ { printf $(2),$$3 }'
>
> quiet_cmd_exports = EXPORTS $@
> cmd_exports = \
>
> ---
> base-commit: 0939156bc07c9fd2b554d9813352c386dacfc3d9
> change-id: 20250116-gendwarfksyms-kasan-rust-2bdbac027f88
>
> Best regards,
> --
> Matthew Maurer <mmaurer@google.com>
>
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH] rust: Do not export generated KASAN ODR symbols
2025-01-22 0:14 [PATCH] rust: Do not export generated KASAN ODR symbols Matthew Maurer
2025-01-22 8:38 ` Alice Ryhl
@ 2025-01-22 9:11 ` Miguel Ojeda
2025-02-05 20:08 ` Matthew Maurer
2025-02-06 23:04 ` Miguel Ojeda
2 siblings, 1 reply; 10+ messages in thread
From: Miguel Ojeda @ 2025-01-22 9:11 UTC (permalink / raw)
To: Matthew Maurer
Cc: Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, rust-for-linux, linux-kernel
On Wed, Jan 22, 2025 at 1:14 AM Matthew Maurer <mmaurer@google.com> wrote:
>
> ASAN generates sppecial synthetic symbols to help check for ODR
> violations. These synthetic symbols lack debug information, so
> gendwarfksyms emits warnings when processing them. No code should ever
> have a dependency on these symbols, so we should not be exporting them,
> just like the __cfi symbols.
>
> Signed-off-by: Matthew Maurer <mmaurer@google.com>
Sounds good -- are those generated unconditionally by ASAN to check
for C++ ODR violations and so we get them anyway or do we benefit
somehow?
I also wondered about whether we should search for an extra underscore
(`__odr_asan_`), but I also see mentions of `__odr_asan.`, which I
guess that is the reason you used that prefix. Is that right?
Acked-by: Miguel Ojeda <ojeda@kernel.org>
Thanks!
Cheers,
Miguel
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] rust: Do not export generated KASAN ODR symbols
2025-01-22 9:11 ` Miguel Ojeda
@ 2025-02-05 20:08 ` Matthew Maurer
2025-02-05 23:00 ` Miguel Ojeda
0 siblings, 1 reply; 10+ messages in thread
From: Matthew Maurer @ 2025-02-05 20:08 UTC (permalink / raw)
To: Miguel Ojeda
Cc: Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, rust-for-linux, linux-kernel
On Wed, Jan 22, 2025 at 1:12 AM Miguel Ojeda
<miguel.ojeda.sandonis@gmail.com> wrote:
>
> On Wed, Jan 22, 2025 at 1:14 AM Matthew Maurer <mmaurer@google.com> wrote:
> >
> > ASAN generates sppecial synthetic symbols to help check for ODR
> > violations. These synthetic symbols lack debug information, so
> > gendwarfksyms emits warnings when processing them. No code should ever
> > have a dependency on these symbols, so we should not be exporting them,
> > just like the __cfi symbols.
> >
> > Signed-off-by: Matthew Maurer <mmaurer@google.com>
>
> Sounds good -- are those generated unconditionally by ASAN to check
> for C++ ODR violations and so we get them anyway or do we benefit
> somehow?
>
> I also wondered about whether we should search for an extra underscore
> (`__odr_asan_`), but I also see mentions of `__odr_asan.`, which I
> guess that is the reason you used that prefix. Is that right?
In case you were waiting for an answer on that, it's because I was
trying to be as loose as possible, since `__odr_asan` isn't going to
end up on random symbols we *intended* to export from the kernel.
We could technically restrict it to `__odr_asan_gen_` to be more
precise and it should still work.
>
> Acked-by: Miguel Ojeda <ojeda@kernel.org>
>
> Thanks!
>
> Cheers,
> Miguel
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] rust: Do not export generated KASAN ODR symbols
2025-02-05 20:08 ` Matthew Maurer
@ 2025-02-05 23:00 ` Miguel Ojeda
2025-02-05 23:03 ` Matthew Maurer
0 siblings, 1 reply; 10+ messages in thread
From: Miguel Ojeda @ 2025-02-05 23:00 UTC (permalink / raw)
To: Matthew Maurer
Cc: Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, rust-for-linux, linux-kernel
On Wed, Feb 5, 2025 at 9:08 PM Matthew Maurer <mmaurer@google.com> wrote:
>
> In case you were waiting for an answer on that, it's because I was
> trying to be as loose as possible, since `__odr_asan` isn't going to
> end up on random symbols we *intended* to export from the kernel.
> We could technically restrict it to `__odr_asan_gen_` to be more
> precise and it should still work.
Sounds good, thanks!
Should we add a Fixes tag to any particular commit?
Cheers,
Miguel
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] rust: Do not export generated KASAN ODR symbols
2025-02-05 23:00 ` Miguel Ojeda
@ 2025-02-05 23:03 ` Matthew Maurer
2025-02-05 23:08 ` Miguel Ojeda
0 siblings, 1 reply; 10+ messages in thread
From: Matthew Maurer @ 2025-02-05 23:03 UTC (permalink / raw)
To: Miguel Ojeda
Cc: Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, rust-for-linux, linux-kernel
Fixes: e3117404b41124c88a4d834fc3222669a880addc
would probably be most appropriate
On Wed, Feb 5, 2025 at 3:01 PM Miguel Ojeda
<miguel.ojeda.sandonis@gmail.com> wrote:
>
> On Wed, Feb 5, 2025 at 9:08 PM Matthew Maurer <mmaurer@google.com> wrote:
> >
> > In case you were waiting for an answer on that, it's because I was
> > trying to be as loose as possible, since `__odr_asan` isn't going to
> > end up on random symbols we *intended* to export from the kernel.
> > We could technically restrict it to `__odr_asan_gen_` to be more
> > precise and it should still work.
>
> Sounds good, thanks!
>
> Should we add a Fixes tag to any particular commit?
>
> Cheers,
> Miguel
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] rust: Do not export generated KASAN ODR symbols
2025-02-05 23:03 ` Matthew Maurer
@ 2025-02-05 23:08 ` Miguel Ojeda
2025-02-05 23:12 ` Matthew Maurer
0 siblings, 1 reply; 10+ messages in thread
From: Miguel Ojeda @ 2025-02-05 23:08 UTC (permalink / raw)
To: Matthew Maurer
Cc: Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, rust-for-linux, linux-kernel
On Thu, Feb 6, 2025 at 12:03 AM Matthew Maurer <mmaurer@google.com> wrote:
>
> Fixes: e3117404b41124c88a4d834fc3222669a880addc
> would probably be most appropriate
Thanks for the quick reply!
In principle, the backport to 6.12.y nor 6.13.y is not needed since
gendwarfksyms does not exist there, right?
Cheers,
Miguel
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] rust: Do not export generated KASAN ODR symbols
2025-02-05 23:08 ` Miguel Ojeda
@ 2025-02-05 23:12 ` Matthew Maurer
2025-02-05 23:13 ` Miguel Ojeda
0 siblings, 1 reply; 10+ messages in thread
From: Matthew Maurer @ 2025-02-05 23:12 UTC (permalink / raw)
To: Miguel Ojeda
Cc: Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, rust-for-linux, linux-kernel
Correct, I don't believe it needs to be backported. `gendwarfksyms` is
the only in-tree tool I am aware of breaking on this. It is possible
someone else is dumping DWARF for all exported symbols, but I don't
know of anyone specific other than Android for kernel ABI monitoring,
who already has this patch in-tree, and does that monitoring on
non-ASAN builds.
On Wed, Feb 5, 2025 at 3:08 PM Miguel Ojeda
<miguel.ojeda.sandonis@gmail.com> wrote:
>
> On Thu, Feb 6, 2025 at 12:03 AM Matthew Maurer <mmaurer@google.com> wrote:
> >
> > Fixes: e3117404b41124c88a4d834fc3222669a880addc
> > would probably be most appropriate
>
> Thanks for the quick reply!
>
> In principle, the backport to 6.12.y nor 6.13.y is not needed since
> gendwarfksyms does not exist there, right?
>
> Cheers,
> Miguel
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] rust: Do not export generated KASAN ODR symbols
2025-02-05 23:12 ` Matthew Maurer
@ 2025-02-05 23:13 ` Miguel Ojeda
0 siblings, 0 replies; 10+ messages in thread
From: Miguel Ojeda @ 2025-02-05 23:13 UTC (permalink / raw)
To: Matthew Maurer
Cc: Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, rust-for-linux, linux-kernel
On Thu, Feb 6, 2025 at 12:12 AM Matthew Maurer <mmaurer@google.com> wrote:
>
> Correct, I don't believe it needs to be backported. `gendwarfksyms` is
> the only in-tree tool I am aware of breaking on this. It is possible
> someone else is dumping DWARF for all exported symbols, but I don't
> know of anyone specific other than Android for kernel ABI monitoring,
> who already has this patch in-tree, and does that monitoring on
> non-ASAN builds.
Then I guess we could add a Fixes tag to one of those recent commits
(i.e. where `gendwarfksyms` is added), so that it doesn't trigger the
stable team into a backport.
But it is not a big deal -- if no recent commit really fits, I can
still apply it into `rust-fixes` without a tag.
Cheers,
Miguel
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] rust: Do not export generated KASAN ODR symbols
2025-01-22 0:14 [PATCH] rust: Do not export generated KASAN ODR symbols Matthew Maurer
2025-01-22 8:38 ` Alice Ryhl
2025-01-22 9:11 ` Miguel Ojeda
@ 2025-02-06 23:04 ` Miguel Ojeda
2 siblings, 0 replies; 10+ messages in thread
From: Miguel Ojeda @ 2025-02-06 23:04 UTC (permalink / raw)
To: Matthew Maurer
Cc: Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, rust-for-linux, linux-kernel
On Wed, Jan 22, 2025 at 1:14 AM Matthew Maurer <mmaurer@google.com> wrote:
>
> ASAN generates sppecial synthetic symbols to help check for ODR
> violations. These synthetic symbols lack debug information, so
> gendwarfksyms emits warnings when processing them. No code should ever
> have a dependency on these symbols, so we should not be exporting them,
> just like the __cfi symbols.
>
> Signed-off-by: Matthew Maurer <mmaurer@google.com>
Applied to `rust-fixes` -- thanks everyone!
[ Fixed typo in commit message. Slightly reworded title. - Miguel ]
Cheers,
Miguel
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2025-02-06 23:04 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-22 0:14 [PATCH] rust: Do not export generated KASAN ODR symbols Matthew Maurer
2025-01-22 8:38 ` Alice Ryhl
2025-01-22 9:11 ` Miguel Ojeda
2025-02-05 20:08 ` Matthew Maurer
2025-02-05 23:00 ` Miguel Ojeda
2025-02-05 23:03 ` Matthew Maurer
2025-02-05 23:08 ` Miguel Ojeda
2025-02-05 23:12 ` Matthew Maurer
2025-02-05 23:13 ` Miguel Ojeda
2025-02-06 23:04 ` Miguel Ojeda
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).