From nobody Mon Jun 29 18:40:05 2026 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 49992C433EF for ; Fri, 4 Feb 2022 13:51:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359031AbiBDNvS (ORCPT ); Fri, 4 Feb 2022 08:51:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359024AbiBDNvP (ORCPT ); Fri, 4 Feb 2022 08:51:15 -0500 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E0AEC061714 for ; Fri, 4 Feb 2022 05:51:15 -0800 (PST) Received: by mail-pf1-x42e.google.com with SMTP id e28so5161417pfj.5 for ; Fri, 04 Feb 2022 05:51:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Ond/4ABfTjnzyDWR3gs46S4b6+8tS7qKpB/Y7mDbdaU=; b=wmlsCgXM1ZaxWZmmTNRiTDHSrz4QZlpOzZcHzw4wQJiCEZCQAFYI8HJqRGCtWiyhW5 A6RdVRtdiDEoKdYM5Sop7Q2XFzudD/dkrNdDU2rPne5G+FoBWunbKI5WkgjDbHZgsgPg slaahwwbp5z0P1jkNYAz8ukILBZ6mD+OwGKo2xDeSis+I39UgyeucUSK7LuBZYjhu+wP Sfz5xV4T0dF/fqK/mJ/TfKm7yzf5/EQes4xKNNMNQNT+1CiAnBzqKz6Bax9uWY/2Ehlz EXVuhXuXUTZC8c0wzkDmoYJOZykctJNjVnnyXYOIdmTnbTA1keOgnEWuW00zyLhaXwyB svoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ond/4ABfTjnzyDWR3gs46S4b6+8tS7qKpB/Y7mDbdaU=; b=6BBzRf+fr5pw2mXWpDFQHbPmKP4ZFtHK/y/FFgh6Sdf5yqlwgijhWziItdoug61nsg sFYlZQymOktl2o8ymxgG1Lvo7rAdKrmbpY1NRJ+q0cMZrIxB3XSTPI7bglsjCEL7PDpB 2ADi3yShl5K6vCU0Jf50CRn5of33dxWa/nAFBQqTDrd9v4X9bfFgVNUjz4joxWanqgV2 AkO2clX4+aAO2AEmJrqlazBVv+yU6U/MHLrdWML2isvFpz+SnzbcnoNWVm/qJ9KPyyWL 9G/OaWiTo2s2ikYQBNIBlfRfR4fEWxqvUykFyB2zwz4RHcbAjF14iayGYRkelW+woimp AI4A== X-Gm-Message-State: AOAM533t2Jlq9wPufy+2tD+F8FiHNOBmVgoq3InrzO+Po7fsWouZW/JO Ltt+ZUO896/+EWT6XFv2M4CuUg== X-Google-Smtp-Source: ABdhPJwuvtNdZ9Ta6hHt9CUE+CDUNaZXCQXeOpieEryVkd24lqRO4trnQ3j/8j76oVJ/K1+jjs/4xw== X-Received: by 2002:a05:6a00:804:: with SMTP id m4mr3169177pfk.45.1643982674946; Fri, 04 Feb 2022 05:51:14 -0800 (PST) Received: from localhost.localdomain ([134.195.101.46]) by smtp.gmail.com with ESMTPSA id 13sm2668131pfm.161.2022.02.04.05.51.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Feb 2022 05:51:14 -0800 (PST) From: Leo Yan To: Mathieu Poirier , Suzuki K Poulose , Mike Leach , Alexander Shishkin , Jan Harkes , coda@cs.cmu.edu, Paul Moore , Eric Paris , Balbir Singh , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, codalist@coda.cs.cmu.edu, linux-audit@redhat.com Cc: Leo Yan Subject: [PATCH v4 1/5] coresight: etm3x: Use task_is_in_init_pid_ns() Date: Fri, 4 Feb 2022 21:50:47 +0800 Message-Id: <20220204135051.60639-2-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220204135051.60639-1-leo.yan@linaro.org> References: <20220204135051.60639-1-leo.yan@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Suzuki K Poulose Acked-by: Balbir Singh --- drivers/hwtracing/coresight/coresight-etm3x-sysfs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm3x-sysfs.c b/drivers/= hwtracing/coresight/coresight-etm3x-sysfs.c index e8c7649f123e..ff76cb56b727 100644 --- a/drivers/hwtracing/coresight/coresight-etm3x-sysfs.c +++ b/drivers/hwtracing/coresight/coresight-etm3x-sysfs.c @@ -1030,7 +1030,7 @@ static ssize_t ctxid_pid_show(struct device *dev, * Don't use contextID tracing if coming from a PID namespace. See * comment in ctxid_pid_store(). */ - if (task_active_pid_ns(current) !=3D &init_pid_ns) + if (!task_is_in_init_pid_ns(current)) return -EINVAL; =20 spin_lock(&drvdata->spinlock); @@ -1058,7 +1058,7 @@ static ssize_t ctxid_pid_store(struct device *dev, * As such refuse to use the feature if @current is not in the initial * PID namespace. */ - if (task_active_pid_ns(current) !=3D &init_pid_ns) + if (!task_is_in_init_pid_ns(current)) return -EINVAL; =20 ret =3D kstrtoul(buf, 16, &pid); @@ -1084,7 +1084,7 @@ static ssize_t ctxid_mask_show(struct device *dev, * Don't use contextID tracing if coming from a PID namespace. See * comment in ctxid_pid_store(). */ - if (task_active_pid_ns(current) !=3D &init_pid_ns) + if (!task_is_in_init_pid_ns(current)) return -EINVAL; =20 val =3D config->ctxid_mask; @@ -1104,7 +1104,7 @@ static ssize_t ctxid_mask_store(struct device *dev, * Don't use contextID tracing if coming from a PID namespace. See * comment in ctxid_pid_store(). */ - if (task_active_pid_ns(current) !=3D &init_pid_ns) + if (!task_is_in_init_pid_ns(current)) return -EINVAL; =20 ret =3D kstrtoul(buf, 16, &val); --=20 2.25.1 From nobody Mon Jun 29 18:40:05 2026 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 25DAFC433EF for ; Fri, 4 Feb 2022 13:51:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359024AbiBDNvZ (ORCPT ); Fri, 4 Feb 2022 08:51:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359038AbiBDNvU (ORCPT ); Fri, 4 Feb 2022 08:51:20 -0500 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 513EAC06173D for ; Fri, 4 Feb 2022 05:51:20 -0800 (PST) Received: by mail-pl1-x631.google.com with SMTP id c9so5180261plg.11 for ; Fri, 04 Feb 2022 05:51:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gYlHTKZwf3eLsDFK6/setIM6v4QyZpE5drcppDSgIrA=; b=pC1m2fQqzS3hTahuKDM+7c0QgFbpmg/lU10YDP/xIO9xlFrADUvnPyylLcudQm3HwS Mzkkzt+rfEVA3WC0spzFoQljr9eb513PHecSpght3nP9WlMtWD82drPNmjTwj2mvE4Hw dda8ht3nPEpJgAN2CREnIOfJRLXHjHbQeB2ZhAblgc8q7hxEozF3onzdmNId7clG2bjG ZEcuTQGcQ4c13Pw562dtlPFppp2B2IJWZZ37JZn5MAfn6uEuGdVTV77pnXlo4nMI3f7Z 5DK0AovtSLJeoY5vHqtvQx1s9VVbD+XNEoRLYXqeTTG7T9xy4bGxsPnJg085fug37uZQ 5CBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gYlHTKZwf3eLsDFK6/setIM6v4QyZpE5drcppDSgIrA=; b=oAYqKXVpi6ULAlBptybGVwdy8CwtzW1KM7Z8uX9aJMHLfnMXr3GIA4nBZcHmtWLC9u iuAyvVKlfKGKEuVjHSvs83eTTIjJwQ1mjU4hYXlUUMV0uCHgsARTuG8OnjeE1HJVf/0X KvduiST16KEOtvXvmWWIWLxQcLAHpNhdGmhIbz5R8QQ0fKMEMheRy0xFQObSqdfVU2kZ L5xjgDHXugDx3/m6Y46ubSsU0bGNj2W3ciIAdXCzbkrGNtewH2pcGPwSjMqa6opm07Vi v5O4CsBwbWFVK9BwOV0CuKGQqMCXAf0qN5jM36xHppZshpFLFTWQIW/cWBvEQFp3eTjY fXuA== X-Gm-Message-State: AOAM531iBFpPm7gaZMHeyFv52B/XYHIaPgGkrsjmH3Kzzuh7EOkK5dt9 xYUkjI7cYFbas0M9n8HoCcvPTg== X-Google-Smtp-Source: ABdhPJy/zWH1p1cq5ydscrQgno2r1v4rJtuFkahMNvFLmLQ8bff4NDmYnoTUSpUlIlE29DeDFErTXQ== X-Received: by 2002:a17:90a:f485:: with SMTP id bx5mr3247440pjb.46.1643982679691; Fri, 04 Feb 2022 05:51:19 -0800 (PST) Received: from localhost.localdomain ([134.195.101.46]) by smtp.gmail.com with ESMTPSA id 13sm2668131pfm.161.2022.02.04.05.51.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Feb 2022 05:51:19 -0800 (PST) From: Leo Yan To: Mathieu Poirier , Suzuki K Poulose , Mike Leach , Alexander Shishkin , Jan Harkes , coda@cs.cmu.edu, Paul Moore , Eric Paris , Balbir Singh , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, codalist@coda.cs.cmu.edu, linux-audit@redhat.com Cc: Leo Yan Subject: [PATCH v4 2/5] coresight: etm4x: Use task_is_in_init_pid_ns() Date: Fri, 4 Feb 2022 21:50:48 +0800 Message-Id: <20220204135051.60639-3-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220204135051.60639-1-leo.yan@linaro.org> References: <20220204135051.60639-1-leo.yan@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Suzuki K Poulose Acked-by: Balbir Singh --- drivers/hwtracing/coresight/coresight-etm4x-sysfs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c b/drivers/= hwtracing/coresight/coresight-etm4x-sysfs.c index a0640fa5c55b..10ef2a29006e 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c @@ -1890,7 +1890,7 @@ static ssize_t ctxid_pid_show(struct device *dev, * Don't use contextID tracing if coming from a PID namespace. See * comment in ctxid_pid_store(). */ - if (task_active_pid_ns(current) !=3D &init_pid_ns) + if (!task_is_in_init_pid_ns(current)) return -EINVAL; =20 spin_lock(&drvdata->spinlock); @@ -1918,7 +1918,7 @@ static ssize_t ctxid_pid_store(struct device *dev, * As such refuse to use the feature if @current is not in the initial * PID namespace. */ - if (task_active_pid_ns(current) !=3D &init_pid_ns) + if (!task_is_in_init_pid_ns(current)) return -EINVAL; =20 /* @@ -1951,7 +1951,7 @@ static ssize_t ctxid_masks_show(struct device *dev, * Don't use contextID tracing if coming from a PID namespace. See * comment in ctxid_pid_store(). */ - if (task_active_pid_ns(current) !=3D &init_pid_ns) + if (!task_is_in_init_pid_ns(current)) return -EINVAL; =20 spin_lock(&drvdata->spinlock); @@ -1975,7 +1975,7 @@ static ssize_t ctxid_masks_store(struct device *dev, * Don't use contextID tracing if coming from a PID namespace. See * comment in ctxid_pid_store(). */ - if (task_active_pid_ns(current) !=3D &init_pid_ns) + if (!task_is_in_init_pid_ns(current)) return -EINVAL; =20 /* --=20 2.25.1 From nobody Mon Jun 29 18:40:05 2026 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 922D0C433EF for ; Fri, 4 Feb 2022 13:51:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359056AbiBDNv1 (ORCPT ); Fri, 4 Feb 2022 08:51:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359045AbiBDNvY (ORCPT ); Fri, 4 Feb 2022 08:51:24 -0500 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF5AFC06173D for ; Fri, 4 Feb 2022 05:51:24 -0800 (PST) Received: by mail-pj1-x1031.google.com with SMTP id s2-20020a17090ad48200b001b501977b23so13155668pju.2 for ; Fri, 04 Feb 2022 05:51:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kWkrWIVd0/tR6K54G/x68wI67h0lySobA9zdXOmvIu4=; b=ZjDAUHdvFm23PkDB88Y/g/RhqrfOS166LoUKOx5kLqEJVAfTEptWR30Yy2o02xcBjs wWzsXg6LJBvz2Eat79+CLZwuDAa5aoD1sDJzsb/MRdCQx2nHa09K5nmMa2HzN9rNEN1y J9OzGZ6bq3MFnXpMWCX7R9JFQjyx7xvrQ41jU8/5AdjHE1o5eKyePd3Op9HPm896ducL p8AF+I806JejVmLZBkheAgZhisIt4LuDOmBb5FIo7FHALMGh6CxXztZcc6LzBawUefz3 8zJA0OKFevHfdUBGrMQNdgDBIyMavlG5FwYJk4SmYkq9jrHTLj89FeyKimQ032V1T5Zm C2vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kWkrWIVd0/tR6K54G/x68wI67h0lySobA9zdXOmvIu4=; b=OIT2dyxcgdll+Y+SnMv3dfCnieW3mRbMQLGOixurOrPhWvRLGxF7AQDJVib+oxGSOn MXXiH4QlvJ5te4dUPDa2R1iAOsi7+1GFmlovze3SZzlx2OsehdJ+C4Ui113NMj9msjot C5NKqsgX4Lv8Vot9QHGQSsJxOQt9PIJOjp6P9elTpiLeCsMB5JBHV1tS7SuUgXkZxrXQ ZWfAvTQ4CtCYJ6LaS7nttsrLN8Z04GmU/X+u2LAHIRijqsZ4D/jJ4LOLdZsmsmJkGwBD TfrguLFVWnsvFq1lfCYe0SlaU+IiUZxdRb6ANvXqe8k32CGYK4n+NppnU+0Jk8WShVOV kNsA== X-Gm-Message-State: AOAM5319XfqzvfN4bzWXovHAl4f12WU1s6zXfWxF5lX/5djLp+mBHEAa 3RdDSKCQxhMuW0psa3EBJ7uxLQ== X-Google-Smtp-Source: ABdhPJzzlHgPllMAQLi0+cpFqx1ccciJ1GkPw437Mdlv75oiqnu9xqBhEbHOtdYvZHhrvF3MASLJ0g== X-Received: by 2002:a17:902:db0b:: with SMTP id m11mr3093004plx.104.1643982684308; Fri, 04 Feb 2022 05:51:24 -0800 (PST) Received: from localhost.localdomain ([134.195.101.46]) by smtp.gmail.com with ESMTPSA id 13sm2668131pfm.161.2022.02.04.05.51.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Feb 2022 05:51:23 -0800 (PST) From: Leo Yan To: Mathieu Poirier , Suzuki K Poulose , Mike Leach , Alexander Shishkin , Jan Harkes , coda@cs.cmu.edu, Paul Moore , Eric Paris , Balbir Singh , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, codalist@coda.cs.cmu.edu, linux-audit@redhat.com Cc: Leo Yan Subject: [PATCH v4 3/5] coda: Use task_is_in_init_pid_ns() Date: Fri, 4 Feb 2022 21:50:49 +0800 Message-Id: <20220204135051.60639-4-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220204135051.60639-1-leo.yan@linaro.org> References: <20220204135051.60639-1-leo.yan@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Replace open code with task_is_in_init_pid_ns() for checking root PID namespace. Signed-off-by: Leo Yan --- fs/coda/inode.c | 2 +- fs/coda/psdev.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/coda/inode.c b/fs/coda/inode.c index d9f1bd7153df..931f4560fdd0 100644 --- a/fs/coda/inode.c +++ b/fs/coda/inode.c @@ -152,7 +152,7 @@ static int coda_fill_super(struct super_block *sb, void= *data, int silent) int error; int idx; =20 - if (task_active_pid_ns(current) !=3D &init_pid_ns) + if (!task_is_in_init_pid_ns(current)) return -EINVAL; =20 idx =3D get_device_index((struct coda_mount_data *) data); diff --git a/fs/coda/psdev.c b/fs/coda/psdev.c index b39580ad4ce5..73457661fbe8 100644 --- a/fs/coda/psdev.c +++ b/fs/coda/psdev.c @@ -270,7 +270,7 @@ static int coda_psdev_open(struct inode * inode, struct= file * file) struct venus_comm *vcp; int idx, err; =20 - if (task_active_pid_ns(current) !=3D &init_pid_ns) + if (!task_is_in_init_pid_ns(current)) return -EINVAL; =20 if (current_user_ns() !=3D &init_user_ns) --=20 2.25.1 From nobody Mon Jun 29 18:40:05 2026 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 6CCDCC433F5 for ; Fri, 4 Feb 2022 13:51:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359059AbiBDNvg (ORCPT ); Fri, 4 Feb 2022 08:51:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359062AbiBDNv3 (ORCPT ); Fri, 4 Feb 2022 08:51:29 -0500 Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97974C061744 for ; Fri, 4 Feb 2022 05:51:29 -0800 (PST) Received: by mail-pl1-x633.google.com with SMTP id k17so5242918plk.0 for ; Fri, 04 Feb 2022 05:51:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jHiD4MZsT86vIRdRdRlX5LZloPcWWK9EQ4fdq/sL1Xw=; b=XddfgqU7OpX9vruzWD+1hKmS2fgZLoAmSviJEa6Bt4GOAiLOXFbXNfZWds/PtwoXBI zh2aSqxht1r4J7fMsBrYsNgY50Y9PHxe68Kan4djBgizWIdgOjyB9bL2BWmGgIQ79o+T VNAXhbeMt8LjP2o56beGyrkiVM7tZNIFwBBNNBCg6TtI3K5AAyIVSz8oUanaTi0hsFbJ 4UHwbdWdZpBi8hhS48cnbLobfT7xGwVI3fmW19PxsRimm7C5rSE+YjW2uNAQgVbxlklt syRtsUGm1KF/9LwBmPUMECk0WkFTK0mPUwpaATSf+Tnoa7XfXzIMsTj3LQuDVd9iqzA7 iv5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jHiD4MZsT86vIRdRdRlX5LZloPcWWK9EQ4fdq/sL1Xw=; b=f+FHB2zXbPVNdkjxe9J8uFunyiSte5Rcu0Dc1JK2n1Wx2ikFsRiNNa8NdKcvnMncFF sPeZc0nsLIOuBEAVGfv+iT/Llp3r/kZJV23x3pYnsL20GKJ6CwCxn2W0YOXX3PRdnVG9 rhkS0wA9Fz+mn8II+A8ihWld12RtT3CFl5g6zb13GKwFL4RENV51fAiTdnelXdCg8RmS XhkjGD6hYdl2i8yZSG3c+eQ9DEH/m6ULIMan5MSm5056NqOb60iHbtBVp9CSIZ2zmyw6 i0X2T1Q8DIiKh8VE7NXxvck03Ngr68pzBCpIxo0Yw5OYpDhpsebsLjZGweUs9u5i0Psd A0wA== X-Gm-Message-State: AOAM532Kn4b07FhXMXTaFGvDxGGzQZnLemRO+/0vPeVWF5lRZi6F2h4v 7R4dWttoQVUXcVMP7eJPvSQ0iQ== X-Google-Smtp-Source: ABdhPJxICqla4E74jvOrFuoYt2TchjK8Wbbi/Rm9tdVZAG7tiXooKMjmsnAOesCdgglSCvqHC/9VIw== X-Received: by 2002:a17:902:c209:: with SMTP id 9mr3104089pll.119.1643982689012; Fri, 04 Feb 2022 05:51:29 -0800 (PST) Received: from localhost.localdomain ([134.195.101.46]) by smtp.gmail.com with ESMTPSA id 13sm2668131pfm.161.2022.02.04.05.51.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Feb 2022 05:51:28 -0800 (PST) From: Leo Yan To: Mathieu Poirier , Suzuki K Poulose , Mike Leach , Alexander Shishkin , Jan Harkes , coda@cs.cmu.edu, Paul Moore , Eric Paris , Balbir Singh , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, codalist@coda.cs.cmu.edu, linux-audit@redhat.com Cc: Leo Yan , Richard Guy Briggs Subject: [PATCH v4 4/5] audit: Use task_is_in_init_pid_ns() Date: Fri, 4 Feb 2022 21:50:50 +0800 Message-Id: <20220204135051.60639-5-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220204135051.60639-1-leo.yan@linaro.org> References: <20220204135051.60639-1-leo.yan@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Replace open code with task_is_in_init_pid_ns() for checking root PID namespace. Signed-off-by: Leo Yan Acked-by: Balbir Singh Acked-by: Paul Moore Reviewed-by: Richard Guy Briggs --- kernel/audit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/audit.c b/kernel/audit.c index 7690c29d4ee4..4dfa58865d9a 100644 --- a/kernel/audit.c +++ b/kernel/audit.c @@ -1056,7 +1056,7 @@ static int audit_netlink_ok(struct sk_buff *skb, u16 = msg_type) case AUDIT_MAKE_EQUIV: /* Only support auditd and auditctl in initial pid namespace * for now. */ - if (task_active_pid_ns(current) !=3D &init_pid_ns) + if (!task_is_in_init_pid_ns(current)) return -EPERM; =20 if (!netlink_capable(skb, CAP_AUDIT_CONTROL)) --=20 2.25.1 From nobody Mon Jun 29 18:40:05 2026 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 736DCC433EF for ; Fri, 4 Feb 2022 13:51:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359093AbiBDNvi (ORCPT ); Fri, 4 Feb 2022 08:51:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359094AbiBDNve (ORCPT ); Fri, 4 Feb 2022 08:51:34 -0500 Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56DB4C061714 for ; Fri, 4 Feb 2022 05:51:34 -0800 (PST) Received: by mail-pf1-x431.google.com with SMTP id e6so5140353pfc.7 for ; Fri, 04 Feb 2022 05:51:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Jv+1OmXtq7K+DesUXAvsMwR+pbzMT8EaUquwRsw8P1w=; b=k1VUyxVms4sQJMDeZ2D5pmurOg1fSQ8xquL1QIhyqL8rIZizg8PasccYo1eWWzKDzi y8LTWj3d/DbmgV5lF9Xg6DtTq4BStjnhB/5dvVXrC2SBrkxEfvrqMyxdA+z1NkmBG+at 0F37rzV+FxleMELbtw45SKDKQyFgK8NT9kmB5lbEyGkP7HqLaLJb0hINRIZnimovmBlB H0srfNL9Q1+MQOxqZCOK4O6T/UcF9o2SP4va27CLyyWsalzm6E2xTYKSvYiDzIeOYpSL a0nw3lQJNehoOWPikNvb7gaIVcX8uxqCO4xLKCt+GyNhBr0LRvR8DZ4alQxV4nFYFPQp R1+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Jv+1OmXtq7K+DesUXAvsMwR+pbzMT8EaUquwRsw8P1w=; b=4UaDfWx9viBUIJHQnDG6dzFjux2vKgTaz4LZ2QKreShkNt49Y9v5F88pqgYPuiONPG kJhKwci2ELpZEtUbnMBXskdA9Uf/sKeI7tV15pxLMCNJzuGi3bW0C/qe0+hWAPoa3XYf eRRC43RCLs/FoiXdJA7A85p9/XYW7tJrZnz8YxUYuDNrKAbw8cYH6P9SW40NnlVpxNO1 X9cl5qyvMBg3QliKCL1X6Auo4dlGpiSmvnrZ9mYZ3W2mNp1G6Vzo9YA+g6F3cWe8Ej87 rOXQXBq6fuZUGI4OtASPumQ56IzxbbLe7UbCJju6bTpGSnaWV5anvHKGApLvARNnwTGS hF7g== X-Gm-Message-State: AOAM5316S3xt8ceJCX0ZyyMG08AonFx3JRn0k+tn8LngsGhCdcuePFqw NFXPHBmE2vrm0JKAZ42rO+suFA== X-Google-Smtp-Source: ABdhPJx/XYFD3O/Lx16uh03/xIMBlys471qWZKbIAGTGwKweGLijHoTj4ObsGkqbSS/36TwwZ4ZMAQ== X-Received: by 2002:a63:3285:: with SMTP id y127mr2457121pgy.32.1643982693736; Fri, 04 Feb 2022 05:51:33 -0800 (PST) Received: from localhost.localdomain ([134.195.101.46]) by smtp.gmail.com with ESMTPSA id 13sm2668131pfm.161.2022.02.04.05.51.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Feb 2022 05:51:33 -0800 (PST) From: Leo Yan To: Mathieu Poirier , Suzuki K Poulose , Mike Leach , Alexander Shishkin , Jan Harkes , coda@cs.cmu.edu, Paul Moore , Eric Paris , Balbir Singh , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, codalist@coda.cs.cmu.edu, linux-audit@redhat.com Cc: Leo Yan Subject: [PATCH v4 5/5] taskstats: Use task_is_in_init_pid_ns() Date: Fri, 4 Feb 2022 21:50:51 +0800 Message-Id: <20220204135051.60639-6-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220204135051.60639-1-leo.yan@linaro.org> References: <20220204135051.60639-1-leo.yan@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Replace open code with task_is_in_init_pid_ns() for checking root PID namespace. Signed-off-by: Leo Yan Acked-by: Balbir Singh --- kernel/taskstats.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/taskstats.c b/kernel/taskstats.c index 2b4898b4752e..f570d8e1f001 100644 --- a/kernel/taskstats.c +++ b/kernel/taskstats.c @@ -284,7 +284,7 @@ static int add_del_listener(pid_t pid, const struct cpu= mask *mask, int isadd) if (current_user_ns() !=3D &init_user_ns) return -EINVAL; =20 - if (task_active_pid_ns(current) !=3D &init_pid_ns) + if (!task_is_in_init_pid_ns(current)) return -EINVAL; =20 if (isadd =3D=3D REGISTER) { --=20 2.25.1