From nobody Fri Dec 19 07:47:11 2025 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (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 419D11CAA1; Fri, 31 May 2024 01:32:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.177.32 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717119177; cv=none; b=F1SSas1/w3jBFKFNPTw1LJZevKtLLtcUZoJTIgXK97YzKmq4tt0A6GRTPBGlDHOZ1d5WPDCdZ9tCV6VsAxTgM9Oo8HebsDxY0MvUrmTXy37NwNgTjupn1j/B+K4XuxonqSrkqw2OW17yCYTKYDH7Z2pRo3SH28aKcge2ry7MQp8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717119177; c=relaxed/simple; bh=CN7eBmBXTXJPvGS7N6GOQgIUdnayv0Esh5cmFjk/YgY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=DcqmLnzwokMHxy37rr9JYd0urrdxBpD8hAmFuQulV3p1bQEiWxTB41qx+XC9hJSFsX15SyvqHeATdU4dmUIAjFNWt7wG9UiyrVk5btXsbn7C0TSTM2ITIcDgc9s4luKyVj4pif4CMiSeerv6kTpaF3y7UZMZehWLcfO4a7NVMuE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; arc=none smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 44UFUkdL019783; Fri, 31 May 2024 01:31:16 GMT DKIM-Signature: =?UTF-8?Q?v=3D1;_a=3Drsa-sha256;_c=3Drelaxed/relaxed;_d=3Doracle.com;_h?= =?UTF-8?Q?=3Dcc:content-transfer-encoding:date:from:in-reply-to:message-i?= =?UTF-8?Q?d:mime-version:references:subject:to;_s=3Dcorp-2023-11-20;_bh?= =?UTF-8?Q?=3DVTRcjWiMdtIkocYfDj+qafZlBmDr3DrOlPmCW6LWk+8=3D;_b=3DiI/GlbKF?= =?UTF-8?Q?gzwyNjntWd2V7fFW2V0BWZj6KR+wIhqU1ZKxNMtPj0vv+qVzbnZULeKeN9Rl_mB?= =?UTF-8?Q?mYg1xZwkCtlXXNBBTNqoCt00blPri3APNFrf3mPGwM+yudDB81aIeQM0FtS0hcR?= =?UTF-8?Q?hIw_P77vqODr5ym9hfiGBoYDMyCo01f2yRgPyE4ko8xyUvXgrsZ+FcJGOQLCn/I?= =?UTF-8?Q?guQ12wXmo_NGiTQLQrkQGn9Tyl8mcGMvSo46FtXuTI4ohoD7S4aXaHDlI4c8BGZ?= =?UTF-8?Q?AMwo7vqq1Qd0Y7B_dT83rL+PzEQecd4rrbgJuEwWHMlHIfuyunoBFttTw8DuR1a?= =?UTF-8?Q?QyWvJs8p2glSNbaYCWmMi_Ng=3D=3D_?= Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3yb8g9tc8q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 31 May 2024 01:31:16 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 44UNZUeE016232; Fri, 31 May 2024 01:31:15 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3yc50t97yw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 31 May 2024 01:31:15 +0000 Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 44V1SKNc027418; Fri, 31 May 2024 01:31:14 GMT Received: from bur-virt-x6-2-100.us.oracle.com (bur-virt-x6-2-100.us.oracle.com [10.153.92.40]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3yc50t96yw-13 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 31 May 2024 01:31:14 +0000 From: Ross Philipson To: linux-kernel@vger.kernel.org, x86@kernel.org, linux-integrity@vger.kernel.org, linux-doc@vger.kernel.org, linux-crypto@vger.kernel.org, kexec@lists.infradead.org, linux-efi@vger.kernel.org, iommu@lists.linux-foundation.org Cc: ross.philipson@oracle.com, dpsmith@apertussolutions.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, dave.hansen@linux.intel.com, ardb@kernel.org, mjg59@srcf.ucam.org, James.Bottomley@hansenpartnership.com, peterhuewe@gmx.de, jarkko@kernel.org, jgg@ziepe.ca, luto@amacapital.net, nivedita@alum.mit.edu, herbert@gondor.apana.org.au, davem@davemloft.net, corbet@lwn.net, ebiederm@xmission.com, dwmw2@infradead.org, baolu.lu@linux.intel.com, kanth.ghatraju@oracle.com, andrew.cooper3@citrix.com, trenchboot-devel@googlegroups.com Subject: [PATCH v9 12/19] reboot: Secure Launch SEXIT support on reboot paths Date: Thu, 30 May 2024 18:03:24 -0700 Message-Id: <20240531010331.134441-13-ross.philipson@oracle.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240531010331.134441-1-ross.philipson@oracle.com> References: <20240531010331.134441-1-ross.philipson@oracle.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.12.28.16 definitions=2024-05-30_21,2024-05-30_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 spamscore=0 suspectscore=0 adultscore=0 phishscore=0 malwarescore=0 mlxlogscore=999 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2405310010 X-Proofpoint-GUID: Nd163jMZw4UVfc6zriImZ4AYhUZFCaOA X-Proofpoint-ORIG-GUID: Nd163jMZw4UVfc6zriImZ4AYhUZFCaOA Content-Type: text/plain; charset="utf-8" If the MLE kernel is being powered off, rebooted or halted, then SEXIT must be called. Note that the SEXIT GETSEC leaf can only be called after a machine_shutdown() has been done on these paths. The machine_shutdown() is not called on a few paths like when poweroff action does not have a poweroff callback (into ACPI code) or when an emergency reset is done. In these cases, just the TXT registers are finalized but SEXIT is skipped. Signed-off-by: Ross Philipson --- arch/x86/kernel/reboot.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c index f3130f762784..66060fdb0822 100644 --- a/arch/x86/kernel/reboot.c +++ b/arch/x86/kernel/reboot.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -766,6 +767,7 @@ static void native_machine_restart(char *__unused) =20 if (!reboot_force) machine_shutdown(); + slaunch_finalize(!reboot_force); __machine_emergency_restart(0); } =20 @@ -776,6 +778,9 @@ static void native_machine_halt(void) =20 tboot_shutdown(TB_SHUTDOWN_HALT); =20 + /* SEXIT done after machine_shutdown() to meet TXT requirements */ + slaunch_finalize(1); + stop_this_cpu(NULL); } =20 @@ -784,8 +789,12 @@ static void native_machine_power_off(void) if (kernel_can_power_off()) { if (!reboot_force) machine_shutdown(); + slaunch_finalize(!reboot_force); do_kernel_power_off(); + } else { + slaunch_finalize(0); } + /* A fallback in case there is no PM info available */ tboot_shutdown(TB_SHUTDOWN_HALT); } @@ -813,6 +822,7 @@ void machine_shutdown(void) =20 void machine_emergency_restart(void) { + slaunch_finalize(0); __machine_emergency_restart(1); } =20 --=20 2.39.3