From patchwork Thu Apr 30 23:01:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Mauro S. M. Rodrigues" X-Patchwork-Id: 1281022 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49CrVT2Qnwz9sTC for ; Fri, 1 May 2020 09:01:53 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 49CrVS1qtWzDrGG for ; Fri, 1 May 2020 09:01:52 +1000 (AEST) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=maurosr@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 49CrVF4mPrzDrC5 for ; Fri, 1 May 2020 09:01:40 +1000 (AEST) Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 03UMbGYl112470 for ; Thu, 30 Apr 2020 19:01:38 -0400 Received: from ppma02dal.us.ibm.com (a.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.10]) by mx0a-001b2d01.pphosted.com with ESMTP id 30r7md0gqf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 30 Apr 2020 19:01:38 -0400 Received: from pps.filterd (ppma02dal.us.ibm.com [127.0.0.1]) by ppma02dal.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id 03UN05fp010928 for ; Thu, 30 Apr 2020 23:01:37 GMT Received: from b01cxnp22035.gho.pok.ibm.com (b01cxnp22035.gho.pok.ibm.com [9.57.198.25]) by ppma02dal.us.ibm.com with ESMTP id 30mcu7dbu2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 30 Apr 2020 23:01:37 +0000 Received: from b01ledav005.gho.pok.ibm.com (b01ledav005.gho.pok.ibm.com [9.57.199.110]) by b01cxnp22035.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 03UN1a3x53477868 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 30 Apr 2020 23:01:36 GMT Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CEE4BAE062; Thu, 30 Apr 2020 23:01:36 +0000 (GMT) Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 61CF1AE05C; Thu, 30 Apr 2020 23:01:36 +0000 (GMT) Received: from localhost (unknown [9.85.142.167]) by b01ledav005.gho.pok.ibm.com (Postfix) with ESMTP; Thu, 30 Apr 2020 23:01:36 +0000 (GMT) From: "Mauro S. M. Rodrigues" To: skiboot@lists.ozlabs.org Date: Thu, 30 Apr 2020 20:01:28 -0300 Message-Id: <20200430230128.2242469-1-maurosr@linux.vnet.ibm.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.676 definitions=2020-04-30_13:2020-04-30, 2020-04-30 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxscore=0 bulkscore=0 lowpriorityscore=0 malwarescore=0 mlxlogscore=966 priorityscore=1501 suspectscore=3 clxscore=1015 phishscore=0 adultscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004300166 Subject: [Skiboot] [PATCH] libstb: Don't exit trustedboot services multiple times X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nayna@linux.ibm.com Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" For the very specific scenario when the fast-reboot is used, we see multiple error messages regarding the trusteboot measurements not being done. The way fast-reboot works is performing just fundamental operations, like PCI initialization, to get skiboot into good shape to boot kernel, and later the host's Kernel. That means fast-reboot contains data structures filled since last full reboot. In this process trustedboot is not re-initialized when, but it still tries to perform the STB measurements and event logging done in trustedboot_exit_services, showing multiple failure messages. This patch avoids that situation by returning earlier and logging that trustedboot already exited. If eventually something changes and trustedboot gets re-initialized during fast-reboot this patch also set boot_services_exited to false after every initialization so we always exit trustedboot whenever it get initialized. Signed-off-by: Mauro S. M. Rodrigues --- libstb/trustedboot.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git libstb/trustedboot.c libstb/trustedboot.c index 413862e639..b1f86cc709 100644 --- libstb/trustedboot.c +++ libstb/trustedboot.c @@ -116,6 +116,7 @@ void trustedboot_init(void) tpm_init(); trusted_init = true; + boot_services_exited = false; } int trustedboot_exit_boot_services(void) @@ -124,11 +125,15 @@ int trustedboot_exit_boot_services(void) int rc = 0; bool failed = false; - boot_services_exited = true; - if (!trusted_mode) goto out_free; + if (boot_services_exited) { + prlog(PR_WARNING, "Trusted boot services exited before.\n"); + goto out_free; + } + + boot_services_exited = true; #ifdef STB_DEBUG prlog(PR_NOTICE, "ev_separator.event: %s\n", ev_separator.event); prlog(PR_NOTICE, "ev_separator.sha1:\n");