Message ID | 20230120074306.1326298-2-ajd@linux.ibm.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp65398wrn; Thu, 19 Jan 2023 23:44:17 -0800 (PST) X-Google-Smtp-Source: AMrXdXuiS2Id+7wM9BlOWfs/r14o73ELvHdxvwtSVh/ClEFeSu1gzg+I4OXo/+sYBKcHbiWwO0Z4 X-Received: by 2002:a17:90a:6e4a:b0:223:f234:6a3 with SMTP id s10-20020a17090a6e4a00b00223f23406a3mr13826669pjm.49.1674200657372; Thu, 19 Jan 2023 23:44:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674200657; cv=none; d=google.com; s=arc-20160816; b=YkdwxzWabFMmm1Lb6iOTe734hZs1F7ZHD2dzrZPPjd26P5YW6nMWcDSdTsMsEwEo+e K47QVeNhcLvXqITbREF2EmZOqlrmzglhYyXShDT2QxLPOqzMJndExsTE+wBRiB6Sz+3J UO6UjCRkAwDwRte5l4iApwW0afGo1LdKADF0XghAinTyV7ZCpjqMFUHiYcsZ5GrEG2Ai ZyGhHtrDdJ9txDwQEcTVDhyHM64YHb7SOKkA01P3ih28fc+pbSTpOcN0KxYwm3w95Y9c I/YhuOZf8bQoZofRAsVfkfabjVt7Gmqr238A5xfl2588ZKuXvhDML/GStROw2nvylxQ5 BQ6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=FLjl7BuIhILUO8rddxgTv9zZJ0712cjD5uiG0ZQ/KkI=; b=fFewz/bzhYS5JntJGLJQHWUt+iGDPXSY65r3Rrn5s4lg3qQ8/a/nqcCUTdiQpg99wT SKuawSxbLrEgupHEWMQlztwiyME8Ro2ASH2E+hcCSu4Xup8QDcHqBzp8OFbuCiMcc8Me I4CngHwU4sDA+eZ86gMFdEfc37CvaNTQ4q+H64XxklfS6t2Pf3DA8BYm5SJmA+Takwud fVTTxPtuYMGhyQNotnmbIRWYQjonNhIiskvMo7fALqSHb3CKBz4Une3b8SkWGgULqMxe Xt1kyl5ODjGF0Q2zaBUSBI/l4FeQdKcv05wz0qoITOMZYD48/arayynClKyK+lXX/R94 /QrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=N4xVjnu1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v4-20020a17090a898400b0021878aebd90si1557640pjn.168.2023.01.19.23.44.05; Thu, 19 Jan 2023 23:44:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=N4xVjnu1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230271AbjATHn4 (ORCPT <rfc822;changwoo.m@gmail.com> + 99 others); Fri, 20 Jan 2023 02:43:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230156AbjATHnt (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 20 Jan 2023 02:43:49 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A90F7DFAD; Thu, 19 Jan 2023 23:43:48 -0800 (PST) Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30K7U2rL026954; Fri, 20 Jan 2023 07:43:37 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=FLjl7BuIhILUO8rddxgTv9zZJ0712cjD5uiG0ZQ/KkI=; b=N4xVjnu1a6qIpWK+c58BJVYvBIHUyR2Cxwwj7dvgoUCKAz133qFR/HXWqE8hxNzDpwwO U0l9jZFBR/5om5yp5JhnUWivimLOB4W3tV8eYI5vpY1jWw9zE+xitZy7vgvnPzM8HkEs wLEPAyxObLefxFHVXatpJK/Z0OmtvYgVVfuh46sdsLIpxHHz9KA37WybZ+CjQ0aKsI/z HBJNHgjYu4DaZETHvUGQQVs87+il8pHQBBFrPpWOFyqIzgUr4KVBv5+OY5EVkwsPcFUN IiEDb59UwvQdxTyOurg/9R+499eQ+FNRTRzWId50ekArEc6j/4xzw8Gs4LDwtonoYBhb 2Q== Received: from ppma06fra.de.ibm.com (48.49.7a9f.ip4.static.sl-reverse.com [159.122.73.72]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3n7p1e92fe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 20 Jan 2023 07:43:37 +0000 Received: from pps.filterd (ppma06fra.de.ibm.com [127.0.0.1]) by ppma06fra.de.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 30JMPBnv010590; Fri, 20 Jan 2023 07:43:34 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma06fra.de.ibm.com (PPS) with ESMTPS id 3n3knfdkre-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 20 Jan 2023 07:43:34 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 30K7hWUs49152316 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 20 Jan 2023 07:43:32 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6B2392004B; Fri, 20 Jan 2023 07:43:32 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E364C20040; Fri, 20 Jan 2023 07:43:31 +0000 (GMT) Received: from ozlabs.au.ibm.com (unknown [9.192.253.14]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 20 Jan 2023 07:43:31 +0000 (GMT) Received: from jarvis-ozlabs-ibm-com.ozlabs.ibm.com (haven.au.ibm.com [9.192.254.114]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.au.ibm.com (Postfix) with ESMTPSA id AB0F2605A5; Fri, 20 Jan 2023 18:43:29 +1100 (AEDT) From: Andrew Donnellan <ajd@linux.ibm.com> To: linuxppc-dev@lists.ozlabs.org, linux-integrity@vger.kernel.org Cc: gregkh@linuxfoundation.org, gcwilson@linux.ibm.com, linux-kernel@vger.kernel.org, nayna@linux.ibm.com, ruscur@russell.cc, zohar@linux.ibm.com, mpe@ellerman.id.au, gjoyce@linux.ibm.com, sudhakar@linux.ibm.com, bgray@linux.ibm.com, erichte@linux.ibm.com, joel@jms.id.au Subject: [PATCH v4 01/24] powerpc/pseries: Fix handling of PLPKS object flushing timeout Date: Fri, 20 Jan 2023 18:42:43 +1100 Message-Id: <20230120074306.1326298-2-ajd@linux.ibm.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230120074306.1326298-1-ajd@linux.ibm.com> References: <20230120074306.1326298-1-ajd@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: bXomEqbrNyGopMDAe26t5fNKyzGL8tlJ X-Proofpoint-GUID: bXomEqbrNyGopMDAe26t5fNKyzGL8tlJ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-20_04,2023-01-19_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 spamscore=0 mlxscore=0 malwarescore=0 adultscore=0 bulkscore=0 phishscore=0 priorityscore=1501 impostorscore=0 clxscore=1015 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301200070 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755526628228410347?= X-GMAIL-MSGID: =?utf-8?q?1755526628228410347?= |
Series |
pSeries dynamic secure boot secvar interface + platform keyring loading
|
|
Commit Message
Andrew Donnellan
Jan. 20, 2023, 7:42 a.m. UTC
plpks_confirm_object_flushed() uses the H_PKS_CONFIRM_OBJECT_FLUSHED hcall to check whether changes to an object in the Platform KeyStore have been flushed to non-volatile storage. The hcall returns two output values, the return code and the flush status. plpks_confirm_object_flushed() polls the hcall until either the flush status has updated, the return code is an error, or a timeout has been exceeded. While we're still polling, the hcall is returning H_SUCCESS (0) as the return code. In the timeout case, this means that upon exiting the polling loop, rc is 0, and therefore 0 is returned to the user. Handle the timeout case separately and return ETIMEDOUT if triggered. Fixes: 2454a7af0f2a ("powerpc/pseries: define driver for Platform KeyStore") Reported-by: Benjamin Gray <bgray@linux.ibm.com> Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com> Tested-by: Russell Currey <ruscur@russell.cc> Reviewed-by: Russell Currey <ruscur@russell.cc> Signed-off-by: Russell Currey <ruscur@russell.cc> --- v3: Merge plpks fixes and signed update series with secvar series Neaten how we return at the end of the function (ruscur) v4: Move up in series (npiggin) --- arch/powerpc/platforms/pseries/plpks.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/plpks.c b/arch/powerpc/platforms/pseries/plpks.c index 4edd1585e245..9e85b6d85b0b 100644 --- a/arch/powerpc/platforms/pseries/plpks.c +++ b/arch/powerpc/platforms/pseries/plpks.c @@ -248,6 +248,7 @@ static int plpks_confirm_object_flushed(struct label *label, struct plpks_auth *auth) { unsigned long retbuf[PLPAR_HCALL_BUFSIZE] = { 0 }; + bool timed_out = true; u64 timeout = 0; u8 status; int rc; @@ -259,22 +260,26 @@ static int plpks_confirm_object_flushed(struct label *label, status = retbuf[0]; if (rc) { + timed_out = false; if (rc == H_NOT_FOUND && status == 1) rc = 0; break; } - if (!rc && status == 1) + if (!rc && status == 1) { + timed_out = false; break; + } usleep_range(PKS_FLUSH_SLEEP, PKS_FLUSH_SLEEP + PKS_FLUSH_SLEEP_RANGE); timeout = timeout + PKS_FLUSH_SLEEP; } while (timeout < PKS_FLUSH_MAX_TIMEOUT); - rc = pseries_status_to_err(rc); + if (timed_out) + return -ETIMEDOUT; - return rc; + return pseries_status_to_err(rc); } int plpks_write_var(struct plpks_var var)