Linux kbuild/kconfig development
 help / color / mirror / Atom feed
* [PATCH] kallsyms: also special-case symbols aliasing _sinittext
@ 2026-09-07  6:12 Jan Beulich
  0 siblings, 0 replies; only message in thread
From: Jan Beulich @ 2026-09-07  6:12 UTC (permalink / raw)
  To: linux-kbuild@vger.kernel.org; +Cc: Nathan Chancellor, Nicolas Schier

In the Xen project, where we use a clone of kallsyms, we encountered the
(rare) situation of trailing symbols immediately ahead of _sinittext
moving between passes 1 and 2 in a way that in just one of the two passes
they would actually alias _sinittext. The same can clearly happen to
Linux.

To consistently discard such symbols on all passes, extend the existing
"corner case" by also considering aliases with _sinittext (_stext really
shouldn't have anything ahead of it). But discard only non-text symbols
there, to avoid discarding true aliases, and assuming that what comes
immediately ahead is (typically r/o) data.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
I'm also a little puzzled by the verification done: The extra linking pass
is engaged if the sizes of the two earlier objects aren't the same. The
sizes, however, can be the same even if there are changes. Later
System.map is also compared against the last pass'es .syms, yet both are
first passed through mksysmap filtering, which removes far more symbols
than kallsyms does. Hence no difference there again doesn't necessarily
mean the symbol table hasn't changed.

--- a/scripts/kallsyms.c
+++ b/scripts/kallsyms.c
@@ -222,6 +222,11 @@ static int symbol_valid(const struct sym
 		    (s->addr == text_range_inittext->end &&
 		     strcmp(name, text_range_inittext->end_sym)))
 			return 0;
+		/* Same for non-text aliases of _sinittext. */
+		if (toupper(s->sym[0]) != 'T'
+		    && s->addr == text_range_inittext->start
+		    && strcmp(name, text_range_inittext->start_sym))
+			return 0;
 	}
 
 	return 1;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-09-07  6:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-07  6:12 [PATCH] kallsyms: also special-case symbols aliasing _sinittext Jan Beulich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox