From: Kevin Loughlin <kevinloughlin@google.com>
To: ardb@kernel.org
Cc: ardb+git@google.com, bp@alien8.de, kevinloughlin@google.com,
kirill.shutemov@linux.intel.com, sidtelang@google.com,
pgonda@google.com, thomas.lendacky@amd.com, x86@kernel.org,
stable@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2] x86/sev: Add missing RIP_REL_REF() invocations during sme_enable()
Date: Fri, 22 Nov 2024 20:23:22 +0000 [thread overview]
Message-ID: <20241122202322.977678-1-kevinloughlin@google.com> (raw)
commit 1c811d403afd ("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() [0].
Access these vars with RIP_REL_REF() to prevent problem reoccurence.
[0] https://lore.kernel.org/all/CAMj1kXHnA0fJu6zh634=fbJswp59kSRAbhW+ubDGj1+NYwZJ-Q@mail.gmail.com/
Fixes: 1c811d403afd ("x86/sev: Fix position dependent variable references in startup code")
Signed-off-by: Kevin Loughlin <kevinloughlin@google.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
---
v1 -> v2: Fix typo in commit message, add Ard's and Tom's "Reviewed-by"
arch/x86/mm/mem_encrypt_identity.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/mm/mem_encrypt_identity.c b/arch/x86/mm/mem_encrypt_identity.c
index e6c7686f443a..9fce5b87b8c5 100644
--- a/arch/x86/mm/mem_encrypt_identity.c
+++ b/arch/x86/mm/mem_encrypt_identity.c
@@ -565,7 +565,7 @@ void __head sme_enable(struct boot_params *bp)
}
RIP_REL_REF(sme_me_mask) = me_mask;
- physical_mask &= ~me_mask;
- cc_vendor = CC_VENDOR_AMD;
+ RIP_REL_REF(physical_mask) &= ~me_mask;
+ RIP_REL_REF(cc_vendor) = CC_VENDOR_AMD;
cc_set_mask(me_mask);
}
--
2.47.0.371.ga323438b13-goog
next reply other threads:[~2024-11-22 20:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-22 20:23 Kevin Loughlin [this message]
2024-11-25 2:40 ` [PATCH v2] x86/sev: Add missing RIP_REL_REF() invocations during sme_enable() kernel test robot
2025-02-27 22:16 ` [tip: x86/sev] " tip-bot2 for Kevin Loughlin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241122202322.977678-1-kevinloughlin@google.com \
--to=kevinloughlin@google.com \
--cc=ardb+git@google.com \
--cc=ardb@kernel.org \
--cc=bp@alien8.de \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pgonda@google.com \
--cc=sidtelang@google.com \
--cc=stable@vger.kernel.org \
--cc=thomas.lendacky@amd.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.