[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <169165870802.27769.15353947574704602257.tip-bot2@tip-bot2>
Date: Thu, 10 Aug 2023 09:11:48 -0000
From: "tip-bot2 for Nick Desaulniers" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Nathan Chancellor <nathan@...nel.org>,
Daniel Kolesa <daniel@...aforge.org>,
Naresh Kamboju <naresh.kamboju@...aro.org>,
Sven Volkinsfeld <thyrc@....net>,
Nick Desaulniers <ndesaulniers@...gle.com>,
"Borislav Petkov (AMD)" <bp@...en8.de>, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: [tip: x86/bugs] x86/srso: Fix build breakage with the LLVM linker
The following commit has been merged into the x86/bugs branch of tip:
Commit-ID: cbe8ded48b939b9d55d2c5589ab56caa7b530709
Gitweb: https://git.kernel.org/tip/cbe8ded48b939b9d55d2c5589ab56caa7b530709
Author: Nick Desaulniers <ndesaulniers@...gle.com>
AuthorDate: Wed, 09 Aug 2023 09:40:26 -07:00
Committer: Borislav Petkov (AMD) <bp@...en8.de>
CommitterDate: Thu, 10 Aug 2023 11:03:12 +02:00
x86/srso: Fix build breakage with the LLVM linker
The assertion added to verify the difference in bits set of the
addresses of srso_untrain_ret_alias() and srso_safe_ret_alias() would fail
to link in LLVM's ld.lld linker with the following error:
ld.lld: error: ./arch/x86/kernel/vmlinux.lds:210: at least one side of
the expression must be absolute
ld.lld: error: ./arch/x86/kernel/vmlinux.lds:211: at least one side of
the expression must be absolute
Use ABSOLUTE to evaluate the expression referring to at least one of the
symbols so that LLD can evaluate the linker script.
Also, add linker version info to the comment about XOR being unsupported
in either ld.bfd or ld.lld until somewhat recently.
Fixes: fb3bd914b3ec ("x86/srso: Add a Speculative RAS Overflow mitigation")
Closes: https://lore.kernel.org/llvm/CA+G9fYsdUeNu-gwbs0+T6XHi4hYYk=Y9725-wFhZ7gJMspLDRA@mail.gmail.com/
Reported-by: Nathan Chancellor <nathan@...nel.org>
Reported-by: Daniel Kolesa <daniel@...aforge.org>
Reported-by: Naresh Kamboju <naresh.kamboju@...aro.org>
Suggested-by: Sven Volkinsfeld <thyrc@....net>
Signed-off-by: Nick Desaulniers <ndesaulniers@...gle.com>
Signed-off-by: Borislav Petkov (AMD) <bp@...en8.de>
Link: https://github.com/ClangBuiltLinux/linux/issues/1907
Link: https://lore.kernel.org/r/20230809-gds-v1-1-eaac90b0cbcc@google.com
---
arch/x86/kernel/vmlinux.lds.S | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
index e768132..ef06211 100644
--- a/arch/x86/kernel/vmlinux.lds.S
+++ b/arch/x86/kernel/vmlinux.lds.S
@@ -529,11 +529,17 @@ INIT_PER_CPU(irq_stack_backing_store);
#ifdef CONFIG_CPU_SRSO
/*
- * GNU ld cannot do XOR so do: (A | B) - (A & B) in order to compute the XOR
+ * GNU ld cannot do XOR until 2.41.
+ * https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=f6f78318fca803c4907fb8d7f6ded8295f1947b1
+ *
+ * LLVM lld cannot do XOR until lld-17.
+ * https://github.com/llvm/llvm-project/commit/fae96104d4378166cbe5c875ef8ed808a356f3fb
+ *
+ * Instead do: (A | B) - (A & B) in order to compute the XOR
* of the two function addresses:
*/
-. = ASSERT(((srso_untrain_ret_alias | srso_safe_ret_alias) -
- (srso_untrain_ret_alias & srso_safe_ret_alias)) == ((1 << 2) | (1 << 8) | (1 << 14) | (1 << 20)),
+. = ASSERT(((ABSOLUTE(srso_untrain_ret_alias) | srso_safe_ret_alias) -
+ (ABSOLUTE(srso_untrain_ret_alias) & srso_safe_ret_alias)) == ((1 << 2) | (1 << 8) | (1 << 14) | (1 << 20)),
"SRSO function pair won't alias");
#endif
Powered by blists - more mailing lists