Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp387079pxk; Thu, 24 Sep 2020 08:01:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwidgX/RawPqDt60LQiSJlw2rcivjrRFpjHfPzv1UEJrq0rukj4Id4G3b1OFcR51o5rl1R+ X-Received: by 2002:a17:906:1192:: with SMTP id n18mr272545eja.515.1600959671022; Thu, 24 Sep 2020 08:01:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600959671; cv=none; d=google.com; s=arc-20160816; b=jVlv8mf4NgAia7FFklQPyEPMZRCJlnBLB4csysCMBqvwQfAdTPXK6Bj0wuvPvYO1G8 Vm3wHB+00aqVej0khQX2OlJapWYHRoIDY7edCyQkYh7ESe+NQeIGM4i3Dd+qNjEj7mpM sVF8ZfAYt7QLgDu/dN7N4+vUSITLEevP6miB1UijaVm1ME5UHJ9rApQ8ZpjCcMhnex6D dpzgrcJSBKlJGZFVDD2mOSW5gAiCmnUbGdU8bTVlsQTgk0Lu42qGilExdONoH88kHfRB vLGQiZyvfInxSumrLR4Bx3u7cLwpFkIawV+CJZ7CGjJuDEretTAHdL28kod8gqq4lMRn W83A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=uC5h3cusDAhwlGCCvDkY2qHUOCSMEHI64B7ZwPT8TG8=; b=TLyym1uDMUwVGXRkxpemFYcEt9k/C7BNQ3wzddygJ3h+zwWPpiHO7GtuEeBARg3ify xSzIHiSded9FdH/OpwJ0/7ZaXQ4uAkBY/JdQtF5NxV9k2/od1jgen72VhVDL++VwtkMJ ljaMLf8Z93lQ1ePsVrEr8NuntgtQiPmVcE8+dHdpw6K1KNR4LRFamhHpb3odb6NDrQ4w J7DYAYZU7yVJC2njTcTMWeQeDsxoMCKvUiJQuYcWMgVgWoegyA2YOycjF5NPHnFtbmuj VwFOy1XxHTsRskKK8v0hF6zvQJhwl91TgpAX6yG70wsjk6yoddOC6HxG+rOXJam+Oa+r DK/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=d+wrP197; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qx20si2151159ejb.469.2020.09.24.08.00.46; Thu, 24 Sep 2020 08:01:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=d+wrP197; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728480AbgIXO65 (ORCPT + 99 others); Thu, 24 Sep 2020 10:58:57 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:56014 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728443AbgIXO6o (ORCPT ); Thu, 24 Sep 2020 10:58:44 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 08OEtG6L037473; Thu, 24 Sep 2020 14:58:21 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2020-01-29; bh=uC5h3cusDAhwlGCCvDkY2qHUOCSMEHI64B7ZwPT8TG8=; b=d+wrP197JkSZeRU0ToJp4H5+e6NWuYpPGyv2FArOWMjRkndnYgJV7ORSXccE/WIUlGcH 8hVZluIa8OQi2BUw0ncvdXwOIGC1/KIAJtueXBrq1oax/V30xNIaiTAVaH3vb0eHbilu 7OeNlR1S76VsssfLFC3+CRjcWn8wT95rvQJ+W20OHVfNcYY21Dbknnjg4lu9rjLEpOw0 mrPYqPjKIuWhaSqbY/f6q596YEXV20krNV+Aub72LjzSDhWxgfwI/JQfPTPQARlxJBlg KnMFElffySZ/plRPzlfNh+AWXmhzUBevrEFDg5hbHUB7zwGLeh9mVx9wVuvxR7KrHLEk Bw== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2120.oracle.com with ESMTP id 33q5rgq58e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 24 Sep 2020 14:58:21 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 08OEuSQg126153; Thu, 24 Sep 2020 14:58:21 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3030.oracle.com with ESMTP id 33nujr18ff-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 24 Sep 2020 14:58:21 +0000 Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 08OEwIFX000856; Thu, 24 Sep 2020 14:58:18 GMT Received: from disposition.us.oracle.com (/10.152.32.81) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 24 Sep 2020 07:58:18 -0700 From: Ross Philipson To: linux-kernel@vger.kernel.org, x86@kernel.org, iommu@lists.linux-foundation.org, linux-integrity@vger.kernel.org, linux-doc@vger.kernel.org Cc: ross.philipson@oracle.com, dpsmith@apertussolutions.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, luto@amacapital.net, trenchboot-devel@googlegroups.com Subject: [PATCH 12/13] reboot: Secure Launch SEXIT support on reboot paths Date: Thu, 24 Sep 2020 10:58:40 -0400 Message-Id: <1600959521-24158-13-git-send-email-ross.philipson@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1600959521-24158-1-git-send-email-ross.philipson@oracle.com> References: <1600959521-24158-1-git-send-email-ross.philipson@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9753 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 malwarescore=0 mlxlogscore=999 phishscore=0 adultscore=0 spamscore=0 suspectscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2009240114 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9753 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 impostorscore=0 clxscore=1015 suspectscore=0 phishscore=0 malwarescore=0 priorityscore=1501 mlxlogscore=999 adultscore=0 bulkscore=0 mlxscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2009240114 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 a515e2d..90d0647 100644 --- a/arch/x86/kernel/reboot.c +++ b/arch/x86/kernel/reboot.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -732,6 +733,7 @@ static void native_machine_restart(char *__unused) if (!reboot_force) machine_shutdown(); + slaunch_finalize(!reboot_force); __machine_emergency_restart(0); } @@ -742,6 +744,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); } @@ -750,8 +755,12 @@ static void native_machine_power_off(void) if (pm_power_off) { if (!reboot_force) machine_shutdown(); + slaunch_finalize(!reboot_force); pm_power_off(); + } else { + slaunch_finalize(0); } + /* A fallback in case there is no PM info available */ tboot_shutdown(TB_SHUTDOWN_HALT); } @@ -779,6 +788,7 @@ void machine_shutdown(void) void machine_emergency_restart(void) { + slaunch_finalize(0); __machine_emergency_restart(1); } -- 1.8.3.1