Skip to content

Commit 72dafb5

Browse files
kevinloughlinIngo Molnar
authored andcommitted
x86/sev: Add missing RIP_REL_REF() invocations during sme_enable()
The following commit: 1c811d4 ("x86/sev: Fix position dependent variable references in startup code") introduced RIP_REL_REF() to force RIP-relative accesses to global variables, as needed to prevent crashes during early SEV/SME startup code. For completeness, RIP_REL_REF() should be used with additional variables during sme_enable(): https://lore.kernel.org/all/CAMj1kXHnA0fJu6zh634=fbJswp59kSRAbhW+ubDGj1+NYwZJ-Q@mail.gmail.com/ Access these vars with RIP_REL_REF() to prevent problem reoccurence. Fixes: 1c811d4 ("x86/sev: Fix position dependent variable references in startup code") Signed-off-by: Kevin Loughlin <kevinloughlin@google.com> Signed-off-by: Ingo Molnar <mingo@kernel.org> Reviewed-by: Ard Biesheuvel <ardb@kernel.org> Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com> Cc: Dave Hansen <dave.hansen@linux.intel.com> Link: https://lore.kernel.org/r/20241122202322.977678-1-kevinloughlin@google.com
1 parent d082ecb commit 72dafb5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/x86/mm/mem_encrypt_identity.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ void __head sme_enable(struct boot_params *bp)
565565
}
566566

567567
RIP_REL_REF(sme_me_mask) = me_mask;
568-
physical_mask &= ~me_mask;
569-
cc_vendor = CC_VENDOR_AMD;
568+
RIP_REL_REF(physical_mask) &= ~me_mask;
569+
RIP_REL_REF(cc_vendor) = CC_VENDOR_AMD;
570570
cc_set_mask(me_mask);
571571
}

0 commit comments

Comments
 (0)