Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3781658imw; Thu, 7 Jul 2022 07:32:19 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sXcsy0u1U3AL3bdOpbPVIFgU/1zWmLrAbBRv/38ySYs5Ygglq/VvUrLCoiTq+ehEfdZ5Xq X-Received: by 2002:a17:907:76b2:b0:726:d02f:dee with SMTP id jw18-20020a17090776b200b00726d02f0deemr43705093ejc.249.1657204339039; Thu, 07 Jul 2022 07:32:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657204339; cv=none; d=google.com; s=arc-20160816; b=PgT4bEW3Xhn5M0pr5Ee8arO2uAu35x6jDt0a2z8dRDbf07ch/CbFKAgqzMTzLVdTGY IAzQe1x/e2ef1cmJ2yEM+eYRJV7nrcMkSfEDKggHbBmvDJL8ZY5uY8ytkTqJKnREFi1f D16P2c1yV7J6yjT3BCopyMW/zr6XQB0oLpV8yE376hPhbf/MF6umz4xjG2ZCdvQ3gAcK rkWhJheHXSJbRVhmyZJSWwGU+SaMHFU6yH8CSKtw66VvXyVJgDID1rPZ4hAcci2r6TWr BGVNTwYI+IOXSq0ONdSE3xoOvtA6yfk/YPfR1rqUHOs8bGaRyocVEDTpezzhbsrI5X6L 1cDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=fcx2vaYpLimBdEBYsnGNhtx56Y7bddCHHHVLh18fXpU=; b=Q2IR26XskRQ4Uee1feDbchfZDzhOybbdkOf229j+5fdfl169tn277p389GETG9EboC yj5sMnsifCx3DBGlRtFvXSMFu3oofwX3C6RO4aaB1pVF7TxVSyNMmJ1YD1Qry5QDZzRY BlNZcYI4FszP4TlUxxM7s7PLRyCtF7G51DnFL0+v342fyuwI+youv7yWa/zfFgG85e5/ Zdb6Cqj6W/zAE91OTgCN6SlUuHp7FHuEkk9W/scBZIJPOlLI2DISq6qorwW5soLuZQ/U jvpYcywv9WJF88OAXY4RouyMpARPHRNcQDGIU4d46c43OlYelFjx3kHqDQQqVEFNE71B nSPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=UU7lc1KF; 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=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q10-20020aa7da8a000000b0043a7fbac1fbsi642412eds.409.2022.07.07.07.31.53; Thu, 07 Jul 2022 07:32:19 -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=UU7lc1KF; 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=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235684AbiGGOMl (ORCPT + 99 others); Thu, 7 Jul 2022 10:12:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235264AbiGGOMk (ORCPT ); Thu, 7 Jul 2022 10:12:40 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8D2E2CC9E; Thu, 7 Jul 2022 07:12:36 -0700 (PDT) Received: from pps.filterd (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 267DoK4o033255; Thu, 7 Jul 2022 14:12:15 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=fcx2vaYpLimBdEBYsnGNhtx56Y7bddCHHHVLh18fXpU=; b=UU7lc1KFOycR//lVyNmVObRB2eMZj9Wp3Mh/yc3HG7HtdcY7IOekOtT5MKh0JxCwejvv M+Iul70whE8rwXIQ6mRnpUUZgvOntIEsJqt9bxnLXx4U4ZAsCHNFNkrB4k6Pp656vfOY rYPR3OnQJY08Hc8ACbGfQh+ox/hzhfcqYLM4vHJ5qEAziDMMa7OQzrrX+2t1Cg4GeG30 XiJ3Kq+L6R8NMseAiCA4cg51X4jepXz5cU1WycX+mdHfxGV0cF9Qsj7gUg81h5UftlOD vAiFDPzx8fhJtB0DrsoBMelJGH3qceh8EbjlmmPwZ2FtKF86IrAaUdBh3FWXpMPp7aD6 QA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3h60qp0s3a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 07 Jul 2022 14:12:14 +0000 Received: from m0127361.ppops.net (m0127361.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 267Ds61f004934; Thu, 7 Jul 2022 14:12:14 GMT Received: from ppma01dal.us.ibm.com (83.d6.3fa9.ip4.static.sl-reverse.com [169.63.214.131]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3h60qp0s2m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 07 Jul 2022 14:12:14 +0000 Received: from pps.filterd (ppma01dal.us.ibm.com [127.0.0.1]) by ppma01dal.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 267E5lEU016355; Thu, 7 Jul 2022 14:12:13 GMT Received: from b03cxnp07029.gho.boulder.ibm.com (b03cxnp07029.gho.boulder.ibm.com [9.17.130.16]) by ppma01dal.us.ibm.com with ESMTP id 3h4ud7pn9x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 07 Jul 2022 14:12:12 +0000 Received: from b03ledav005.gho.boulder.ibm.com (b03ledav005.gho.boulder.ibm.com [9.17.130.236]) by b03cxnp07029.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 267ECBNQ37093642 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 7 Jul 2022 14:12:11 GMT Received: from b03ledav005.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 73C4EBE05A; Thu, 7 Jul 2022 14:12:11 +0000 (GMT) Received: from b03ledav005.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2C8CFBE058; Thu, 7 Jul 2022 14:12:10 +0000 (GMT) Received: from [9.47.158.152] (unknown [9.47.158.152]) by b03ledav005.gho.boulder.ibm.com (Postfix) with ESMTP; Thu, 7 Jul 2022 14:12:10 +0000 (GMT) Message-ID: Date: Thu, 7 Jul 2022 10:12:09 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH v12 04/26] ima: Move arch_policy_entry into ima_namespace Content-Language: en-US To: "Serge E. Hallyn" Cc: linux-integrity@vger.kernel.org, zohar@linux.ibm.com, christian.brauner@ubuntu.com, containers@lists.linux.dev, dmitry.kasatkin@gmail.com, ebiederm@xmission.com, krzysztof.struczynski@huawei.com, roberto.sassu@huawei.com, mpeters@redhat.com, lhinds@redhat.com, lsturman@redhat.com, puiterwi@redhat.com, jejb@linux.ibm.com, jamjoom@us.ibm.com, linux-kernel@vger.kernel.org, paul@paul-moore.com, rgb@redhat.com, linux-security-module@vger.kernel.org, jmorris@namei.org, jpenumak@redhat.com, Christian Brauner References: <20220420140633.753772-1-stefanb@linux.ibm.com> <20220420140633.753772-5-stefanb@linux.ibm.com> <20220521024633.GB9107@mail.hallyn.com> From: Stefan Berger In-Reply-To: <20220521024633.GB9107@mail.hallyn.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: vKogRgOJWS65HCVdqDHhSNdTehHRaXjo X-Proofpoint-GUID: XTndIoLAhmDMjP4LgIeE0qvSnmrbQMM- X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-07-07_09,2022-06-28_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 adultscore=0 mlxlogscore=999 clxscore=1011 lowpriorityscore=0 suspectscore=0 mlxscore=0 impostorscore=0 priorityscore=1501 malwarescore=0 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2206140000 definitions=main-2207070055 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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 On 5/20/22 22:46, Serge E. Hallyn wrote: > On Wed, Apr 20, 2022 at 10:06:11AM -0400, Stefan Berger wrote: >> @@ -1005,7 +1003,8 @@ void ima_update_policy(struct ima_namespace *ns) >> * on boot. After loading a custom policy, free the >> * architecture specific rules stored as an array. >> */ >> - kfree(arch_policy_entry); >> + kfree(ns->arch_policy_entry); >> + ns->arch_policy_entry = NULL; > > So the thing that prevents multiple racing occurances of the above two lines is > that ima_open_policy() sets IMA_FS_BUSY (or returns EBUSY) and then removes > this file before clearing the flag, right? Correct. > > Seems good. > > Reviewed-by: Serge Hallyn > > >> } >> ima_update_policy_flags(ns); >> >> -- >> 2.34.1