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 3B2CFC433F5 for ; Wed, 8 Dec 2021 13:06:40 +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-223-f9geLf3FOgm0CGp0CZz78w-1; Wed, 08 Dec 2021 08:06:33 -0500 X-MC-Unique: f9geLf3FOgm0CGp0CZz78w-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B6B18801B0B; Wed, 8 Dec 2021 13:06:29 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D1A5F2B178; Wed, 8 Dec 2021 13:06:28 +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 D76D61802E23; Wed, 8 Dec 2021 13:06:26 +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 1B88XYr1004105 for ; Wed, 8 Dec 2021 03:33:34 -0500 Received: by smtp.corp.redhat.com (Postfix) id EDB53401E22; Wed, 8 Dec 2021 08:33:33 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EA315401DBF for ; Wed, 8 Dec 2021 08:33:33 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (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 D10EF185A79C for ; Wed, 8 Dec 2021 08:33:33 +0000 (UTC) Received: from mail-ed1-f41.google.com (mail-ed1-f41.google.com [209.85.208.41]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-300-IbbVW-NOORmrW8OoE9uMgg-1; Wed, 08 Dec 2021 03:33:32 -0500 X-MC-Unique: IbbVW-NOORmrW8OoE9uMgg-1 Received: by mail-ed1-f41.google.com with SMTP id g14so5711112edb.8 for ; Wed, 08 Dec 2021 00:33:31 -0800 (PST) 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=nFpFNbcBX+lPeRGnonpR3BH6HPTPVDEm6tJ4QkqNbVo=; b=xOeiQZL6AqMhGQZGyiC4VCd2ANVgRwXcD/kMRtiAEs/E4yxPQ72D3nyjAWhNxzbHfx wpjOSl5kKqV6isOHDtIg7JKh6mUjE/3VYs4Rn7rT6BLO4NuH5hIBsi57fqFQkAUCDa4b +h3xVehAMdN135VMzpax7aJuWWrFnFFfpIIq+7ksU7cMfkKNQoVXTr3gyQLeDfWyKBs0 L7Z5lv2kIO/YYvOeiH/2YQ09rQZjGQDBkdxw/sBrhUd4anSNGp3eiS7QOiNQj44/1LxU aAtB3fXUFpKy4L8pEPaBcBhdxC4OA6WKrx9e9258AOPNdvjC7g5gUYRgxSmJ8FPiYyS6 GQxQ== X-Gm-Message-State: AOAM530/9da/Jmw9vW3dbsr1dxZAsullksHETqNnSxEL1EKH6lGMC7+L VkGnN7JLvg47xMghxiyyMVRmUA== X-Google-Smtp-Source: ABdhPJwjB4j2qwDPyk+4ObiPFmUCJJ3bfOq7wkfrgeKtjhkWvjp7+SQ4o/Bu5lKqkBurHaCAuz088g== X-Received: by 2002:a17:907:7e91:: with SMTP id qb17mr5835776ejc.449.1638952410925; Wed, 08 Dec 2021 00:33:30 -0800 (PST) Received: from localhost ([104.245.96.202]) by smtp.gmail.com with ESMTPSA id d10sm1089074eja.4.2021.12.08.00.33.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Dec 2021 00:33:30 -0800 (PST) From: Leo Yan To: "David S. Miller" , Jakub Kicinski , Leon Romanovsky , 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@telemann.coda.cs.cmu.edu, linux-audit@redhat.com Subject: [PATCH v2 2/7] coresight: etm3x: Use task_is_in_init_pid_ns() Date: Wed, 8 Dec 2021 16:33:15 +0800 Message-Id: <20211208083320.472503-3-leo.yan@linaro.org> In-Reply-To: <20211208083320.472503-1-leo.yan@linaro.org> References: <20211208083320.472503-1-leo.yan@linaro.org> MIME-Version: 1.0 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: Leo Yan 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.11 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-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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/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); -- 2.25.1 -- Linux-audit mailing list Linux-audit@redhat.com https://listman.redhat.com/mailman/listinfo/linux-audit