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 5E358C43217 for ; Sun, 5 Dec 2021 14:53:09 +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=JwDz8fXRAR94BRX5B2804jdBeGmPoaW6fiJ9pYQuwQg=; b=d362jxUeamBQ7I EMa7iTcAP7P4shoGr3eFui37wPe/gTf3FBahJ0xPuwgUusAOMRg6jjlB8t4YcetLfEfaOSGHMlRoB 9TaeaJbiqb8xHV3cbfK2UlSObgOOeggT2wzYXu6ntsvHG0Syg5Sw2o9yNKubV0J7kP0g9WrnnNeW6 AKt4RmXYwBQ7l9+7OMQCDXoQIv+hSnd3UshyhUpfKWEZa9x7TcW03WJfuZAA5TX+9QA46t806z0vs OveOcZGMTzogFArTSTDTDwPyo70dPugX8ly+MDqtoePCv+29z8VpBYJzLpGKrj3RGSQ5JLMgFO6CE 8P8rf5/dty37eiCRYxKg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mtsrn-001YEy-99; Sun, 05 Dec 2021 14:51:51 +0000 Received: from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mtsrP-001Y8O-Ot for linux-arm-kernel@lists.infradead.org; Sun, 05 Dec 2021 14:51:29 +0000 Received: by mail-pg1-x52a.google.com with SMTP id 137so8022647pgg.3 for ; Sun, 05 Dec 2021 06:51:27 -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=r7FuDJBkqmbrNZ8AuyY2ToeqGTn3J1mJtK8z1ItIbdE=; b=QHCE7EcZHC03zy6MaqNqCBN+Fpm5uAGmWmVntGtp7U5n/wHjBc1F3Kdy8R5DdkiE6C CQQk3ZM5MTTKy0JcD6PEeBIml/H2OvjS1+XE7GeIX4nSPB+wH6DbJa5EN7/rSbhr8huE UHqFfcSu5fcVNqcxHbhD+z4rM3rUqKWbdIkOskuZOwi/gIOTZiDI+kT+wSq+lTHFcfzd 1v2/rTkuvQ7MBlcI3hEeye+s911D7DZq8FWScsalbNbWTbefEE0ebKEpw22Vn0eYAE2S jKIXPSXFADD5/RyLiApLFsI5CUfRYg7XX03NJYFL5WrukGmxvCtyU/83iSsJVFHH2siu JfLg== 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=r7FuDJBkqmbrNZ8AuyY2ToeqGTn3J1mJtK8z1ItIbdE=; b=mplItTZ61p4xSw0ramiJx5q7J0/9sP+63papofFr+ooVyroWGuubcnyWTFz+4ddhAF thEFWVArobaVqiBGNOQYmXj6otmmscIjwmhlMLuCyT8Y9tGPwY2XiyaGUhi7KJ+y1qSd WNAeMkKWc3XgvHfYlKiDBHnPmUfHLjTq0oUhoAbG5nAExLztK4jdURK5CLznU3I3DcTR uJBMXJ/OdJeOjqw9VqpxcbEc+pul6qJVIrXe0IKeQ8UoyoGxqE3LXewHmE2XwOnYNjFt 9llCB2tHKWyHRSheVYZWrQuH8gS/av5jZu08EszfxZluvGiH1LqIfXJRJEjkIvMeAuzi Orow== X-Gm-Message-State: AOAM530xlLF6iGkHTKAwJwhF0bScROzYnbzGmqM2AMFOWnj5ZauhXW6j nGviWjAYI9rqS7n9v6Rgovy2jw== X-Google-Smtp-Source: ABdhPJzUBAAPjj8z3sKrvIM+BkzPaczsu+Op3D9PsW9q5fj4Q5p9j0lxy8voeiQ//58dzghyGllY9g== X-Received: by 2002:a05:6a00:124a:b0:4a4:cfd2:b40f with SMTP id u10-20020a056a00124a00b004a4cfd2b40fmr31149267pfi.57.1638715886771; Sun, 05 Dec 2021 06:51:26 -0800 (PST) Received: from localhost ([2602:feda:dd5:6b5b:660b:141b:4f83:cd75]) by smtp.gmail.com with ESMTPSA id f5sm7548675pju.15.2021.12.05.06.51.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Dec 2021 06:51:26 -0800 (PST) From: Leo Yan To: "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 Cc: Leo Yan Subject: [PATCH v1 3/7] coresight: etm4x: Use task_is_in_root_ns() to check PID namespace Date: Sun, 5 Dec 2021 22:51:01 +0800 Message-Id: <20211205145105.57824-4-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211205145105.57824-1-leo.yan@linaro.org> References: <20211205145105.57824-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-20211205_065127_831503_A430D6A8 X-CRM114-Status: GOOD ( 11.68 ) 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 To avoid open code, this patch uses the helper task_is_in_root_ns() to check if a task is in root PID namespace. Signed-off-by: Leo Yan --- 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..cd87ad8456d7 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_root_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_root_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_root_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_root_ns(current)) return -EINVAL; /* -- 2.25.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel