lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aVvdt90YmhJz3i5i@x1>
Date: Mon, 5 Jan 2026 12:50:15 -0300
From: Arnaldo Carvalho de Melo <acme@...nel.org>
To: Gary Guo <gary@...yguo.net>
Cc: Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>,
	Namhyung Kim <namhyung@...nel.org>,
	Mark Rutland <mark.rutland@....com>,
	Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
	Jiri Olsa <jolsa@...nel.org>, Ian Rogers <irogers@...gle.com>,
	Adrian Hunter <adrian.hunter@...el.com>,
	James Clark <james.clark@...aro.org>,
	Miguel Ojeda <ojeda@...nel.org>, Boqun Feng <boqun.feng@...il.com>,
	Björn Roy Baron <bjorn3_gh@...tonmail.com>,
	Benno Lossin <lossin@...nel.org>,
	Andreas Hindborg <a.hindborg@...nel.org>,
	Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>,
	Danilo Krummrich <dakr@...nel.org>,
	Nathan Chancellor <nathan@...nel.org>,
	Nick Desaulniers <nick.desaulniers+lkml@...il.com>,
	Bill Wendling <morbo@...gle.com>,
	Justin Stitt <justinstitt@...gle.com>,
	Andi Kleen <ak@...ux.intel.com>, Dmitry Vyukov <dvyukov@...gle.com>,
	Stephen Brennan <stephen.s.brennan@...cle.com>,
	Arnaldo Carvalho de Melo <acme@...hat.com>,
	linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org,
	rust-for-linux@...r.kernel.org, llvm@...ts.linux.dev
Subject: Re: [PATCH v2] perf symbol: remove Rust symbol workarounds

On Mon, Jan 05, 2026 at 03:00:57PM +0000, Gary Guo wrote:
> From: Gary Guo <gary@...yguo.net>
> 
> Due to an off-by-one error introduced in commit 73bbb94466fd ("kallsyms:
> support "big" kernel symbols"), long symbols (which are currently only
> produced by Rust) can have their symbol type being wrongly parsed by
> kernel/kallsyms.c.

Looks sane, applied to perf-tools-next,

- Arnaldo
 
> This has been fixed in commit f3f9f42232dee5 ("kallsyms: Fix wrong "big"
> kernel symbol type read from procfs"), and these symbols are now
> reported correctly.
> 
> Drop the workaround in perf symbol that filter out these symbol types.
> 
> Specifically, '1' and 'l' can never be generated by nm -- 'u' does
> indicate GNU unique, however such symbols are only generated by G++ for
> C++ templates, and are never generated by LLVM (LLVM generates weak
> symbols in such cases instead). 'N' can appear if symbols exist inside
> debug sections, and 'n' may appear for symbols inside note sections,
> however these sections do not typically have symbol (and they're
> explicitly filtered out by kallsyms).
> 
> Therefore, the previous occurrence of these symbols types must be due to
> the off-by-one error and can be safely removed.
> 
> Cc: Arnaldo Carvalho de Melo <acme@...hat.com>
> Acked-by: Miguel Ojeda <ojeda@...nel.org>
> Signed-off-by: Gary Guo <gary@...yguo.net>
> ---
> v2:
> - Removed the "__" change as suggested by Miguel
> - Expanded the commit message to mention why "N" and "n" cannot appear
> - Link to v1: https://lore.kernel.org/rust-for-linux/20251223175216.1353814-1-gary@kernel.org/#t
> ---
>  tools/perf/util/symbol.c | 19 ++++---------------
>  1 file changed, 4 insertions(+), 15 deletions(-)
> 
> diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
> index 814f960fa8f8d..8662001e1e25b 100644
> --- a/tools/perf/util/symbol.c
> +++ b/tools/perf/util/symbol.c
> @@ -104,21 +104,10 @@ static enum dso_binary_type binary_type_symtab[] = {
>  
>  #define DSO_BINARY_TYPE__SYMTAB_CNT ARRAY_SIZE(binary_type_symtab)
>  
> -static bool symbol_type__filter(char __symbol_type)
> -{
> -	// Since 'U' == undefined and 'u' == unique global symbol, we can't use toupper there
> -	// 'N' is for debugging symbols, 'n' is a non-data, non-code, non-debug read-only section.
> -	// According to 'man nm'.
> -	// 'N' first seen in:
> -	// ffffffff9b35d130 N __pfx__RNCINvNtNtNtCsbDUBuN8AbD4_4core4iter8adapters3map12map_try_foldjNtCs6vVzKs5jPr6_12drm_panic_qr7VersionuINtNtNtBa_3ops12control_flow11ControlFlowB10_ENcB10_0NCINvNvNtNtNtB8_6traits8iterator8Iterator4find5checkB10_NCNvMB12_B10_13from_segments0E0E0B12_
> -	// a seemingly Rust mangled name
> -	// Ditto for '1':
> -	// root@x1:~# grep ' 1 ' /proc/kallsyms
> -	// ffffffffb098bc00 1 __pfx__RNCINvNtNtNtCsfwaGRd4cjqE_4core4iter8adapters3map12map_try_foldjNtCskFudTml27HW_12drm_panic_qr7VersionuINtNtNtBa_3ops12control_flow11ControlFlowB10_ENcB10_0NCINvNvNtNtNtB8_6traits8iterator8Iterator4find5checkB10_NCNvMB12_B10_13from_segments0E0E0B12_
> -	// ffffffffb098bc10 1 _RNCINvNtNtNtCsfwaGRd4cjqE_4core4iter8adapters3map12map_try_foldjNtCskFudTml27HW_12drm_panic_qr7VersionuINtNtNtBa_3ops12control_flow11ControlFlowB10_ENcB10_0NCINvNvNtNtNtB8_6traits8iterator8Iterator4find5checkB10_NCNvMB12_B10_13from_segments0E0E0B12_
> -	char symbol_type = toupper(__symbol_type);
> -	return symbol_type == 'T' || symbol_type == 'W' || symbol_type == 'D' || symbol_type == 'B' ||
> -	       __symbol_type == 'u' || __symbol_type == 'l' || __symbol_type == 'N' || __symbol_type == '1';
> +static bool symbol_type__filter(char symbol_type)
> +{
> +	symbol_type = toupper(symbol_type);
> +	return symbol_type == 'T' || symbol_type == 'W' || symbol_type == 'D' || symbol_type == 'B';
>  }
>  
>  static int prefix_underscores_count(const char *str)
> 
> base-commit: 3609fa95fb0f2c1b099e69e56634edb8fc03f87c
> -- 
> 2.51.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ