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>] [day] [month] [year] [list]
Message-ID: <20251107050414.511648-1-ojeda@kernel.org>
Date: Fri,  7 Nov 2025 06:04:14 +0100
From: Miguel Ojeda <ojeda@...nel.org>
To: Arnaldo Carvalho de Melo <acme@...nel.org>,
	Miguel Ojeda <ojeda@...nel.org>
Cc: Boqun Feng <boqun.feng@...il.com>,
	Gary Guo <gary@...yguo.net>,
	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>,
	Kees Cook <keescook@...omium.org>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Matthew Wilcox <willy@...radead.org>,
	rust-for-linux@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	patches@...ts.linux.dev,
	stable@...r.kernel.org
Subject: [PATCH] kallsyms: fix symbol type for "big" symbols

`kallsyms_get_symbol_type()` does not take into account the potential
extra byte for "big" symbols.

This makes `/proc/kallsyms` output the wrong symbol type for such "big"
symbols, such as a bogus `1` symbol type, which in turn confused other
tooling [1].

Thus fix it.

Cc: stable@...r.kernel.org
Link: https://lore.kernel.org/all/CANiq72ns1sRukpX-4L3FgqfJw4nXZ5AyqQKCEeQ=nhyERG7QGA@mail.gmail.com/
Fixes: 73bbb94466fd ("kallsyms: support "big" kernel symbols")
Signed-off-by: Miguel Ojeda <ojeda@...nel.org>
---
Somehow this went unnoticed so far... In Fedora 42 I compared the
System.map with `/proc/kallsyms` and that was the only symbol with a
different type -- Arnaldo, could you please confirm this makes it go
away for you? Thanks!

 kernel/kallsyms.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c
index 1e7635864124..4f9b612d6bf2 100644
--- a/kernel/kallsyms.c
+++ b/kernel/kallsyms.c
@@ -101,11 +101,21 @@ static unsigned int kallsyms_expand_symbol(unsigned int off,
  */
 static char kallsyms_get_symbol_type(unsigned int off)
 {
+	const u8 len = kallsyms_names[off];
+
+	off++;
+
+	/*
+	 * If MSB is 1, it is a "big" symbol, so we need to skip two bytes.
+	 */
+	if ((len & 0x80) != 0)
+		off++;
+
 	/*
 	 * Get just the first code, look it up in the token table,
 	 * and return the first char from this token.
 	 */
-	return kallsyms_token_table[kallsyms_token_index[kallsyms_names[off + 1]]];
+	return kallsyms_token_table[kallsyms_token_index[kallsyms_names[off]]];
 }



base-commit: dc77806cf3b4788d328fddf245e86c5b529f31a2
--
2.51.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ