linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] ftrace: Fix compile error when CONFIG_GENDWARFKSYMS is enabled
@ 2025-02-05 18:00 Haiyue Wang
  2025-02-05 18:51 ` Sami Tolvanen
  2025-02-06  0:38 ` Masami Hiramatsu
  0 siblings, 2 replies; 7+ messages in thread
From: Haiyue Wang @ 2025-02-05 18:00 UTC (permalink / raw)
  To: x86, linux-trace-kernel
  Cc: samitolvanen, Haiyue Wang, Steven Rostedt, Masami Hiramatsu,
	Mark Rutland, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin, open list:FUNCTION HOOKS (FTRACE)

When switching from CONFIG_GENKSYMS to CONFIG_GENDWARFKSYMS enabled, the
build is failed:

  AS      arch/x86/entry/entry.o
In file included from ./arch/x86/include/asm/asm-prototypes.h:2,
                 from <stdin>:3:
./arch/x86/include/asm/ftrace.h: In function ‘arch_ftrace_get_symaddr’:
./arch/x86/include/asm/ftrace.h:46:21: error: implicit declaration of function ‘get_kernel_nofault’ [-Werror=implicit-function-declaration]
   46 |                 if (get_kernel_nofault(instr, (u32 *)(fentry_ip - ENDBR_INSN_SIZE)))
      |                     ^~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors

File "asm-prototypes.h" is added to entry.S by 'scripts/Makefile.build',
adding the missed declaration header file can also fix the error:

 getasmexports =                                                        \
    { echo "\#include <linux/kernel.h>" ;                               \
      echo "\#include <linux/string.h>" ;                               \
+     echo "\#include <linux/uaccess.h>";                               \
      echo "\#include <asm/asm-prototypes.h>" ;                         \
      $(call getexportsymbols,EXPORT_SYMBOL(\1);) ; }

Fixes: 2bc56fdae1ba ("ftrace: Add ftrace_get_symaddr to convert fentry_ip to symaddr")

Signed-off-by: Haiyue Wang <haiyuewa@163.com>
---
 arch/x86/include/asm/ftrace.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/x86/include/asm/ftrace.h b/arch/x86/include/asm/ftrace.h
index f9cb4d07df58..063ce70837bb 100644
--- a/arch/x86/include/asm/ftrace.h
+++ b/arch/x86/include/asm/ftrace.h
@@ -34,6 +34,10 @@ static inline unsigned long ftrace_call_adjust(unsigned long addr)
 	return addr;
 }
 
+#ifdef CONFIG_X86_KERNEL_IBT
+#include <linux/uaccess.h>
+#endif
+
 static inline unsigned long arch_ftrace_get_symaddr(unsigned long fentry_ip)
 {
 #ifdef CONFIG_X86_KERNEL_IBT
-- 
2.48.1


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

end of thread, other threads:[~2025-02-06  4:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-05 18:00 [PATCH v1] ftrace: Fix compile error when CONFIG_GENDWARFKSYMS is enabled Haiyue Wang
2025-02-05 18:51 ` Sami Tolvanen
2025-02-06  0:38 ` Masami Hiramatsu
2025-02-06  0:53   ` Steven Rostedt
2025-02-06  2:45     ` Masami Hiramatsu
2025-02-06  3:23       ` Haiyue Wang
2025-02-06  4:17         ` Masami Hiramatsu

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