[PATCH] x86: Let AS_WRUSS depend on X86_64

From: Jiri Slaby (SUSE)
Date: Tue Oct 31 2023 - 06:21:21 EST


Since commit 18e66b695e78 ("x86/shstk: Add Kconfig option for shadow
stack"), AS_WRUSS is set even in 32-bit .configs. It is due to how
Kbuild works. .config is not considered during make oldconfig (and other
make *config), so standard (64-bit) gcc is invoked from 'as-instr'
Kbuild tests. And such gcc indeed reports that wruss is supported, so
AS_WRUSS=y is set.

Provided the wruss instruction is 64-bit only (and used in pure 64-bit
X86_USER_SHADOW_STACK), it has little sense to have AS_WRUSS=y set on
32-bit.

Therefore, make the whole test dependent on X86_64 to ensure it's set
only on 64-bit.

Signed-off-by: Jiri Slaby (SUSE) <jirislaby@xxxxxxxxxx>
Cc: Yu-cheng Yu <yu-cheng.yu@xxxxxxxxx>
Cc: Rick Edgecombe <rick.p.edgecombe@xxxxxxxxx>
Cc: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
Cc: Borislav Petkov (AMD) <bp@xxxxxxxxx>
Cc: Kees Cook <keescook@xxxxxxxxxxxx>
Cc: Mike Rapoport (IBM) <rppt@xxxxxxxxxx>
Cc: Pengfei Xu <pengfei.xu@xxxxxxxxx>
Cc: John Allen <john.allen@xxxxxxx>
Cc: Kees Cook <keescook@xxxxxxxxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxxxxx>
Cc: "H. Peter Anvin" <hpa@xxxxxxxxx>
Cc: x86@xxxxxxxxxx
---
arch/x86/Kconfig.assembler | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/x86/Kconfig.assembler b/arch/x86/Kconfig.assembler
index 8ad41da301e5..a5b5241711e3 100644
--- a/arch/x86/Kconfig.assembler
+++ b/arch/x86/Kconfig.assembler
@@ -27,5 +27,6 @@ config AS_GFNI

config AS_WRUSS
def_bool $(as-instr,wrussq %rax$(comma)(%rbx))
+ depends on X86_64
help
Supported by binutils >= 2.31 and LLVM integrated assembler
--
2.42.0