Received: by 2002:a05:6500:2018:b0:1fb:9675:f89d with SMTP id t24csp163444lqh; Thu, 30 May 2024 18:35:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVBHjt8UTHvx1g7Yoqa78+/cREAb7P20ZWYFWcoY6Y24+voS86RO4AbLZeHrj223HG8Az8gOEB45Mlp4p4SEo0oyFz3SqPo1YuC/XH0Ww== X-Google-Smtp-Source: AGHT+IFEOldClXyDpKzjAW8dymT495Q9tdjfYogTwPqRxtK1mmffiLKqNZvfEJ3MaW7kOuIA3uTN X-Received: by 2002:a05:6359:4d09:b0:199:42c8:389b with SMTP id e5c5f4694b2df-19b48d7f45amr74786955d.11.1717119341303; Thu, 30 May 2024 18:35:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717119341; cv=pass; d=google.com; s=arc-20160816; b=ylEGWV4tLs4dN8nVdBucsV99Txsyitf1hPGBYw/BSfj4M6m5d0c8S1CFJ9bxDiaNdn jqf2yu8JuNE5XdIxHBnVwjlrb8v1OvOcJ9yKlb8LgpaI1toI6eefs5SD1tPwilEJd/MA VDGMpOM0x2lZGRsGUUaBs0g2y47m1BUHsL0WfN+1oTlDHnghSGj77uWPrlE8NxVDrJAe HwPxbAqrr5wrwdFY78dpEljYWFDcqV5so5Ej4gif5nMGgmZaJ5zfUmcKtaL0TnMsGihr A5BoCfdeitqAq1f8HmfWLyRopw0p/Ay4bVcHb5N5iux21A4mdNYDbo47oY3ytpt27tzE caWg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=VTRcjWiMdtIkocYfDj+qafZlBmDr3DrOlPmCW6LWk+8=; fh=ksrYNUbdo9+K4DYOCXVji8cRdTI1C1SaRA8HdvQyCiA=; b=MlwpAwHs812yFwfZw6hEhltXuVP7QViOITP1cL9FwMnta1xdTDuY0s3oiHKib0x6iJ cbyd3Jj6XlYueoq7J3vXGzM1BSVzFzK5Tln8LjFRGBXUJ0MKBgcIE2YfE/CRhO9J+Tbm MIR/IAsa58g8tcx38PSC6+5uwNfD78uCmVi+tMqcYB7DezYoU2I7nGArqbJfqeTw+4tu ZSmWMLlDZKI5seGK03XXgHf8FeijI1MxW7yJEXlwkkHhaLeKpoiS6PqurZRDjArptNJS MSn6QL4jo8sbVElWJP405CFxWAC/u5TrkJ99NqJxUSQxsY087Asct4oUZUxpRkWYM49G npaA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=neutral (bad format) header.i=@oracle.com; arc=pass (i=1 spf=pass spfdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-crypto+bounces-4556-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-crypto+bounces-4556-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=oracle.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-6c35d9732f8si570584a12.850.2024.05.30.18.35.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 18:35:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto+bounces-4556-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=neutral (bad format) header.i=@oracle.com; arc=pass (i=1 spf=pass spfdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-crypto+bounces-4556-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-crypto+bounces-4556-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=oracle.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 44CAC288F43 for ; Fri, 31 May 2024 01:35:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 04D4274042; Fri, 31 May 2024 01:32:58 +0000 (UTC) X-Original-To: linux-crypto@vger.kernel.org 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-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 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) if (!reboot_force) machine_shutdown(); + slaunch_finalize(!reboot_force); __machine_emergency_restart(0); } @@ -776,6 +778,9 @@ static void native_machine_halt(void) tboot_shutdown(TB_SHUTDOWN_HALT); + /* SEXIT done after machine_shutdown() to meet TXT requirements */ + slaunch_finalize(1); + stop_this_cpu(NULL); } @@ -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) void machine_emergency_restart(void) { + slaunch_finalize(0); __machine_emergency_restart(1); } -- 2.39.3