Skip to contentSkip to conversation

kallsyms: fix symbol type for "big" symbols

PATCH New Miguel Ojeda 1 participant 1 message Nov 7, 2025

Subsystems (2)
lore
Share & tools
lore

Miguel Ojeda

author maintainer
#0 lore raw

PATCH 1/1 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.

---
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(-)
kernel/kallsyms.c +11 -1
index 1e7635864124..4f9b612d6bf2 100644
@@ -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