diff options
author | Tom Lendacky <thomas.lendacky@amd.com> | 2022-08-23 16:55:51 -0500 |
---|---|---|
committer | Borislav Petkov <bp@suse.de> | 2022-08-24 09:54:32 +0200 |
commit | cdaa0a407f1acd3a44861e3aea6e3c7349e668f1 (patch) | |
tree | 2d6f7614d0bd40804ffe6ffa2b860774f13781ac /arch/x86/include | |
parent | 4b1c742407571eff58b6de9881889f7ca7c4b4dc (diff) | |
download | linux-cdaa0a407f1acd3a44861e3aea6e3c7349e668f1.tar.bz2 |
x86/sev: Don't use cc_platform_has() for early SEV-SNP calls
When running identity-mapped and depending on the kernel configuration,
it is possible that the compiler uses jump tables when generating code
for cc_platform_has().
This causes a boot failure because the jump table uses un-mapped kernel
virtual addresses, not identity-mapped addresses. This has been seen
with CONFIG_RETPOLINE=n.
Similar to sme_encrypt_kernel(), use an open-coded direct check for the
status of SNP rather than trying to eliminate the jump table. This
preserves any code optimization in cc_platform_has() that can be useful
post boot. It also limits the changes to SEV-specific files so that
future compiler features won't necessarily require possible build changes
just because they are not compatible with running identity-mapped.
[ bp: Massage commit message. ]
Fixes: 5e5ccff60a29 ("x86/sev: Add helper for validating pages in early enc attribute changes")
Reported-by: Sean Christopherson <seanjc@google.com>
Suggested-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: <stable@vger.kernel.org> # 5.19.x
Link: https://lore.kernel.org/all/YqfabnTRxFSM+LoX@google.com/
Diffstat (limited to 'arch/x86/include')
0 files changed, 0 insertions, 0 deletions