From: Greg Kroah-Hartman Date: Wed, 9 Mar 2022 22:44:10 +0000 (+0100) Subject: 5.15-stable patches X-Git-Tag: v4.9.306~26 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e8f3e3b3c82e7873c8c1d25fd264110ce9289d1f;p=thirdparty%2Fkernel%2Fstable-queue.git 5.15-stable patches added patches: arm64-do-not-include-__read_once-block-in-assembly-files.patch --- diff --git a/queue-5.15/arm64-do-not-include-__read_once-block-in-assembly-files.patch b/queue-5.15/arm64-do-not-include-__read_once-block-in-assembly-files.patch new file mode 100644 index 00000000000..f2a75e73eaf --- /dev/null +++ b/queue-5.15/arm64-do-not-include-__read_once-block-in-assembly-files.patch @@ -0,0 +1,71 @@ +From 52c9f93a9c482251cb0d224faa602ba26d462be8 Mon Sep 17 00:00:00 2001 +From: Nathan Chancellor +Date: Wed, 9 Mar 2022 12:16:34 -0700 +Subject: arm64: Do not include __READ_ONCE() block in assembly files + +From: Nathan Chancellor + +commit 52c9f93a9c482251cb0d224faa602ba26d462be8 upstream. + +When building arm64 defconfig + CONFIG_LTO_CLANG_{FULL,THIN}=y after +commit 558c303c9734 ("arm64: Mitigate spectre style branch history side +channels"), the following error occurs: + + :4:2: error: invalid fixup for movz/movk instruction + mov w0, #ARM_SMCCC_ARCH_WORKAROUND_3 + ^ + +Marc figured out that moving "#include " in +include/linux/arm-smccc.h into a !__ASSEMBLY__ block resolves it. The +full include chain with CONFIG_LTO=y from include/linux/arm-smccc.h: + +include/linux/init.h +include/linux/compiler.h +arch/arm64/include/asm/rwonce.h +arch/arm64/include/asm/alternative-macros.h +arch/arm64/include/asm/assembler.h + +The asm/alternative-macros.h include in asm/rwonce.h only happens when +CONFIG_LTO is set, which ultimately casues asm/assembler.h to be +included before the definition of ARM_SMCCC_ARCH_WORKAROUND_3. As a +result, the preprocessor does not expand ARM_SMCCC_ARCH_WORKAROUND_3 in +__mitigate_spectre_bhb_fw, which results in the error above. + +Avoid this problem by just avoiding the CONFIG_LTO=y __READ_ONCE() block +in asm/rwonce.h with assembly files, as nothing in that block is useful +to assembly files, which allows ARM_SMCCC_ARCH_WORKAROUND_3 to be +properly expanded with CONFIG_LTO=y builds. + +Fixes: e35123d83ee3 ("arm64: lto: Strengthen READ_ONCE() to acquire when CONFIG_LTO=y") +Cc: # 5.11.x +Link: https://lore.kernel.org/r/20220309155716.3988480-1-maz@kernel.org/ +Reported-by: Marc Zyngier +Acked-by: James Morse +Signed-off-by: Nathan Chancellor +Link: https://lore.kernel.org/r/20220309191633.2307110-1-nathan@kernel.org +Signed-off-by: Catalin Marinas +Signed-off-by: Greg Kroah-Hartman +--- + arch/arm64/include/asm/rwonce.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/arch/arm64/include/asm/rwonce.h ++++ b/arch/arm64/include/asm/rwonce.h +@@ -5,7 +5,7 @@ + #ifndef __ASM_RWONCE_H + #define __ASM_RWONCE_H + +-#ifdef CONFIG_LTO ++#if defined(CONFIG_LTO) && !defined(__ASSEMBLY__) + + #include + #include +@@ -66,7 +66,7 @@ + }) + + #endif /* !BUILD_VDSO */ +-#endif /* CONFIG_LTO */ ++#endif /* CONFIG_LTO && !__ASSEMBLY__ */ + + #include + diff --git a/queue-5.15/series b/queue-5.15/series index d86fc7f98c2..4df3f87fe93 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -43,3 +43,4 @@ slip-fix-macro-redefine-warning.patch block-drop-unused-includes-in-linux-genhd.h.patch arm-fix-co-processor-register-typo.patch arm-do-not-use-nocrossrefs-directive-with-ld.lld.patch +arm64-do-not-include-__read_once-block-in-assembly-files.patch