On Thu, Mar 20, 2025 at 4:08 PM Ard Biesheuvel <ardb+git@xxxxxxxxxx> wrote: > > From: Ard Biesheuvel <ardb@xxxxxxxxxx> > > Ensure that __GENKSYMS__ is #define'd when passing asm/asm-prototypes.h > through the compiler to capture the exported symbols. This ensures that > exported symbols such as __ref_stack_chk_guard on x86, which is declared > conditionally, is visible to the tool. Why don't you make it unconditional, then? diff --git a/arch/x86/include/asm/asm-prototypes.h b/arch/x86/include/asm/asm-prototypes.h index 3674006e3974..9fc6f2be663c 100644 --- a/arch/x86/include/asm/asm-prototypes.h +++ b/arch/x86/include/asm/asm-prototypes.h @@ -20,6 +20,4 @@ extern void cmpxchg8b_emu(void); #endif -#if defined(__GENKSYMS__) && defined(CONFIG_STACKPROTECTOR) extern unsigned long __ref_stack_chk_guard; -#endif > > Otherwise, an error such as the below may be raised, breaking the build > when CONFIG_GENDWARFKSYMS=y > > <stdin>:4:15: error: use of undeclared identifier '__ref_stack_chk_guard' > > Cc: Sami Tolvanen <samitolvanen@xxxxxxxxxx> > Reported-by: syzbot+06fd1a3613c50d36129e@xxxxxxxxxxxxxxxxxxxxxxxxx > Signed-off-by: Ard Biesheuvel <ardb@xxxxxxxxxx> > --- > scripts/Makefile.build | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/scripts/Makefile.build b/scripts/Makefile.build > index 993708d11874..7855cdc4e763 100644 > --- a/scripts/Makefile.build > +++ b/scripts/Makefile.build > @@ -305,6 +305,7 @@ $(obj)/%.rs: $(obj)/%.rs.S FORCE > getasmexports = \ > { echo "\#include <linux/kernel.h>" ; \ > echo "\#include <linux/string.h>" ; \ > + echo "\#define __GENKSYMS__" ; \ > echo "\#include <asm/asm-prototypes.h>" ; \ > $(call getexportsymbols,EXPORT_SYMBOL(\1);) ; } > > -- > 2.49.0.rc1.451.g8f38331e32-goog > -- Best Regards Masahiro Yamada