From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dl1-f74.google.com (mail-dl1-f74.google.com [74.125.82.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 668A344A706 for ; Thu, 26 Feb 2026 19:16:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772133377; cv=none; b=jiqBm+VYisAhx1TUl9hX1y3LTrmwq4OkrlY9a33fbcIDiY6ocEXEpDLd5p7pY2TLWTWlRSqEiY+Y4l2ZtjWfOo6mlX+kK2QTccdKE7ovSONubNMPxq4RhseacIbWcvgHB6FWZKn1fQtrE6u5bK9g62xRwUZ8ZEH+TG0ZF2S0IH8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772133377; c=relaxed/simple; bh=JMjBt5u7sej4DVzjxYdLv0Tmsl1bwwrLjR+ZWFoIyvU=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=aP/GAZHPHEJBvhf2tPnUFmfhx2BJ8V+nzd74958kYTuBHtAoF8ku1pn4ggnV4IUllxTzuXucdx/TXLzXsNqXu+4vP15PDIi3KPSWuCUsGtddw5P1iJ1thiSuA6xrEH+WAcUp1SihkrWQBLTuNJxM2qLc8tQ38C9o4NoC+tpA1OI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--changyuanl.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=Ew7Gpeoe; arc=none smtp.client-ip=74.125.82.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--changyuanl.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Ew7Gpeoe" Received: by mail-dl1-f74.google.com with SMTP id a92af1059eb24-12711967e0eso1669272c88.0 for ; Thu, 26 Feb 2026 11:16:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1772133375; x=1772738175; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=M6cgohktuZOIcDY88c+OYINW8j5SU2uouqkoEf/gCYY=; b=Ew7GpeoehlNqL1QTapNeXns3w3vWN7Y1uKLo0mQjbl8ITg+AWLdtka0PvGV4blo24L J/rMhGpD3Lvx7d0xp43kXpR42ZU8lbp2OgVtn1yP3QJZZgaj5ffl/VOafHr9eGZS0a5c hthIzD1Haize+dtoAh7Xwjqpkqhp+c7YjZjT1e3HfiU8Xifbl8ZqkJxNYueZ41bZoqpE 6nycej0A1UHpJuN80SMQry1flH3NfCIIzuGg6t5HxPWDpB9MgxAzWHBqCOeEZX19zTbU SSfSPWKg7rfiwB59Kdx/kNY9xNscvtd1S0qe4WWW2e+SzPcZwLMkpbbQRY1VkHZjh0Xa WSpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772133375; x=1772738175; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=M6cgohktuZOIcDY88c+OYINW8j5SU2uouqkoEf/gCYY=; b=FeWl/VD5udev7o3+461kCvt7xpGsGrATqoW5Y9SIDjQSMxJj7AkwajJtgzR5LR5W7c e/Q38D62VMMULXB67IMHliqgeKQ3d2g6bf7D0H43ofOgjCwvXDi5qJGynoZ/1Gxmb1EY qhRbSZ8yukaD7Dkj4QSGMbuyKVrpAfeqsu9oBs7JJX3UVmcKCdwwosGfz5U2AlYmXYDK Ojc0DbIhzCa2b0JpYCcE1KM/TF/ow6I0+I0ga/e6EX0EqG9vHxsH2kh3g/ydOx96UFFP KxwvUW6Hqb/+veJn1PRzb04ZOsdAZRGePm3TCjVH3HbXThjN2gFGiCa6eqWli+TqLbeK jYKQ== X-Forwarded-Encrypted: i=1; AJvYcCVr0f8tOqI0nm90oIhjHsLVS+04Dk7arXGYohj5fDzseDeiPm82uwp9zcA+EH+Bu6i+n0ccoi7zFOc7s7w=@vger.kernel.org X-Gm-Message-State: AOJu0Yx+3Bfp4mm7uN6AHTZw22adGl+KHUUYsrK/uVYpygnv3PCfn/mE oikA+o16Xye6p95xJGKVbiP9CbhOgddFV+d6eUeZGY2NcdPzXKoSqALVnvrgB5QtivhZykgmqf0 F/CQKhXPwkifaS8svZH4yGg== X-Received: from dlbqc5.prod.google.com ([2002:a05:7023:a85:b0:127:5503:dc9e]) (user=changyuanl job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7022:b97:b0:11b:9b98:aa4b with SMTP id a92af1059eb24-1278fb6859cmr37260c88.6.1772133375223; Thu, 26 Feb 2026 11:16:15 -0800 (PST) Date: Thu, 26 Feb 2026 11:16:11 -0800 In-Reply-To: <5648b7de5b0a5d0dfef3785f9582b718678c6448.1770217260.git.thomas.lendacky@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <5648b7de5b0a5d0dfef3785f9582b718678c6448.1770217260.git.thomas.lendacky@amd.com> X-Mailer: git-send-email 2.53.0.473.g4a7958ca14-goog Message-ID: <20260226191612.1962381-1-changyuanl@google.com> Subject: Re: [PATCH] x86/boot/sev: Move SEV decompressor variables into the .data section From: Changyuan Lyu To: thomas.lendacky@amd.com Cc: ardb@kernel.org, bp@alien8.de, dave.hansen@linux.intel.com, kevinhui@meta.com, linux-kernel@vger.kernel.org, mingo@redhat.com, stable@vger.kernel.org, tglx@linutronix.de, x86@kernel.org, Changyuan Lyu Content-Type: text/plain; charset="UTF-8" On Wed, 4 Feb 2026 09:01:00 -0600, Tom Lendacky wrote > As part of the work to remove the dependency on calling into the > decompressor code (startup_64()) for a UEFI boot, a call to rmpadjust() > was removed from sev_enable() in favor of checking the value of the > snp_vmpl variable. When booting through a non-UEFI path and calling > startup_64(), the call to sev_enable() is performed before the BSS section > is zeroed. With the removal of the rmpadjust() call and the corresponding > check of the return code, the snp_vmpl variable is checked. Since the > kernel is running at VMPL0, the snp_vmpl variable will not have been set > and should be the default value of 0. However, since the call occurs > before the BSS is zeroed, the snp_vmpl variable may not actually be zero, > which will cause the guest boot to fail. > > Since the decompressor relocates itself, the BSS would need to be cleared > both before and after the relocation, but this would, in effect, cause all > of the changes to BSS variables before relocation to be lost after > relocation. > > Instead, move the snp_vmpl variable into the .data section so that it is > initialized and the value made safe during relocation. As a pre-caution > against future changes, move other SEV-related decompressor variables into > the .data section, too. > > Fixes: 68a501d7fd82 ("x86/boot: Drop redundant RMPADJUST in SEV SVSM presence check") > Cc: stable@vger.kernel.org > Cc: Ard Biesheuvel > Tested-by: Kevin Hui > Signed-off-by: Tom Lendacky Reviewed-by: Changyuan Lyu > [...]