From 26399219f0728df3fffca309fc050980b47373cb Mon Sep 17 00:00:00 2001 From: Todd Kjos Date: Sat, 1 Feb 2025 00:16:54 +0000 Subject: [PATCH] ANDROID: kernelci build-break for 64-bit riscv clang builds (5.4 only) No 64-bit riscv builds were working with clang (found via kernelci) for our 5.4 kernels: ld.lld: error: arch/riscv/built-in.a(kernel/signal.o):(function do_notify_resume: .text+0x30c): relocation R_RISCV_PCREL_HI20 out of range: 33554406 is not in [-524288, 524287]; references '__vdso_rt_sigreturn' >>> referenced by signal.c >>> defined in arch/riscv/built-in.a(kernel/vdso/vdso-syms.o) There are two ANDROID-specific patches that added global variables that must be reverted to fix the build: f06e9ec97955 ("BACKPORT: RISC-V: Stop relying on GCC's register allocator's hueristics") 3818981c3332 ("ANDROID: declare sp_in_global outside of CONFIG_FRAME_POINTER") Also, CONFIG_INIT_STACK_ALL_PATTERN must be disabled to avoid the relocation issues. These issues all seem to be fixed in 5.10 and later kernels. Bug: 393656515 Signed-off-by: Todd Kjos Change-Id: I0a5395a9767b94ec2291c9ef7e9a69f1f4665730 --- security/Kconfig.hardening | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/security/Kconfig.hardening b/security/Kconfig.hardening index b54eb7177a31..f149bf4f8540 100644 --- a/security/Kconfig.hardening +++ b/security/Kconfig.hardening @@ -37,8 +37,8 @@ config CC_HAS_AUTO_VAR_INIT_ZERO choice prompt "Initialize kernel stack variables at function entry" default GCC_PLUGIN_STRUCTLEAK_BYREF_ALL if COMPILE_TEST && GCC_PLUGINS - default INIT_STACK_ALL_PATTERN if COMPILE_TEST && CC_HAS_AUTO_VAR_INIT_PATTERN - default INIT_STACK_ALL_ZERO if CC_HAS_AUTO_VAR_INIT_ZERO + default INIT_STACK_ALL_PATTERN if COMPILE_TEST && CC_HAS_AUTO_VAR_INIT_PATTERN && !RISCV + default INIT_STACK_ALL_ZERO if CC_HAS_AUTO_VAR_INIT_ZERO && !RISCV default INIT_STACK_NONE help This option enables initialization of stack variables at