Linux Trace Kernel
 help / color / mirror / Atom feed
From: Haiyue Wang <haiyuewa@163.com>
To: x86@kernel.org, linux-trace-kernel@vger.kernel.org
Cc: samitolvanen@google.com, Haiyue Wang <haiyuewa@163.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	linux-kernel@vger.kernel.org (open list:FUNCTION HOOKS (FTRACE))
Subject: [PATCH v1] ftrace: Fix compile error when CONFIG_GENDWARFKSYMS is enabled
Date: Thu,  6 Feb 2025 02:00:42 +0800	[thread overview]
Message-ID: <20250205180116.88644-1-haiyuewa@163.com> (raw)

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


             reply	other threads:[~2025-02-05 18:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-05 18:00 Haiyue Wang [this message]
2025-02-05 18:51 ` [PATCH v1] ftrace: Fix compile error when CONFIG_GENDWARFKSYMS is enabled 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250205180116.88644-1-haiyuewa@163.com \
    --to=haiyuewa@163.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mhiramat@kernel.org \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=samitolvanen@google.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox