linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ftrace: don't call kaslr_offset()
@ 2025-02-25  9:00 Arnd Bergmann
  2025-02-25 18:31 ` Steven Rostedt
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2025-02-25  9:00 UTC (permalink / raw)
  To: Steven Rostedt, Masami Hiramatsu
  Cc: Arnd Bergmann, Mark Rutland, Mathieu Desnoyers, Joel Granados,
	Randy Dunlap, linux-kernel, linux-trace-kernel

From: Arnd Bergmann <arnd@arndb.de>

The kaslr_offset() function is only defined on architectures
that implement CONFIG_RANDOMIZE_BASE, which leads to a
build failure on 32-bit arm and likely others.

Hide the function call behind an #ifdef.

Fixes: ef378c3b8233 ("scripts/sorttable: Zero out weak functions in mcount_loc table")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
There is probably a nicer way to do this, this version was the
minimum fix I found to unbreak the build.
---
 kernel/trace/ftrace.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index ac55b97aa540..f41245716e0b 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -7018,7 +7018,7 @@ static int ftrace_process_locs(struct module *mod,
 	unsigned long count;
 	unsigned long *p;
 	unsigned long addr;
-	unsigned long kaslr;
+	unsigned long kaslr = 0;
 	unsigned long flags = 0; /* Shut up gcc */
 	unsigned long pages;
 	int ret = -ENOMEM;
@@ -7070,8 +7070,10 @@ static int ftrace_process_locs(struct module *mod,
 		ftrace_pages->next = start_pg;
 	}
 
+#ifdef CONFIG_RANDOMIZE_BASE
 	/* For zeroed locations that were shifted for core kernel */
 	kaslr = !mod ? kaslr_offset() : 0;
+#endif
 
 	p = start;
 	pg = start_pg;
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-02-25 18:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-25  9:00 [PATCH] ftrace: don't call kaslr_offset() Arnd Bergmann
2025-02-25 18:31 ` Steven Rostedt

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).