Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp3640782ioo; Wed, 25 May 2022 05:12:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8ckal0S9ZsVZz3U6XRwjeEsWueAjmHr4uti9eK4Wm86SE2+ne/cCDbjDzBdxaZksGr910 X-Received: by 2002:a65:6bc7:0:b0:3f5:fdf7:12e2 with SMTP id e7-20020a656bc7000000b003f5fdf712e2mr27869046pgw.13.1653480775552; Wed, 25 May 2022 05:12:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653480775; cv=none; d=google.com; s=arc-20160816; b=RiglGxGWZI8tMvPhhxRf08QCWGIFVuKalVsWuk0p8fwn/8DkJdVTPbD6zQx/qkX4sA zX762oqCBXZBMIhURrtsy7egDpgv8IwqHWnCgNPUVuOGewdHzOkVvC4gx8ZkO1ED1Rrk YU7QfSewtDn2MTeuB3Pc523p9pdls4HhpHsVucm5ZNgA2s6z0WaUzmZjYjqLqwO2lrc1 mKnhooVIGKPkZ8tZ2g38vGg/jPqOG+82CK/VSXdE4sgxLYEjQY4EZifnuj+8KZ44eWTS RVvsYe03JzWJkdYw1s5ytDGDAqdQIM4TGGnXONGt8tR7T77bhLOlkc4G7D4A8Jm94KuI sJng== 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=aGeOnOLLgA5FA6U32gLZpU1eltA+Hcdxh7v+Umar3OQ=; b=KrR0LeV6uAPC6+oH8zuqhgLWle1E5eNCCRhBM/8WEeIHKCTh4k3n1Fcjf9qq+xSIPP YfMopAgvPQKX16T/RDRxbuXhh2yAbptqltYSfbPrcvBYRF2QU6OwunEY2v2aiC+bDbj1 vSunZhK6XVIYdBe4fMaL2u1xxDR19P4g12OxywnNJdyixXoFVeGgbhVh1TgB2ZhiUSiy 7c0+K5HKRakqIPuaeYmt9sr1rDei7JoPBn8aE1M1KnLKCvybf7c3Sm91HomifYnIRm2l sCVzuuvGrt+pHOsCO0jg5ceQ8nAdh5lw/LPBWEVbwwbJoniSQERfWsqpNycrbsWcQ1re eOrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=euS4Pb6I; 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 m2-20020a170902768200b0015d281d00a5si16842382pll.599.2022.05.25.05.12.39; Wed, 25 May 2022 05:12:55 -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=euS4Pb6I; 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 S239109AbiEXQTN (ORCPT + 99 others); Tue, 24 May 2022 12:19:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234684AbiEXQTM (ORCPT ); Tue, 24 May 2022 12:19:12 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 776706351B; Tue, 24 May 2022 09:19:11 -0700 (PDT) Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24OFfjdv016583; Tue, 24 May 2022 16:18:47 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=aGeOnOLLgA5FA6U32gLZpU1eltA+Hcdxh7v+Umar3OQ=; b=euS4Pb6I2+VJRkWR+ADgF5K4BtcTSFJL+TsvOXN8hZlv54WxQ8Ia/86xbNEru3+YNb48 EKVC2C6cVUAoIqt0JPhIPc3SqkGITAuZg7A8BQq7jVLCu5YIuamlzEXbYdPPG8ovNcGZ rjxoM7mfVG+u1dfW35VqYnmhebFHKpQJBYOHQvQ07vusbSTlZLXtAxa8jhbRiACHSbsc aPNnbFbAM8jUhtcxFpj3j5RRpYXgRd0z63xfv/o7sbzPPu7PZzVuJ3+7PK1d8LBpVc/l Y2w4vB5jqE9d5y2GHQ380SdTSIuS2/vSrSeHMcNLLTlApKKFb4mS0n+vSPMWvUbLrw3T yw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g927urwsp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 24 May 2022 16:18:47 +0000 Received: from m0098396.ppops.net (m0098396.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 24OFhPDC025487; Tue, 24 May 2022 16:18:46 GMT Received: from ppma02wdc.us.ibm.com (aa.5b.37a9.ip4.static.sl-reverse.com [169.55.91.170]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g927urws8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 24 May 2022 16:18:46 +0000 Received: from pps.filterd (ppma02wdc.us.ibm.com [127.0.0.1]) by ppma02wdc.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 24OGEBHG023958; Tue, 24 May 2022 16:18:45 GMT Received: from b01cxnp23032.gho.pok.ibm.com (b01cxnp23032.gho.pok.ibm.com [9.57.198.27]) by ppma02wdc.us.ibm.com with ESMTP id 3g6qqa18p5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 24 May 2022 16:18:45 +0000 Received: from b01ledav006.gho.pok.ibm.com (b01ledav006.gho.pok.ibm.com [9.57.199.111]) by b01cxnp23032.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 24OGIixp26411308 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 24 May 2022 16:18:44 GMT Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2360DAC064; Tue, 24 May 2022 16:18:44 +0000 (GMT) Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0385CAC05B; Tue, 24 May 2022 16:18:44 +0000 (GMT) Received: from [9.47.158.152] (unknown [9.47.158.152]) by b01ledav006.gho.pok.ibm.com (Postfix) with ESMTP; Tue, 24 May 2022 16:18:43 +0000 (GMT) Message-ID: <8ba32888-32ad-cf92-49e6-15d432331bba@linux.ibm.com> Date: Tue, 24 May 2022 12:18:28 -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 03/26] ima: Define ima_namespace struct and start moving variables into it 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-4-stefanb@linux.ibm.com> <20220521023351.GA9107@mail.hallyn.com> From: Stefan Berger In-Reply-To: <20220521023351.GA9107@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: JB2PU8b-sqUlLgmdDFMyOsc4ij0AaY6t X-Proofpoint-GUID: RBA7ti0NQe8McmWcSGKxqe_nf9FzM4sY X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.874,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-24_07,2022-05-23_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 suspectscore=0 malwarescore=0 phishscore=0 mlxscore=0 spamscore=0 mlxlogscore=999 lowpriorityscore=0 adultscore=0 clxscore=1015 impostorscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205240080 X-Spam-Status: No, score=-5.3 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:33, Serge E. Hallyn wrote: >> * they make a queue. The policy may be updated multiple times and this is the >> @@ -985,16 +988,17 @@ int ima_check_policy(void) >> * Policy rules are never deleted so ima_policy_flag gets zeroed only once when >> * we switch from the default policy to user defined. >> */ >> -void ima_update_policy(void) >> +void ima_update_policy(struct ima_namespace *ns) >> { >> - struct list_head *policy = &ima_policy_rules; >> + struct list_head *policy = &ns->ima_policy_rules; >> >> - list_splice_tail_init_rcu(&ima_temp_rules, policy, synchronize_rcu); >> + list_splice_tail_init_rcu(&ns->ima_temp_rules, policy, >> + synchronize_rcu); >> >> - if (ima_rules != (struct list_head __rcu *)policy) { >> - ima_policy_flag = 0; >> + if (ns->ima_rules != (struct list_head __rcu *)policy) { >> + ns->ima_policy_flag = 0; >> >> - rcu_assign_pointer(ima_rules, policy); >> + rcu_assign_pointer(ns->ima_rules, policy); >> /* >> * IMA architecture specific policy rules are specified >> * as strings and converted to an array of ima_entry_rules >> @@ -1003,10 +1007,10 @@ void ima_update_policy(void) >> */ >> kfree(arch_policy_entry); >> } >> - ima_update_policy_flags(); >> + ima_update_policy_flags(ns); >> >> /* Custom IMA policy has been loaded */ >> - ima_process_queued_keys(); >> + ima_process_queued_keys(ns); >> } >> So this is a caller that may enter that function with ns != init_ima_ns and in that case that function should do nothing. So, also the WARN_ON() is not appropriate then. Stefan