Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp3747132ioo; Wed, 25 May 2022 07:22:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzrXTROZl6iYPBJ3n0uBhcLuQpygZuAEDCr5SF3BB1r4YAEQUl2aYtHqoRokOHdlzZ2JOaD X-Received: by 2002:a17:906:4fce:b0:6f4:f41c:3233 with SMTP id i14-20020a1709064fce00b006f4f41c3233mr27599872ejw.117.1653488518701; Wed, 25 May 2022 07:21:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653488518; cv=none; d=google.com; s=arc-20160816; b=EwCy5Vyy+I0pIfjocAw0Dv/OBxMC27iHuRGKickKe8Ej61gesruUaRCf7gWnOtQqA9 YISZtH/Wc4vLnemOvKsci1s56k2lDHoMIetG3Ob5OlCJBXeXVX2cKWovBw3npV2+vUjw Ka+ANv/JOH73vI860KOk3HZZ6dKPsxZRWhhYGWWzmrAfj/PznoKCUGUCnrGGmgj4JWwt OQgusaparn4bRFcxQsFeq0ub3ZvhVtWn8qlZhrbR5mvM8mymSQI4YQ97XFKFEj3V0wAa jb2xY0Dp2RWuEzYBKSLjUAm/qarOHhJYygLfzKkMVJhX99PqJK8kTlPZVqIUbRGgcSVk NcHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=SFmJvT84KXC6cAg2nukNlwcS7wWg7b9hEal4KrpYJJU=; b=ZDav1lXj195/L6G7nLMQ8fTNnd6iAtc4NSv5On4TLM8Scl4i86UTtos1dVJQHm4OCZ ORF+MOqh9mmzLqDOn3G/hpSKlhjHkbyecuMi5sDtYhoXFAQV9RbfByPyzexcHjfBLoUa yTS7b1jP1yx0+ChAudsFYGuk/DNgIFyk75yKpnypAamMOU34MK1HtD6prNaZwcFBSHp7 qo4pAzNpjeYzPvh/KwNXprmvg+uPBAAKuyXPTJXzBezZoqbHvV1FrXrZE/L5JUOI2IL6 VxYkvYADrjybOfWAjPoxZIUZWsi+8NEFB/tPh3HeparmHLnoQZUPZDFtOWU6Alqn/g/0 rNJg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hp36-20020a1709073e2400b006f3b8a62ff1si20719363ejc.123.2022.05.25.07.21.27; Wed, 25 May 2022 07:21:58 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236693AbiEXPGI (ORCPT + 99 others); Tue, 24 May 2022 11:06:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238426AbiEXPFy (ORCPT ); Tue, 24 May 2022 11:05:54 -0400 Received: from mail.hallyn.com (mail.hallyn.com [178.63.66.53]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18BD58A33F; Tue, 24 May 2022 08:05:53 -0700 (PDT) Received: by mail.hallyn.com (Postfix, from userid 1001) id 4813166D; Tue, 24 May 2022 10:05:51 -0500 (CDT) Date: Tue, 24 May 2022 10:05:51 -0500 From: "Serge E. Hallyn" To: Stefan Berger Cc: "Serge E. Hallyn" , 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 Subject: Re: [PATCH v12 03/26] ima: Define ima_namespace struct and start moving variables into it Message-ID: <20220524150551.GA14813@mail.hallyn.com> References: <20220420140633.753772-1-stefanb@linux.ibm.com> <20220420140633.753772-4-stefanb@linux.ibm.com> <20220521023351.GA9107@mail.hallyn.com> <81730e47-21f4-b678-6585-f21e57620a60@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <81730e47-21f4-b678-6585-f21e57620a60@linux.ibm.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, 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 Tue, May 24, 2022 at 10:57:13AM -0400, Stefan Berger wrote: > > > On 5/20/22 22:33, Serge E. Hallyn wrote: > > > > diff --git a/security/integrity/ima/ima_queue_keys.c b/security/integrity/ima/ima_queue_keys.c > > > index 93056c03bf5a..e366a21dd8be 100644 > > > --- a/security/integrity/ima/ima_queue_keys.c > > > +++ b/security/integrity/ima/ima_queue_keys.c > > > @@ -10,6 +10,7 @@ > > > #include > > > #include > > > +#include > > > #include > > > #include "ima.h" > > > @@ -42,7 +43,7 @@ static bool timer_expired; > > > static void ima_keys_handler(struct work_struct *work) > > > { > > > timer_expired = true; > > > - ima_process_queued_keys(); > > > + ima_process_queued_keys(&init_ima_ns); > > > } > > > /* > > > @@ -130,11 +131,15 @@ bool ima_queue_key(struct key *keyring, const void *payload, > > > * This function sets ima_process_keys to true and processes queued keys. > > > * From here on keys will be processed right away (not queued). > > > */ > > > -void ima_process_queued_keys(void) > > > +void ima_process_queued_keys(struct ima_namespace *ns) > > > { > > > struct ima_key_entry *entry, *tmp; > > > bool process = false; > > > + /* only applies to init_ima_ns */ > > > > Hm, yes, it seems to, but it should be unreachable with > > ns != &init_ima_ns, ever, right? > > > > So it seems better to either not have this hunk at all, (both > > here and at ima_keys_handler()) or to actually have a BUG_ON. > > > > Or am I completely misreading the situation? > > No, you are right. This function is only calledwith ns = &init_ima_ns at the > moment. How about changing it to this here? > > if (WARN_ON(ns != &init_ima_ns)) > return; Sounds good, thanks.