From patchwork Fri Feb 4 13:50:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12735089 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 4B4ECC433FE for ; Fri, 4 Feb 2022 13:52:43 +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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=TK9wXZ8lbQhN9WdvWXCRMVJ77kmjKOFnVhc1+cj2mm0=; b=FnPH36KAWDyGPr Ikb0XkNo+my8emH1DyKc3BxyUKKMUDwfpqKwRS9epyKa/Wv4VaQasTtdV+bSflI6teiZ3K87aaJYB t+hFJ6ruXCUwI9KyV5EaXhD8qos+ATdpCGdEOCleXBRbeZ9+ct7nblz+Lu2FHdFAqyxPVNGrgjwd1 l5fm8o/NP0UCsqw8UcC9rm4239xHM65PH1o1PpIU9zom1HBTGAT2lTyrF9VLA4sojtVb4LzLdvbfu Jgy/74eWgY+fNaButWksVZ/4S6/Ade8uKULqqZnumYXJWTuH9D0jeqJ80V8sYy+kGzMPp1ryvgINC EctNFsYdB386A84v2CNg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFyzn-004Raw-G5; Fri, 04 Feb 2022 13:51:27 +0000 Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFyzc-004RY0-8Z for linux-arm-kernel@lists.infradead.org; Fri, 04 Feb 2022 13:51:17 +0000 Received: by mail-pg1-x534.google.com with SMTP id v3so5111029pgc.1 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=TSc7Z+2zuUpaqH9PCO6OwoNqlJ4wFcGakuAuyXkZ7kthv3NhcFzIOt6lIJnH9e6VRg hab6c33TjAdjAIZLI9A7RBlACfUBYYZqZMQKFGAbll4PiOhaM5nzGIV4zUAs0b3RI0Nu Iw0qJNuSfKcrqhdrdh5cKSdtFRqeQiHKTYZZ87lo0TEL4ZrumdSlPub4nSFMYUr94JeL BV0eqZTtZEnxeqnzSXY1HugI83HPkZFGoalVB367gPL8kfHyhEqoI5iEfqg1GmZkni6g 335Mxu5kL5DXdEueY4qYzgA4sZFR0pQmZDQ0bMkgROdaU49TZdUZ9mzk5glXduxK3CLG allQ== X-Gm-Message-State: AOAM531KFYJ7Q/BuCIuwRchfj51DLHPdCLQrxF9XZAxsEc8UvAgwgSRO aeSKgA8YLXddCHwnFsK2pvX/Kg== 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220204_055116_323240_C2D24E4A X-CRM114-Status: GOOD ( 11.32 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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) != &init_pid_ns) + if (!task_is_in_init_pid_ns(current)) return -EINVAL; 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) != &init_pid_ns) + if (!task_is_in_init_pid_ns(current)) return -EINVAL; ret = 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) != &init_pid_ns) + if (!task_is_in_init_pid_ns(current)) return -EINVAL; val = 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) != &init_pid_ns) + if (!task_is_in_init_pid_ns(current)) return -EINVAL; ret = kstrtoul(buf, 16, &val); From patchwork Fri Feb 4 13:50:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12735090 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 06EB3C433EF for ; Fri, 4 Feb 2022 13:52:53 +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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=m8Zm9smoZfi35/3IO90E/+9OI6DECyB+rVhPkxjfEfg=; b=dz76CS/pxXR/qi XpY12n5AHJaPgbf9TXZY/FELlss1hLLF4rN5BKt2QkEEvaPPE8Iyd+QsKRkgmB5C9EUC6FXwGqMSN pHcocgBMhGr8pvmEawAewgCVBkymQeiFL2feWrFHZRlfh8LA7Og0ErMXCDipOag8YJ1hNuzbha0XH Jw4pfiyczsuq4Ocb4Nq2C1F3H4IQZBnJW5vgDZmVxJzH5umy2PIrrA2xxMlaDtxDa+U+b+/u4Wemq 7cu0LIUVG6yCmmySb2AnJNIH6saPIhGaRQTEfvFT2ug7UXKmZu0vOpxqzYPI6guZ8mLXpHpMhrd2v /A0uATuoTGqwbOc0sZ4A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFyzx-004Rdz-AK; Fri, 04 Feb 2022 13:51:37 +0000 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFyzg-004RZG-UD for linux-arm-kernel@lists.infradead.org; Fri, 04 Feb 2022 13:51:22 +0000 Received: by mail-pl1-x62f.google.com with SMTP id t9so2984462plg.13 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=EbfGk6p0wprvsVleCUgUz/4Cu5z1YfCw62xTt4g+RFS8H9csP9tYkqD3gqahewyrfw PczJrKFMorzHmKhw1ZCf64is29hGsgx+DGRMvkYadEodYKjFUMJgnsqmdAvkzoTC+OeK naSbpBo6Tw/XXxtd3siGfuR3AQFOv7uapT6czgM/WFaifFTFvtNttKg5LFPnfm6+rjIM GHOGO5MwxLxRe0w/ZPArfNoWqJYjU0YyV3JFiJLvu/APWHszQ3BllTkqVo5yJm+yPNUJ DuoFI3918T5iIc0ThXKGdgVTJYposqriYyRVZc7BycIR20luv67/GWX4ZbdAp9v5DC9T t48A== X-Gm-Message-State: AOAM533eAGtpluPV4AH+sAi1AK09cfZZqQQYx4tyvcZae5nzlIhrvnpy Z/yHcgyJXhFbcOmjeKX6bsHxRQ== 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220204_055121_001099_F25F9A81 X-CRM114-Status: GOOD ( 11.17 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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) != &init_pid_ns) + if (!task_is_in_init_pid_ns(current)) return -EINVAL; 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) != &init_pid_ns) + if (!task_is_in_init_pid_ns(current)) return -EINVAL; /* @@ -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) != &init_pid_ns) + if (!task_is_in_init_pid_ns(current)) return -EINVAL; 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) != &init_pid_ns) + if (!task_is_in_init_pid_ns(current)) return -EINVAL; /* From patchwork Fri Feb 4 13:50:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12735091 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 93E48C433F5 for ; Fri, 4 Feb 2022 13:52:58 +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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=RUa0+KUYb0oH+g/qbxCVWat7AZ8b8omYioXMKui95oY=; b=GVJkWnY2UnConm aHoNFoj/1Rwwt6u+BXCLz0D0kIxIFLrO9X+sLifIb0uklIzCzlMc3Xm2BfgDtxe+yJFiSoI9donKF H9i91YtdRPO0gx9p+/itZiZ/Le1/hvH9TZKyCg+nb3IMhgkvbbbaSaNq729cqx3ILsL1JD+fcqM6r F6i08/jfCIAtkhk+f5eXQtfiqYFG94baydRORoMd3K96HtAfKD7PndgzTSMVj1tpTkXQ9hasD4LjT 5AMFQLq74PelaiP54jAwgSvwtHTD+02DroH3QwSeUk+yCEJQAlKLteQ4VkJ456sSTbvhNeipDtZZ/ ClDWwjPYs9ZwIdbGRdHw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFz07-004RhB-QH; Fri, 04 Feb 2022 13:51:47 +0000 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFyzl-004RaE-DF for linux-arm-kernel@lists.infradead.org; Fri, 04 Feb 2022 13:51:26 +0000 Received: by mail-pj1-x102e.google.com with SMTP id h20-20020a17090adb9400b001b518bf99ffso13157787pjv.1 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=Cx7Bu0v/vulRPRer/NnO2TpjPHA3nchbH3A/trbu19JScoxU1Vi4O0skuDiH8YrVrg spIYprAT2OE8eWihVn+Vo/mEIAYKrS8bcMvWeS/TtJ4bgG4dUbeI/NNdnN5IAMZ2V+T5 B14vAvUicEJns9+2o3+FWWZZKkVC+AmKoXnwUJgqT4mONLDWVxLPl+60bj7tAwoGYgcI T3iFktczb+Tcr8eixZFJ9MZaQU9Eenj1PO9JvIYet5dVpIejTlg66TUL6iIn02jQvjSz gS17U07RpfrC0v5esfKtYPAUjCxZRMdYiJ1dV3HyOF1L0F0jwKM34OdNgMnyDalFU2PA 1R2g== X-Gm-Message-State: AOAM533Xc7wifh/T3ZXUGSolxgNR0JQgN+1rrmRRk6DkmisjEqJMQx9b R8WJJ6ab2faz09D4a49TLvqkmw== 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220204_055125_466372_82A3B8DA X-CRM114-Status: GOOD ( 12.25 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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; - if (task_active_pid_ns(current) != &init_pid_ns) + if (!task_is_in_init_pid_ns(current)) return -EINVAL; idx = 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; - if (task_active_pid_ns(current) != &init_pid_ns) + if (!task_is_in_init_pid_ns(current)) return -EINVAL; if (current_user_ns() != &init_user_ns) From patchwork Fri Feb 4 13:50:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12735092 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 307B7C433F5 for ; Fri, 4 Feb 2022 13:53:12 +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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2V+Ki5Tiar9/YXIcidUEmByX29nabFhF/E/B+fRevjQ=; b=UdCmBv/nIzuGbj 56caqZPvz6zehPlpTV39ymUa0bpw5mOnFh+KQ3yOBFNk+bai6TwQZ8DGldI0W5R2de+Qpx83hvlwP ivNVK6Hxd0/5lM1zuZL6Ae4OCTIuP4dB2QdzolMhXV1WU7M+cLoHuXJMBPRGCWQgoTH7+o3lNzK55 FdKC2xT6zUx0YfKdtnbX4aW1kFsjpdgFfXSUETS043WaopPq170nsZxJMm7MrRUAxPz19ok4G7+05 aECiil3vLEJyg3LvDvNvsYuVCC6T93ZRtqIg3Zc3T1SCBpcUzCLVPKYJOQ1pDhJaKHwXwtOErAfbO JPBjicMoIAaVxmmyLI8A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFz0J-004RlD-Qr; Fri, 04 Feb 2022 13:51:59 +0000 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFyzp-004Rbs-Jf for linux-arm-kernel@lists.infradead.org; Fri, 04 Feb 2022 13:51:30 +0000 Received: by mail-pl1-x635.google.com with SMTP id z5so5188405plg.8 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=XCPMoGdN2kRIitQZ/9ojrByidHZdeZNAuMnoz893knsd6Dg53qUMCwsnMqKxS9IFN0 poBDHXEgmGNNjlt6TYazJt+oW64FGNNVSGZurRj2hDnlaDEA8/pWkYAPDw3oIzTEUSiN JflgjPelNWjLoUhjvzdPAud7Hgy5RVznBTy4gHyOwwNKjfWK0/lYxv2W/HN60UeIAign 4NYElMM7hL3gQZvu1gJNtjQai/1gJq0mhxuD4DATjpFN55eRbp3zz3CYjSC5zMOaDW4c loV2lHhMSJ3iHkSVlhNxB48lhrA26dpGLJQDM6Kv94Auk0dWzblu3MdJR5lj8Wq2E+Ow z/Bg== X-Gm-Message-State: AOAM531/u0bef3NajEJpKNQ5FYNjklc3cZL01wgtQL09RQ79wU/p5C5i J4MYMSXl1mPw6Hk/3rdq3a1ngQ== 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220204_055129_686485_5EC5B969 X-CRM114-Status: GOOD ( 12.30 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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) != &init_pid_ns) + if (!task_is_in_init_pid_ns(current)) return -EPERM; if (!netlink_capable(skb, CAP_AUDIT_CONTROL)) From patchwork Fri Feb 4 13:50:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12735117 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 9CB3CC433EF for ; Fri, 4 Feb 2022 13:53:35 +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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=h0ElYqk4Mpk1M2g2ylhMHxwj6t+OemnNtCEGW21OcVI=; b=uNz4WJTCWiTVm8 VC28WvJjF/ZKZfZEnZ00eHU4l7+IHpdsuXq2I/DWphivWWFaC6KDT+rxgJ1RngFyFSv1FInKSW/Cv SIjiwhwv9kHCdVIPVLlaIe0o7C9lYUNpV0A5sNLsKuNX8yBJEe2qPqMLmapnx5LRVVN4aL09n9aIW 3w5qeE0PIaSc+nbFT0Ivgs2ShiGoF1br66ycm+HjSXTTFPz+O42waU2XVKJojt5kCMDfgpS5o/K2T krUIcQJhim3L9Sma0v1tSeDDu/FHFKqwUMEWYdQVp7CrNX+rmWT/Jyqu69eW7NWRU3Yr2Uw3vVas9 PRD7sIp1AQAw2iwSa7Zw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFz0h-004Rvl-GN; Fri, 04 Feb 2022 13:52:23 +0000 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFyzu-004RdC-Vw for linux-arm-kernel@lists.infradead.org; Fri, 04 Feb 2022 13:51:36 +0000 Received: by mail-pf1-x432.google.com with SMTP id n32so5142087pfv.11 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=Ta7SGN4lLhwePaHUUk3r/jzEVw53IIGuzVtvLLPzG+Wgphgzmmfs4HUUouS3Mdj8w0 1lw08rE+rLox2qaFuBarZrbgwT7fwVtUFOvooyXIyzEZAf8cYwK6IMOlv6iBc0ZRLyXH x1Z6KI2NFks3WHVp0YjAE0RFcj4ZSmt+w9LLBATfvYctXb9mGu+O5jIZQSuu8tgfUbFU pLP0g/QXWc6bR+txuPGroaLA9BabNTT/coHCwzQQQJQLKY3VlRnYjRGNhcR2LW9Q6Fcf oOEH5Qdnw6Q4PHqxk0Er9CeNut49fZsyLlcaZ3u0XjSdsRPlRXMeSTh7qIyUSPQGTw1Q eY+g== X-Gm-Message-State: AOAM531GljyUPSxtCdDHpSAciUU6PpJa0Jlyw6t+3hpvYfRjQHZYhLMS 4OsPsePacvNVD9e9oxOrcLud3A== 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220204_055135_048805_E7847BDC X-CRM114-Status: GOOD ( 11.93 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 cpumask *mask, int isadd) if (current_user_ns() != &init_user_ns) return -EINVAL; - if (task_active_pid_ns(current) != &init_pid_ns) + if (!task_is_in_init_pid_ns(current)) return -EINVAL; if (isadd == REGISTER) {