From patchwork Wed Jan 18 06:10:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Donnellan X-Patchwork-Id: 45013 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2175276wrn; Tue, 17 Jan 2023 22:35:21 -0800 (PST) X-Google-Smtp-Source: AMrXdXs6AfXXPHv6GGAaJU7vUV7NEgGEmBhgDjCigbmJW7sdLJmuw51KwzZ3WSXUwNaQrS9lSV/a X-Received: by 2002:a17:902:f70e:b0:194:6c1b:60b9 with SMTP id h14-20020a170902f70e00b001946c1b60b9mr7117213plo.25.1674023720992; Tue, 17 Jan 2023 22:35:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674023720; cv=none; d=google.com; s=arc-20160816; b=uBpp5G5LImn9vXd7n3OAlyEfey5m/IbMX7kDP+IPH1Irw40m+RGXNIhJu7YTsdXYWP id4tkA/1JJQU9TXiQ99iIyyHjMjIiScH0aH63pKxSWT8gWhxJaIG7EmvAvxYcnGea8+Z JajfvKtpGU/yR95JQuBW6CxmZQS5FhQWG0SkVP5SOK69VlA1z9273R68tNrYZu1tdgFN 2wiObdi10NqkOKsc9czmGQWo4OcPTPrwB4LsY66klzj9pPpXNmn7T1XSNVvEZGPSpK7s 6k/iLxfpEqzRIvkTczUDokjd3GD40YpFLR0Y7NE3YAjIlLi4SLJIy/UltsmXBgdh+okh YZRQ== 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=I5X92rUOwXEA1uiZLI14+Cjbw2Moy8V6c3Tzc/pTkmY=; b=SYVsVE0c4iIazT5IYyB3482fTB0YI9zX5cnkOOkBYlYNsFwFbCcC05wIRU74rW/Hu1 /tdtmNdt+0P4sGMNdgSo6wdj87OFJFcvD10GXEEWCWPUtzxVnbvnoCCPWiuCSbyBDLn6 TF5LGCWfnJdjC7ZWBhCGtiguVUzE/r8LZqwphJ1FtZ8oWcFNirLxD1b03lf7XfLlMRUi AcSDYSWkU+7/S2pmqagxOql0p48sGiqxhrG1+F0JW2Ai8MFyfXJM46ZdNzbiRQtoH6yl uf/ieVnHN0pE4nhT5+vhrhnugnS8c6n2AnrNmHSHgJemzN+jh1WWSPc8aSruArxERvVt /x6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="O/zXlv5C"; 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 e5-20020a170902f1c500b00194a2575c84si5145014plc.596.2023.01.17.22.35.08; Tue, 17 Jan 2023 22:35:20 -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="O/zXlv5C"; 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 S229641AbjARGep (ORCPT + 99 others); Wed, 18 Jan 2023 01:34:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229545AbjARGV7 (ORCPT ); Wed, 18 Jan 2023 01:21:59 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 805EB4DCE5; Tue, 17 Jan 2023 22:11:25 -0800 (PST) Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30I511c2007931; Wed, 18 Jan 2023 06:11:15 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=I5X92rUOwXEA1uiZLI14+Cjbw2Moy8V6c3Tzc/pTkmY=; b=O/zXlv5Ce4/AfwyIYYSYNdD79XkhYEVX2Z+ewTD0OxpvPHOHCLwiAdTxbCPHl5lIvJSw mBM7eGKG3nXwZNk+5OaFPRuZgYFpHUBqYJNzEQ87hUZwlIzfB6flMA7ZnLjaPMSatfSg zQx9PY6qlNttPJzyKn7SujN3gp5duo/FjES1t29+qbJKmFGJo0824zP2Q0o3zleg2Gra cUGubw/tdxOLa2MtAbR5zN/fQPDWfAIGOQ2DTRxJxoIBPI3efUB+FPwXsMVcCNhohzqN g60IJ/CyF0jbg5JvJN3LRbg3Zn0qSso1tpb4x8Ph/eTObZe3KZjQq11gWMN4ijsNQtrf uQ== Received: from ppma01fra.de.ibm.com (46.49.7a9f.ip4.static.sl-reverse.com [159.122.73.70]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3n63tk9aa6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 18 Jan 2023 06:11:15 +0000 Received: from pps.filterd (ppma01fra.de.ibm.com [127.0.0.1]) by ppma01fra.de.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 30HAM9oV028810; Wed, 18 Jan 2023 06:11:13 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma01fra.de.ibm.com (PPS) with ESMTPS id 3n3m16bh3k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 18 Jan 2023 06:11:12 +0000 Received: from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com [10.20.54.105]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 30I6BA7a20775332 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 18 Jan 2023 06:11:10 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8C01D20049; Wed, 18 Jan 2023 06:11:10 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0FD9320040; Wed, 18 Jan 2023 06:11:10 +0000 (GMT) Received: from ozlabs.au.ibm.com (unknown [9.192.253.14]) by smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 18 Jan 2023 06:11:10 +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 26E2D605A6; Wed, 18 Jan 2023 17:11:08 +1100 (AEDT) From: Andrew Donnellan 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 Subject: [PATCH v3 02/24] powerpc/secvar: WARN_ON_ONCE() if multiple secvar ops are set Date: Wed, 18 Jan 2023 17:10:27 +1100 Message-Id: <20230118061049.1006141-3-ajd@linux.ibm.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230118061049.1006141-1-ajd@linux.ibm.com> References: <20230118061049.1006141-1-ajd@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: -mB5k-MvALE6MAPLtpHSGqGsybXp0Kdj X-Proofpoint-GUID: -mB5k-MvALE6MAPLtpHSGqGsybXp0Kdj X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.923,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-18_01,2023-01-17_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 bulkscore=0 priorityscore=1501 impostorscore=0 mlxscore=0 suspectscore=0 adultscore=0 clxscore=1015 spamscore=0 mlxlogscore=999 lowpriorityscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301180051 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755341097606310787?= X-GMAIL-MSGID: =?utf-8?q?1755341097606310787?= From: Russell Currey The secvar code only supports one consumer at a time. Multiple consumers aren't possible at this point in time, but we'd want it to be obvious if it ever could happen. Signed-off-by: Russell Currey Signed-off-by: Andrew Donnellan --- arch/powerpc/kernel/secvar-ops.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/secvar-ops.c b/arch/powerpc/kernel/secvar-ops.c index 6a29777d6a2d..aa1b2adc2710 100644 --- a/arch/powerpc/kernel/secvar-ops.c +++ b/arch/powerpc/kernel/secvar-ops.c @@ -8,10 +8,12 @@ #include #include +#include -const struct secvar_operations *secvar_ops __ro_after_init; +const struct secvar_operations *secvar_ops __ro_after_init = NULL; void set_secvar_ops(const struct secvar_operations *ops) { + WARN_ON_ONCE(secvar_ops); secvar_ops = ops; }