Re: [PATCH v1] ftrace: Fix compile error when CONFIG_GENDWARFKSYMS is enabled

From: Google
Date: Wed Feb 05 2025 - 23:17:25 EST


On Thu, 6 Feb 2025 11:23:02 +0800
Haiyue Wang <haiyuewa@xxxxxxx> wrote:

>
>
> On 2025/2/6 10:45, Masami Hiramatsu (Google) wrote:
> > On Wed, 5 Feb 2025 19:53:00 -0500
> > Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
> >
> >> On Thu, 6 Feb 2025 09:38:53 +0900
> >> Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx> wrote:
> >>
> >>> Thanks for the fix. And this fixes one of problems.
> >>> Another one is that `is_endbr()` is defined in <asm/ibt.h> but that also depend
> >>> on CONFIG_HAVE_FENTRY.
> >>>
> >>> Let's pick this and fix above issue.
> >>
> >> OK, I'll pull this into my urgent tree and start testing it.
> >
> > Sorry, Gabriel found another issue.
> > Let me fix this instead of this patch.
> >
> > https://lore.kernel.org/all/CAFEugPfFykYsHqS-J36CNWDn+d34bSQg-e5hJ=AaJPC8=6Ej-g@xxxxxxxxxxxxxx/
> >
>
> If I put the fix above '#ifndef __ASSEMBLY__', then I can reproduce
> Gabriel's founding:
>

Yeah, thanks. Anyway, I would not like introduce header file dependency
too much, especially header files under asm.
Please check below my fix;

https://lore.kernel.org/all/173881156244.211648.1242168038709680511.stgit@devnote2/

Thank you,

> +#ifdef CONFIG_X86_KERNEL_IBT
> +#include <linux/uaccess.h>
> +#endif
> +
> #ifndef __ASSEMBLY__
>
>
> In file included from ./include/linux/kcsan-checks.h:13,
> from ./include/linux/instrumented.h:12,
> from ./include/linux/uaccess.h:6,
> from ./arch/x86/include/asm/ftrace.h:26,
> from arch/x86/kernel/ftrace_64.S:11:
> ./include/linux/compiler_attributes.h:91:20: error: missing binary
> operator before token "("
> 91 | #if __has_attribute(__copy__)
> | ^
> ./include/linux/compiler_attributes.h:103:20: error: missing binary
> operator before token "("
> 103 | #if __has_attribute(__diagnose_as_builtin__)
> | ^
> ./include/linux/compiler_attributes.h:126:20: error: missing binary
> operator before token "("
> 126 | #if __has_attribute(__designated_init__)
> | ^
> ./include/linux/compiler_attributes.h:137:20: error: missing binary
> operator before token "("
> 137 | #if __has_attribute(__error__)
> | ^
>
>
> >>
> >> -- Steve
> >
> >
>


--
Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx>