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 8DE58C4332F for ; Tue, 14 Dec 2021 18:23:55 +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-325-C2XpAocpMhWIrnvv51D2oQ-1; Tue, 14 Dec 2021 13:23:51 -0500 X-MC-Unique: C2XpAocpMhWIrnvv51D2oQ-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 3AA77100C632; Tue, 14 Dec 2021 18:23:47 +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 25C104299B; Tue, 14 Dec 2021 18:23:47 +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 060894A7C9; Tue, 14 Dec 2021 18:23:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1BE5t7Jj029141 for ; Tue, 14 Dec 2021 00:55:07 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7BF14492CA4; Tue, 14 Dec 2021 05:55:07 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast07.extmail.prod.ext.rdu2.redhat.com [10.11.55.23]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 778C4492C3B for ; Tue, 14 Dec 2021 05:55:07 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.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 5C4343C00124 for ; Tue, 14 Dec 2021 05:55:07 +0000 (UTC) Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-155-6Z3lgEXZO6S2uFxkvc990A-1; Tue, 14 Dec 2021 00:55:05 -0500 X-MC-Unique: 6Z3lgEXZO6S2uFxkvc990A-1 Received: by mail-pl1-f170.google.com with SMTP id n8so12819141plf.4; Mon, 13 Dec 2021 21:55:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=qygzG3i+Q2dKqcPeTWcYmqHjvIDf/rLwYsDEhwU2v0E=; b=HSLWM61KusZgM8N7+7081vXnoMZN7wQHvAxFBmYpsiftBmqsvGG5tC4BKxrZaLolG3 Wl1TqBjNNxjlHBATdI6uAmm6PkCYJaNuxmqoKWWbc5EmVScZjWItxCvWcJrXe83R3yIc m9I7g54YeBmFOLLKSMrDn076rrRWbsZKlu8+4Dv8wwJEZaO+5e25Eq5Yn4opOp2HfKMY xZr/6phwNKU8jw8k3gPGj2487vQdnzMOIpIlFtiMINV7zjqxFG2mb9+FmV8+sdFqHclF 7hoYdi/iX8JjwrTLAxe28qJXGUnc3RZONQ4Ftfej175d9MshKmAQsaV/HXgAJvGI82T/ GcHA== X-Gm-Message-State: AOAM533P9dGZY1QmoR9UG/4Jvp3toA4rRhZn/ffmbgRbERtKOwzE9k29 wE3UPnoF78O/HFg4wRZec4w= X-Google-Smtp-Source: ABdhPJzSdxEnUOjNJKDc/bReM7aNHVb5aLCdbU+rNH3K0mlsefPQKSUOeP7h1RrGEH04avmyo224RA== X-Received: by 2002:a17:902:ea03:b0:146:6bd8:7de3 with SMTP id s3-20020a170902ea0300b001466bd87de3mr3921113plg.29.1639461303807; Mon, 13 Dec 2021 21:55:03 -0800 (PST) Received: from localhost ([110.141.142.237]) by smtp.gmail.com with ESMTPSA id b11sm14378414pfm.7.2021.12.13.21.55.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Dec 2021 21:55:02 -0800 (PST) Date: Tue, 14 Dec 2021 16:55:00 +1100 From: Balbir Singh To: Leo Yan Subject: Re: [PATCH v2 2/7] coresight: etm3x: Use task_is_in_init_pid_ns() Message-ID: References: <20211208083320.472503-1-leo.yan@linaro.org> <20211208083320.472503-3-leo.yan@linaro.org> MIME-Version: 1.0 In-Reply-To: <20211208083320.472503-3-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.9 X-loop: linux-audit@redhat.com X-Mailman-Approved-At: Tue, 14 Dec 2021 13:23:33 -0500 Cc: codalist@telemann.coda.cs.cmu.edu, Jan Harkes , Leon Romanovsky , Mathieu Poirier , Suzuki K Poulose , Alexander Shishkin , netdev@vger.kernel.org, coresight@lists.linaro.org, linux-kernel@vger.kernel.org, Eric Paris , coda@cs.cmu.edu, linux-audit@redhat.com, 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:15PM +0800, Leo Yan wrote: > 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 > Acked-by: Balbir Singh -- 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 E2F94C433F5 for ; Tue, 14 Dec 2021 05:56:22 +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=ASYWIjuM3SICuc9uUp7BP1P/4Mo2sh+XDKG2EnkcJGs=; b=OEW9znn845MohE pM2yBbUU9P76J24XOG0CHumYY7rqFrhOS+Ygh/tr1qZb5AaC3dw/F+Wjg4dN6Sc9d7y4HKnR9Uw7J ZZwyrZbZSfpq1JaivBztHQwJmBtT1Yky8zXKFxU2GUrM9DGDAFNmhEBZsekej+GnRYz4xhONou3Z0 lkhjFjxclttKJi2mqXJktg5a8PY4ciHZOpE8/ImgfdOr5/0iDUiyOYAbABiIyDWc33HdE4WFz1c19 b175nIUGf/WokjzlSHIgTHKZEZ9s3uFECNByYJMbnHUKGMepLRxNvHPgytgPbuTnlsRmR9W8pJln2 u8S1O4LtBqtP/Uy6z08A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mx0mJ-00CfrA-K6; Tue, 14 Dec 2021 05:55:07 +0000 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mx0mG-00Cfqh-ML for linux-arm-kernel@lists.infradead.org; Tue, 14 Dec 2021 05:55:05 +0000 Received: by mail-pj1-x102c.google.com with SMTP id r34-20020a17090a43a500b001b0f0837ce8so230972pjg.2 for ; Mon, 13 Dec 2021 21:55:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=qygzG3i+Q2dKqcPeTWcYmqHjvIDf/rLwYsDEhwU2v0E=; b=hFcA5f5+yuNXm2EkQENEAR8jXJdUhAhICIdWNJ3iNK2wsePdOgJIuMjloMxi4Hpvww lDr+TFLmXpD7O1L+v2l8qWmMDQ5c0T/ic7Vubt7VRskw9CjNk+uFR3sU0Wa6jP7gRYYr C5IxEP53iXvaGtH5KDqtKCpXvZ10Io+NOtoDNTcmkQMlTfYwMFQ8/+ULXmIRAQ02ig7B isdehYHTMibYLH8BVaZg4Oz0pPaGDClcA80VYmUsa6sj29jdu5larGvAY+yhi3aeIB51 i4tcGJOjG3A/3H0C3KfRIMo2gCVB059Tbx8gHv6zTzXpXJPomb6loRJPd9ZCu34WG0Eb DPpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=qygzG3i+Q2dKqcPeTWcYmqHjvIDf/rLwYsDEhwU2v0E=; b=g+RzJ7NRXJlSs7fBWSEQUTQ4bxqWH5aI305UGbS61FsxKBWs9ph+KCHkPtRBG+Av9Y 9uO/3r2ZGPObv1vdacfW6au3/LkF0ub2c4CUOgaqLhgPWAoObfIf+pdiZrus4kuwZdqc tojYeEP2v0wbVTda+GkuBYDHUt8ZkaREVLLP3f6zOqLBf/YoIOodcmd4Ez4+mPO3hGOJ rh9a2NlNp26UO/m7ah44JkEEZbA8aWpxS70rk8pZoEmR4LXPxteuNCqqltRk9+s8YWnO yRjlIa6tf423AHAubnJ2E7Qc/FEZ72jbn6p2kNg38MPyOp85x+NaDsWhXJLhkZcI49BP H2iQ== X-Gm-Message-State: AOAM532hCB/njyvzMCSWZL6FXfAwbptmMPq704ii99pOctiywzpjXNyb Iqd+q+JpLRnpfIMaBL5tYHU= X-Google-Smtp-Source: ABdhPJzSdxEnUOjNJKDc/bReM7aNHVb5aLCdbU+rNH3K0mlsefPQKSUOeP7h1RrGEH04avmyo224RA== X-Received: by 2002:a17:902:ea03:b0:146:6bd8:7de3 with SMTP id s3-20020a170902ea0300b001466bd87de3mr3921113plg.29.1639461303807; Mon, 13 Dec 2021 21:55:03 -0800 (PST) Received: from localhost ([110.141.142.237]) by smtp.gmail.com with ESMTPSA id b11sm14378414pfm.7.2021.12.13.21.55.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Dec 2021 21:55:02 -0800 (PST) Date: Tue, 14 Dec 2021 16:55:00 +1100 From: Balbir Singh To: Leo Yan Cc: "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 , 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 2/7] coresight: etm3x: Use task_is_in_init_pid_ns() Message-ID: References: <20211208083320.472503-1-leo.yan@linaro.org> <20211208083320.472503-3-leo.yan@linaro.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20211208083320.472503-3-leo.yan@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211213_215504_761140_379729F6 X-CRM114-Status: GOOD ( 18.14 ) 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:15PM +0800, Leo Yan wrote: > 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 > Acked-by: Balbir Singh _______________________________________________ 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 BD391C433F5 for ; Tue, 14 Dec 2021 05:55:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230129AbhLNFzJ (ORCPT ); Tue, 14 Dec 2021 00:55:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230117AbhLNFzE (ORCPT ); Tue, 14 Dec 2021 00:55:04 -0500 Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B636C061574; Mon, 13 Dec 2021 21:55:04 -0800 (PST) Received: by mail-pl1-x630.google.com with SMTP id o14so12808518plg.5; Mon, 13 Dec 2021 21:55:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=qygzG3i+Q2dKqcPeTWcYmqHjvIDf/rLwYsDEhwU2v0E=; b=hFcA5f5+yuNXm2EkQENEAR8jXJdUhAhICIdWNJ3iNK2wsePdOgJIuMjloMxi4Hpvww lDr+TFLmXpD7O1L+v2l8qWmMDQ5c0T/ic7Vubt7VRskw9CjNk+uFR3sU0Wa6jP7gRYYr C5IxEP53iXvaGtH5KDqtKCpXvZ10Io+NOtoDNTcmkQMlTfYwMFQ8/+ULXmIRAQ02ig7B isdehYHTMibYLH8BVaZg4Oz0pPaGDClcA80VYmUsa6sj29jdu5larGvAY+yhi3aeIB51 i4tcGJOjG3A/3H0C3KfRIMo2gCVB059Tbx8gHv6zTzXpXJPomb6loRJPd9ZCu34WG0Eb DPpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=qygzG3i+Q2dKqcPeTWcYmqHjvIDf/rLwYsDEhwU2v0E=; b=UYk5HAzVIWnL8yVQPbQJtmExrA8P/pqnM1SuG3icg9vJOMhKbOl+V7g1CUaBPcgMmn yd9vTq88zuA3PBRrsr0dilf++wXD5oQb8bbMJbaRXvhyOdITPJ5kFjNH3eNj3+8ICDuK MJ+y5KBObKdreZdmIhHBJZP3PIUEgGtDQY18s83XJ854UxOe09xa7HUc+AM39mVmf/Ys h/DTvLEmB6b1Lc7HZMtql8AbcmJYL7oUA6pyswhKF32TcJz3xUxcSXPeYHhZMrFb7XV1 hkE2pBj7urnqkIHQj8zfdN4t7Ll4NeCZgPGUQlWp98cZNqa3zTSkoX43BSmdaFLyW7eY r/9Q== X-Gm-Message-State: AOAM5338rdlX3li6mhjWHH2zoyHC/LYzcdQq3BohcTsgHASu8JHmzv22 t6vKIbxJrRhTvAwfoHDBJBk= X-Google-Smtp-Source: ABdhPJzSdxEnUOjNJKDc/bReM7aNHVb5aLCdbU+rNH3K0mlsefPQKSUOeP7h1RrGEH04avmyo224RA== X-Received: by 2002:a17:902:ea03:b0:146:6bd8:7de3 with SMTP id s3-20020a170902ea0300b001466bd87de3mr3921113plg.29.1639461303807; Mon, 13 Dec 2021 21:55:03 -0800 (PST) Received: from localhost ([110.141.142.237]) by smtp.gmail.com with ESMTPSA id b11sm14378414pfm.7.2021.12.13.21.55.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Dec 2021 21:55:02 -0800 (PST) Date: Tue, 14 Dec 2021 16:55:00 +1100 From: Balbir Singh To: Leo Yan Cc: "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 , 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 2/7] coresight: etm3x: Use task_is_in_init_pid_ns() Message-ID: References: <20211208083320.472503-1-leo.yan@linaro.org> <20211208083320.472503-3-leo.yan@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211208083320.472503-3-leo.yan@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 08, 2021 at 04:33:15PM +0800, Leo Yan wrote: > 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 > Acked-by: Balbir Singh