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.133.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 76EF0C433F5 for ; Wed, 8 Dec 2021 13:07:26 +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-58-5_inljHOMbeUFhCTB5FOSQ-1; Wed, 08 Dec 2021 08:06:47 -0500 X-MC-Unique: 5_inljHOMbeUFhCTB5FOSQ-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 02739192782E; Wed, 8 Dec 2021 13:06:45 +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 DEED92B178; Wed, 8 Dec 2021 13:06:44 +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 B93D51802E27; Wed, 8 Dec 2021 13:06:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1B88XkNn004157 for ; Wed, 8 Dec 2021 03:33:46 -0500 Received: by smtp.corp.redhat.com (Postfix) id B4CA140CFD11; Wed, 8 Dec 2021 08:33:46 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast09.extmail.prod.ext.rdu2.redhat.com [10.11.55.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AFE3F40CFD08 for ; Wed, 8 Dec 2021 08:33:46 +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 98C282B478C6 for ; Wed, 8 Dec 2021 08:33:46 +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-85-cXUsyZ8ZNiyv1WgTfDg2yg-3; Wed, 08 Dec 2021 03:33:44 -0500 X-MC-Unique: cXUsyZ8ZNiyv1WgTfDg2yg-3 Received: by mail-ed1-f41.google.com with SMTP id r25so5731567edq.7 for ; Wed, 08 Dec 2021 00:33:44 -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=M/eeez3BcNi8tVHbYa2oBkvP6t/vK4B43HUQensSi3k=; b=cFZSU6OGcYPNZeDn8OBTCfFwNHjc3Q6mFmzvyxREom0GobyrVf/YkJeNg4WbTsN2c2 zpWF872+gY5LtR5y3MEqgUG1rxn9ex1ncoRqUKgqrYycYmWFHY1cJEAEmH14xqrZ1LRr 8SHJsuumv1Fw3q8LVx0+3+FveYaQurgIx5QXFi1kRaCJYDZyclFdyoCYQoQflF8B/Vr7 NRVXL0kCS84BNlwNPes+sjet2tjJctb+07O8kpCnSe5biRzQ6Wiw9/RTwdSzP9Ru7+ts Mcsdt6qfjh1vaezOvf2HkRfNirvJIFwaE/Epo3ThF1q4j9cWnPbFjCmq1bt1rgzTGXdK Xobw== X-Gm-Message-State: AOAM532hQUs0R2qGHezcm2FUyrWylrlo3COg+Wp3hyWAaCl1qe9IZ5b2 C1ZfDyaBR7KduKMpPSXbcZml8pawmVUtKu0G45I= X-Google-Smtp-Source: ABdhPJx1gsuPUNsaXFXbyVaebM4oFOMmmWAz5pvxHoEHLYLkpCRym4tCyOQ0c/34zl8r1AV4FxeNkQ== X-Received: by 2002:a05:6402:3496:: with SMTP id v22mr16781811edc.177.1638952424146; Wed, 08 Dec 2021 00:33:44 -0800 (PST) Received: from localhost ([104.245.96.202]) by smtp.gmail.com with ESMTPSA id h10sm1472866edr.95.2021.12.08.00.33.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Dec 2021 00:33:43 -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 7/7] taskstats: Use task_is_in_init_pid_ns() Date: Wed, 8 Dec 2021 16:33:20 +0800 Message-Id: <20211208083320.472503-8-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.84 on 10.11.54.1 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 Replace open code with task_is_in_init_pid_ns() for checking root PID namespace. Signed-off-by: Leo Yan --- 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) { -- 2.25.1 -- Linux-audit mailing list Linux-audit@redhat.com https://listman.redhat.com/mailman/listinfo/linux-audit