Re: [PATCH] x86/stackprotector: fix build failure with CONFIG_STACKPROTECTOR=n
From: Borislav Petkov
Date: Tue Mar 11 2025 - 07:21:41 EST
On Tue, Mar 11, 2025 at 11:37:59AM +0100, Ard Biesheuvel wrote:
> There are many occurrences of
>
> ffffffff8373cb87: 49 c7 c6 20 c0 55 86 mov $0xffffffff8655c020,%r14
> ffffffff8373cb8a: R_X86_64_32S __ref_stack_chk_guard
>
> whereas the ordinary Clang uses R_X86_64_REX_GOTPCRELX here, which are
> relaxed by the linker.
>
> I suspect that Ubuntu's Clang 15 has some additional patches that
> trigger this behavior.
... and then we don't know what else out there does other "additional" patches
;-\
> We could add __no_stack_protector to __head to work around this.
Yap, that fixes the build:
diff --git a/arch/x86/include/asm/init.h b/arch/x86/include/asm/init.h
index 0e82ebc5d1e1..6cf4ea847dc3 100644
--- a/arch/x86/include/asm/init.h
+++ b/arch/x86/include/asm/init.h
@@ -2,7 +2,7 @@
#ifndef _ASM_X86_INIT_H
#define _ASM_X86_INIT_H
-#define __head __section(".head.text") __no_sanitize_undefined
+#define __head __section(".head.text") __no_sanitize_undefined __no_stack_protector
struct x86_mapping_info {
void *(*alloc_pgt_page)(void *); /* allocate buf for page table */
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette