Message ID | 20230809195315.1085656-4-nayna@linux.ibm.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b824:0:b0:3f2:4152:657d with SMTP id z4csp68786vqi; Wed, 9 Aug 2023 16:25:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IENpR475GQNDHe70MjLBmySp6HYku4Y9nOFkVV+RInedhErnc2ZJDhDlx2+p9ShkypoDifx X-Received: by 2002:a17:907:7841:b0:992:a836:a194 with SMTP id lb1-20020a170907784100b00992a836a194mr478802ejc.59.1691623511450; Wed, 09 Aug 2023 16:25:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691623511; cv=none; d=google.com; s=arc-20160816; b=QZjY3UQSg9rW4b52dpEP+iHddADBS8Rxi9WfVsLCak+U4lFgrVa6UabOAonKTQnGHg wnX7MxPaE9lkT7G9gjn327AG//45JFQJwJFUeS9eMFNXWmceUYeWnvLNDT8+RviqQu/e qqnu/LQCH2sF/SuvNN1Acn6Nbzw+Nwk4PRin83Rp2HUvLalZHcjNJ4WwqPfAImYS2J06 MwvzDeBnr7j5WSawM12NLpykaXKn6RKu6u23Oe3sjPwRg4BPZuSlHntFMzdcfSPLGcHZ /Zs5gNJx+RePBDFN+47FlzD8BSaeksRod4gN2rcS0h9ohnA8UCL2XVDu29bE1JqkAxQ/ 5lZw== 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=91q+7mvybHfGvVUVLV6PtAy6zTGV6l+q7I4P7aDY71Q=; fh=xUlcC+Arz0lYctjWPpiaPSbbcPpWgnum2V1Myf8/1N8=; b=ZP1ONm/L3/AcdiCRw974yUFPdBvzJEs7nr3S9hnQVxLC3VxLkyU2Tz7Rpg1fE1BiA1 VYatcfa13NYmMuSc3sLu+M4ndJTN7cV6kT5QE3XIUa0YWQlAQeSck2DVrYa1iPjHnnx+ 932uvEsd4Mow49idXn+edAA5eaV515CnLyKV70jVmTx5mv5Ax2Fgneue3h5P7mykoAN+ kOMY7mfvzMR3yUbMpCvC05lRKEdALizj/M6o73FpD88cGaAO/0lhP+sg4XAxQtockA+J T3QUflBlHgR5MK+0uExzkO3v98HApdaMne8ivMNvNF06qqlWGISxsVYpE0JH1ucoPHiZ E7GQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=PbYrdhX+; 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 rs28-20020a170907037c00b0099364d9f0eesi225787ejb.481.2023.08.09.16.24.47; Wed, 09 Aug 2023 16:25:11 -0700 (PDT) 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=PbYrdhX+; 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 S230226AbjHIUvc (ORCPT <rfc822;craechal@gmail.com> + 99 others); Wed, 9 Aug 2023 16:51:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229601AbjHIUvb (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 9 Aug 2023 16:51:31 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D4B9100; Wed, 9 Aug 2023 13:51:30 -0700 (PDT) Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 379JgFhW017381; Wed, 9 Aug 2023 19:53:41 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=91q+7mvybHfGvVUVLV6PtAy6zTGV6l+q7I4P7aDY71Q=; b=PbYrdhX+oeKuWXucaeo0nNpOfzEg2lbVdhXIievhSanAu6wnOCwRFmXYHWNW4gvd+WKm nBwsfjydVdjgfcehkj5RHLkj3gP1UsTk3L1H7no8COn0wlRKlwxXVbnRQYIgeZfKsykv wzGBHRRcB7gWtLYWuOkeyT+U5weg4AmWs3jXl3/TxmG5/REAlAjjWswKHlHQVnDC9nGP J/JViY2afKjs1Fphw4oYw6rw6aleKT/bkAW//z4O63bsXCdhxNEowYY+q1y0Bbp/Cwf7 7MpPsI1lL0or59I/JAiZvuwWxaj9HHZsQvjBzJLNwJvhcsrbOmGtiAPUhxiKdHmhCxRc ZA== Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3sch088e2g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 09 Aug 2023 19:53:41 +0000 Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 379ICZNw015366; Wed, 9 Aug 2023 19:53:40 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 3sb3f34ubr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 09 Aug 2023 19:53:40 +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 379JrbmG19989240 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 9 Aug 2023 19:53:37 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 655E020043; Wed, 9 Aug 2023 19:53:37 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 27EF620040; Wed, 9 Aug 2023 19:53:35 +0000 (GMT) Received: from li-4b5937cc-25c4-11b2-a85c-cea3a66903e4.ibm.com (unknown [9.61.3.84]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 9 Aug 2023 19:53:34 +0000 (GMT) From: Nayna Jain <nayna@linux.ibm.com> To: linux-integrity@vger.kernel.org Cc: Mimi Zohar <zohar@linux.ibm.com>, Jarkko Sakkinen <jarkko@kernel.org>, Eric Snowberg <eric.snowberg@oracle.com>, Paul Moore <paul@paul-moore.com>, linuxppc-dev <linuxppc-dev@lists.ozlabs.org>, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, Nayna Jain <nayna@linux.ibm.com> Subject: [PATCH v2 3/6] integrity: remove global variable from machine_keyring.c Date: Wed, 9 Aug 2023 15:53:12 -0400 Message-Id: <20230809195315.1085656-4-nayna@linux.ibm.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20230809195315.1085656-1-nayna@linux.ibm.com> References: <20230809195315.1085656-1-nayna@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: Mts2WIO9sEIZC7kyJDvGmzpoe7_EWIN4 X-Proofpoint-GUID: Mts2WIO9sEIZC7kyJDvGmzpoe7_EWIN4 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-09_17,2023-08-09_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 suspectscore=0 spamscore=0 lowpriorityscore=0 malwarescore=0 mlxscore=0 adultscore=0 impostorscore=0 mlxlogscore=999 priorityscore=1501 phishscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308090171 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL,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: INBOX X-GMAIL-THRID: 1773795814809890705 X-GMAIL-MSGID: 1773795814809890705 |
Series |
Enable loading local and third party keys on PowerVM guest
|
|
Commit Message
Nayna Jain
Aug. 9, 2023, 7:53 p.m. UTC
trust_mok variable is accessed within a single function locally.
Change trust_mok from global to local static variable.
Signed-off-by: Nayna Jain <nayna@linux.ibm.com>
Reviewed-and-tested-by: Mimi Zohar <zohar@linux.ibm.com>
---
security/integrity/platform_certs/machine_keyring.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Comments
On Wed Aug 9, 2023 at 10:53 PM EEST, Nayna Jain wrote: > trust_mok variable is accessed within a single function locally. > > Change trust_mok from global to local static variable. > > Signed-off-by: Nayna Jain <nayna@linux.ibm.com> > Reviewed-and-tested-by: Mimi Zohar <zohar@linux.ibm.com> > --- > security/integrity/platform_certs/machine_keyring.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/security/integrity/platform_certs/machine_keyring.c b/security/integrity/platform_certs/machine_keyring.c > index 389a6e7c9245..9482e16cb2ca 100644 > --- a/security/integrity/platform_certs/machine_keyring.c > +++ b/security/integrity/platform_certs/machine_keyring.c > @@ -8,8 +8,6 @@ > #include <linux/efi.h> > #include "../integrity.h" > > -static bool trust_mok; > - > static __init int machine_keyring_init(void) > { > int rc; > @@ -65,9 +63,11 @@ static __init bool uefi_check_trust_mok_keys(void) > bool __init trust_moklist(void) > { > static bool initialized; > + static bool trust_mok; > > if (!initialized) { > initialized = true; > + trust_mok = false; > > if (uefi_check_trust_mok_keys()) > trust_mok = true; Nice catch. Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org> BR, Jarkko
diff --git a/security/integrity/platform_certs/machine_keyring.c b/security/integrity/platform_certs/machine_keyring.c index 389a6e7c9245..9482e16cb2ca 100644 --- a/security/integrity/platform_certs/machine_keyring.c +++ b/security/integrity/platform_certs/machine_keyring.c @@ -8,8 +8,6 @@ #include <linux/efi.h> #include "../integrity.h" -static bool trust_mok; - static __init int machine_keyring_init(void) { int rc; @@ -65,9 +63,11 @@ static __init bool uefi_check_trust_mok_keys(void) bool __init trust_moklist(void) { static bool initialized; + static bool trust_mok; if (!initialized) { initialized = true; + trust_mok = false; if (uefi_check_trust_mok_keys()) trust_mok = true;