[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CABCJKucW0HU_TVwe6sdn8B-Cu7Jn-M61i1VoBjJYqQkoxQtTxg@mail.gmail.com>
Date: Wed, 5 Feb 2025 10:51:17 -0800
From: Sami Tolvanen <samitolvanen@...gle.com>
To: Haiyue Wang <haiyuewa@....com>
Cc: x86@...nel.org, linux-trace-kernel@...r.kernel.org,
Steven Rostedt <rostedt@...dmis.org>, Masami Hiramatsu <mhiramat@...nel.org>,
Mark Rutland <mark.rutland@....com>, Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>, "H. Peter Anvin" <hpa@...or.com>,
"open list:FUNCTION HOOKS (FTRACE)" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v1] ftrace: Fix compile error when CONFIG_GENDWARFKSYMS is enabled
Hi,
On Wed, Feb 5, 2025 at 10:02 AM Haiyue Wang <haiyuewa@....com> wrote:
>
> 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@....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
Thanks for the patch! This looks correct to me, and I confirmed that
it fixes the build issue. Feel free to add:
Reviewed-by: Sami Tolvanen <samitolvanen@...gle.com>
Tested-by: Sami Tolvanen <samitolvanen@...gle.com>
Sami
Powered by blists - more mailing lists