From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AB638C433FE for ; Tue, 14 Dec 2021 18:23:59 +0000 (UTC) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-633-XdadAkTkMNSdBgoh2Hz2zQ-1; Tue, 14 Dec 2021 13:23:55 -0500 X-MC-Unique: XdadAkTkMNSdBgoh2Hz2zQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A4B7D64092; Tue, 14 Dec 2021 18:23:51 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9134394C6C; Tue, 14 Dec 2021 18:23:51 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 70E964A708; Tue, 14 Dec 2021 18:23:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1BE75n06002403 for ; Tue, 14 Dec 2021 02:05:49 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1C6D3401E20; Tue, 14 Dec 2021 07:05:49 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast07.extmail.prod.ext.rdu2.redhat.com [10.11.55.23]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 18AAD401475 for ; Tue, 14 Dec 2021 07:05:49 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F33F43C9A00F for ; Tue, 14 Dec 2021 07:05:48 +0000 (UTC) Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-563-bIa1Vm_FMHy1WiiSHVvBfw-1; Tue, 14 Dec 2021 02:05:47 -0500 X-MC-Unique: bIa1Vm_FMHy1WiiSHVvBfw-1 Received: by mail-pf1-f180.google.com with SMTP id r130so17111348pfc.1 for ; Mon, 13 Dec 2021 23:05:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=u9uJx6Yzs8VAbaAVVWgb3c7raYuZyWdXpq+qPzpYeZM=; b=6AEFQVT7bBfewYNNuSyJRls99sU2vs+NKWHtkBU+8x+JdEdtML9mac9OIzRK1VmOIZ 3tUov1MBfS8zlctyKa+Gtc/TVdvcexf2bbu7QL1yUk55rl15yAPjFlJq/cX6+2QsERiB JSqpgOIGckoFmncxOui96goQ1UHFlYGk6JcsER3KZwIkA49GejJtMjTkST/cASC28ZLq VmKxZFN5S/XmnH2ZVM56zE7bsLBmj0xGSG0pQW6JTuNqwVL143e43OKWDmdP3dK5smN3 Mg132OFNSKd4vj5IaxmPXMXmo2iKYKr4MGzVsBC/D3o6gPO2R0nrH1pHvnVcYGH5aHNY te6A== X-Gm-Message-State: AOAM533nAfGtN//H7uw55HTte60pgWsRgPd7MELYUHhYA/eWp2d51g43 AkcE/XDw9D+unKepZbWPtRftgg== X-Google-Smtp-Source: ABdhPJz65bi9c7M0fZgffgbxVusSpsiNlfIGYC1wjPy5i0UuQiVHxioVmPTqUEQV+R+LXxo5SjqWTw== X-Received: by 2002:a05:6a00:22c3:b0:4b6:197:ae5a with SMTP id f3-20020a056a0022c300b004b60197ae5amr1474920pfj.42.1639465545684; Mon, 13 Dec 2021 23:05:45 -0800 (PST) Received: from leoy-ThinkPad-X240s ([134.195.101.46]) by smtp.gmail.com with ESMTPSA id fw21sm1238200pjb.25.2021.12.13.23.05.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Dec 2021 23:05:45 -0800 (PST) Date: Tue, 14 Dec 2021 15:05:34 +0800 From: Leo Yan To: Balbir Singh Subject: Re: [PATCH v2 4/7] connector/cn_proc: Use task_is_in_init_pid_ns() Message-ID: <20211214070534.GA1721898@leoy-ThinkPad-X240s> References: <20211208083320.472503-1-leo.yan@linaro.org> <20211208083320.472503-5-leo.yan@linaro.org> MIME-Version: 1.0 In-Reply-To: X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 X-loop: linux-audit@redhat.com X-Mailman-Approved-At: Tue, 14 Dec 2021 13:23:34 -0500 Cc: codalist@telemann.coda.cs.cmu.edu, Jan Harkes , Leon Romanovsky , Mathieu Poirier , Suzuki K Poulose , Alexander Shishkin , netdev@vger.kernel.org, coresight@lists.linaro.org, linux-kernel@vger.kernel.org, Eric Paris , coda@cs.cmu.edu, linux-audit@redhat.com, Jakub Kicinski , "David S. Miller" , linux-arm-kernel@lists.infradead.org, Mike Leach X-BeenThere: linux-audit@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Linux Audit Discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-audit-bounces@redhat.com Errors-To: linux-audit-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=linux-audit-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On Tue, Dec 14, 2021 at 04:58:32PM +1100, Balbir Singh wrote: > On Wed, Dec 08, 2021 at 04:33:17PM +0800, Leo Yan wrote: > > This patch replaces open code with task_is_in_init_pid_ns() to check if > > a task is in root PID namespace. > > > > Signed-off-by: Leo Yan > > --- > > drivers/connector/cn_proc.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/connector/cn_proc.c b/drivers/connector/cn_proc.c > > index 646ad385e490..ccac1c453080 100644 > > --- a/drivers/connector/cn_proc.c > > +++ b/drivers/connector/cn_proc.c > > @@ -358,7 +358,7 @@ static void cn_proc_mcast_ctl(struct cn_msg *msg, > > * other namespaces. > > */ > > if ((current_user_ns() != &init_user_ns) || > > - (task_active_pid_ns(current) != &init_pid_ns)) > > + !task_is_in_init_pid_ns(current)) > > return; > > > > Sounds like there might scope for other wrappers - is_current_in_user_init_ns() Indeed, for new wrapper is_current_in_user_init_ns(), I searched kernel and located there have multiple places use open code. If no one works on this refactoring, I will send a new patchset for it separately. > Acked-by: Balbir Singh Thank you for review, Balbir! Also thanks review from Leon and Suzuki. Leo -- Linux-audit mailing list Linux-audit@redhat.com https://listman.redhat.com/mailman/listinfo/linux-audit