From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D8C50266F17; Tue, 8 Apr 2025 11:50:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744113033; cv=none; b=WcuRW9TA+xubQypX/8JeU5DCSucpkyaEdoGvcJ3fAVZ+ULA10+slHx20caURg0fu639mFIFl9XyqCJWOQqgFtwj6oRkOi/VcaYCN8PiGkxprNrg9ucVZy5oJJxSupzx3smb/+ATzdOXMLiP8x+XTmRol+wfCJkXq4jmG1sMPT60= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744113033; c=relaxed/simple; bh=tYzyPnA2+CcdEnAQcKysn567OEAMgPtSwOtd+OFvWAo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NFNZErjYxbeEOe7/7jVH7Fzv5AzSBRo9kyLE1/iiopApGpJcZH4SV94VMZwHb82+TY0PM8WpzzwZwwH28B/DZNCT6Noj+a2DHZAoYnKxI/eIs+ELI63n7qDHnw018vZPp2mYgYOhQp5HArLG6rWrjeD5Jk0Jx9/XBMx5R8ud+fo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=tgUxLvH9; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="tgUxLvH9" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 00042C4CEE5; Tue, 8 Apr 2025 11:50:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1744113033; bh=tYzyPnA2+CcdEnAQcKysn567OEAMgPtSwOtd+OFvWAo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tgUxLvH9o4Pn8zDpZySdLFqmtdj5cDSM1c+c1ItT3SxnXZDoFXEVwbIFcLA3ZDyxO RTw/UD2L372F40pxgn/NYiJRv6y8LM80D6H9ClhVUSEIxCdiz8uXi1+icWQ0dvry78 UZbMe/pz8X3X6GiXIsSG9CZtMfGkOFLuQEuSQ0GE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Kevin Loughlin , Ingo Molnar , Ard Biesheuvel , Tom Lendacky , Dave Hansen , Sasha Levin Subject: [PATCH 6.6 010/268] x86/sev: Add missing RIP_REL_REF() invocations during sme_enable() Date: Tue, 8 Apr 2025 12:47:01 +0200 Message-ID: <20250408104828.786916639@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250408104828.499967190@linuxfoundation.org> References: <20250408104828.499967190@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Kevin Loughlin [ Upstream commit 72dafb567760320f2de7447cd6e979bf9d4e5d17 ] The following 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(): 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: 1c811d403afd ("x86/sev: Fix position dependent variable references in startup code") Signed-off-by: Kevin Loughlin Signed-off-by: Ingo Molnar Reviewed-by: Ard Biesheuvel Reviewed-by: Tom Lendacky Cc: Dave Hansen Link: https://lore.kernel.org/r/20241122202322.977678-1-kevinloughlin@google.com Signed-off-by: Sasha Levin --- 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 cc47a818a640a..075899e3fc8a4 100644 --- a/arch/x86/mm/mem_encrypt_identity.c +++ b/arch/x86/mm/mem_encrypt_identity.c @@ -562,7 +562,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.39.5