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 75EB1C433EF for ; Wed, 8 Dec 2021 13:06:54 +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-513-vI2YC8ypNjaaIs8DofTfPw-1; Wed, 08 Dec 2021 08:06:51 -0500 X-MC-Unique: vI2YC8ypNjaaIs8DofTfPw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9229D802DF1; Wed, 8 Dec 2021 13:06:46 +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 727FC1F2FF; Wed, 8 Dec 2021 13:06:46 +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 4F1064A70F; Wed, 8 Dec 2021 13:06:46 +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 1B89bd8o008806 for ; Wed, 8 Dec 2021 04:37:40 -0500 Received: by smtp.corp.redhat.com (Postfix) id D2881401E22; Wed, 8 Dec 2021 09:37:39 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast09.extmail.prod.ext.rdu2.redhat.com [10.11.55.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CEABB401E20 for ; Wed, 8 Dec 2021 09:37:39 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.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 B4DDE2B7602E for ; Wed, 8 Dec 2021 09:37:39 +0000 (UTC) Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-122-CBrLZCiPNoiSGJ9wYykUQA-1; Wed, 08 Dec 2021 04:37:36 -0500 X-MC-Unique: CBrLZCiPNoiSGJ9wYykUQA-1 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 815E8CE2073; Wed, 8 Dec 2021 09:28:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9BCAC00446; Wed, 8 Dec 2021 09:28:37 +0000 (UTC) Date: Wed, 8 Dec 2021 11:28:34 +0200 From: Leon Romanovsky To: Leo Yan Subject: Re: [PATCH v2 1/7] pid: Introduce helper task_is_in_init_pid_ns() Message-ID: References: <20211208083320.472503-1-leo.yan@linaro.org> <20211208083320.472503-2-leo.yan@linaro.org> MIME-Version: 1.0 In-Reply-To: <20211208083320.472503-2-leo.yan@linaro.org> 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: Wed, 08 Dec 2021 07:54:40 -0500 Cc: codalist@telemann.coda.cs.cmu.edu, Jan Harkes , Mathieu Poirier , Suzuki K Poulose , Alexander Shishkin , netdev@vger.kernel.org, Balbir Singh , linux-kernel@vger.kernel.org, Eric Paris , coda@cs.cmu.edu, linux-audit@redhat.com, coresight@lists.linaro.org, 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.84 on 10.5.11.23 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 Wed, Dec 08, 2021 at 04:33:14PM +0800, Leo Yan wrote: > Currently the kernel uses open code in multiple places to check if a > task is in the root PID namespace with the kind of format: > > if (task_active_pid_ns(current) == &init_pid_ns) > do_something(); > > This patch creates a new helper function, task_is_in_init_pid_ns(), it > returns true if a passed task is in the root PID namespace, otherwise > returns false. So it will be used to replace open codes. > > Suggested-by: Suzuki K Poulose > Signed-off-by: Leo Yan > --- > include/linux/pid_namespace.h | 5 +++++ > 1 file changed, 5 insertions(+) > Thanks, Reviewed-by: Leon Romanovsky -- Linux-audit mailing list Linux-audit@redhat.com https://listman.redhat.com/mailman/listinfo/linux-audit 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 BDE47C433F5 for ; Wed, 8 Dec 2021 09:30:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=p8UuQAoDYndaP11dVyVwUIU5W34ZzxsnHxb4z4/MBLI=; b=iRErw1qLDCBg/F aax62r0WOxFU5L2T+mZB7TwhhCVNewWHq83cdRAnXSfx7YQJSYAnzBFDtljtNja4wiStGcDspjkpr pr8NMMitK6l3f6Aj5ZP7RuXugzfQ5tWq+PkiTSlcBXk//sb9RHVlEwKUXPbqLgfbMJoXOvEchaXk6 5zfwXInyIQLjT7kAFuJyggVESsUNmgZcd60ZoJeaDhPBgINl+z+cRylIRnu1K2g7nKSUfQUZPdUuf Am4GCCBm6G7N6ImUjuMo7/Jbz2mlyUh5gqnFrGTTPf78gyrgMuUE+Fx/tTIxeWScLTprtNPQQxZ25 EolHRZ4qwvGwZMw+T8Qg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mutFn-00Bu7A-Uy; Wed, 08 Dec 2021 09:28:48 +0000 Received: from sin.source.kernel.org ([2604:1380:40e1:4800::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mutFi-00Bu4g-Ps for linux-arm-kernel@lists.infradead.org; Wed, 08 Dec 2021 09:28:44 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 815E8CE2073; Wed, 8 Dec 2021 09:28:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9BCAC00446; Wed, 8 Dec 2021 09:28:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1638955718; bh=wPLoCgEiGSFzZaa084ljFEQkOegpE0+U9VnbZ8HMw0M=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=LuJrgbpgPLbIgIWCE1a0PvHDcB/xlrNqQOi0zfmZSruQTKn8m5BXD25ByikS3TIaB 3+j9MAoUf+fnf5zEEr9uMKC/SU62f9LoHn2SYDsSyAB6v3tjzkhfloxQ6Wmsfnq8V4 E8ITvnTd4C3kxB5vWMgp/ZC7NRY5xAipewdGpvXzz6s1SnWrDJBRFpskcrTrgJxuDH zarM0/6a6tbwy8d/lucdqyCMd7Bg0LVdf2nLeHrAHyE+1MIjFDRh77X3FkSvwMs8uR RQn9rgWA7O2Y+gc3sDB0NSFJwLVQI8fg3AY4dw/wQH3ILO7Pal8OhvLpbFCgpM+73e eXbfSGAAFbaww== Date: Wed, 8 Dec 2021 11:28:34 +0200 From: Leon Romanovsky To: Leo Yan Cc: "David S. Miller" , Jakub Kicinski , Mathieu Poirier , Suzuki K Poulose , Mike Leach , Alexander Shishkin , Jan Harkes , coda@cs.cmu.edu, Paul Moore , Eric Paris , Balbir Singh , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, codalist@coda.cs.cmu.edu, linux-audit@redhat.com Subject: Re: [PATCH v2 1/7] pid: Introduce helper task_is_in_init_pid_ns() Message-ID: References: <20211208083320.472503-1-leo.yan@linaro.org> <20211208083320.472503-2-leo.yan@linaro.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20211208083320.472503-2-leo.yan@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211208_012843_058220_8B7039F8 X-CRM114-Status: GOOD ( 14.61 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Dec 08, 2021 at 04:33:14PM +0800, Leo Yan wrote: > Currently the kernel uses open code in multiple places to check if a > task is in the root PID namespace with the kind of format: > > if (task_active_pid_ns(current) == &init_pid_ns) > do_something(); > > This patch creates a new helper function, task_is_in_init_pid_ns(), it > returns true if a passed task is in the root PID namespace, otherwise > returns false. So it will be used to replace open codes. > > Suggested-by: Suzuki K Poulose > Signed-off-by: Leo Yan > --- > include/linux/pid_namespace.h | 5 +++++ > 1 file changed, 5 insertions(+) > Thanks, Reviewed-by: Leon Romanovsky _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 284B6C433F5 for ; Wed, 8 Dec 2021 09:28:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231225AbhLHJcO (ORCPT ); Wed, 8 Dec 2021 04:32:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229481AbhLHJcN (ORCPT ); Wed, 8 Dec 2021 04:32:13 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A396C061746; Wed, 8 Dec 2021 01:28:41 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id EABDFB81FFB; Wed, 8 Dec 2021 09:28:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9BCAC00446; Wed, 8 Dec 2021 09:28:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1638955718; bh=wPLoCgEiGSFzZaa084ljFEQkOegpE0+U9VnbZ8HMw0M=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=LuJrgbpgPLbIgIWCE1a0PvHDcB/xlrNqQOi0zfmZSruQTKn8m5BXD25ByikS3TIaB 3+j9MAoUf+fnf5zEEr9uMKC/SU62f9LoHn2SYDsSyAB6v3tjzkhfloxQ6Wmsfnq8V4 E8ITvnTd4C3kxB5vWMgp/ZC7NRY5xAipewdGpvXzz6s1SnWrDJBRFpskcrTrgJxuDH zarM0/6a6tbwy8d/lucdqyCMd7Bg0LVdf2nLeHrAHyE+1MIjFDRh77X3FkSvwMs8uR RQn9rgWA7O2Y+gc3sDB0NSFJwLVQI8fg3AY4dw/wQH3ILO7Pal8OhvLpbFCgpM+73e eXbfSGAAFbaww== Date: Wed, 8 Dec 2021 11:28:34 +0200 From: Leon Romanovsky To: Leo Yan Cc: "David S. Miller" , Jakub Kicinski , Mathieu Poirier , Suzuki K Poulose , Mike Leach , Alexander Shishkin , Jan Harkes , coda@cs.cmu.edu, Paul Moore , Eric Paris , Balbir Singh , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, codalist@coda.cs.cmu.edu, linux-audit@redhat.com Subject: Re: [PATCH v2 1/7] pid: Introduce helper task_is_in_init_pid_ns() Message-ID: References: <20211208083320.472503-1-leo.yan@linaro.org> <20211208083320.472503-2-leo.yan@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211208083320.472503-2-leo.yan@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 08, 2021 at 04:33:14PM +0800, Leo Yan wrote: > Currently the kernel uses open code in multiple places to check if a > task is in the root PID namespace with the kind of format: > > if (task_active_pid_ns(current) == &init_pid_ns) > do_something(); > > This patch creates a new helper function, task_is_in_init_pid_ns(), it > returns true if a passed task is in the root PID namespace, otherwise > returns false. So it will be used to replace open codes. > > Suggested-by: Suzuki K Poulose > Signed-off-by: Leo Yan > --- > include/linux/pid_namespace.h | 5 +++++ > 1 file changed, 5 insertions(+) > Thanks, Reviewed-by: Leon Romanovsky