From patchwork Wed Dec 8 08:33:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12695295 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 11063C433EF for ; Wed, 8 Dec 2021 08:35:18 +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: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:In-Reply-To:References: List-Owner; bh=q3IjqtHy/3+FAw193eWGi3MjMTGmqZkIdFki+xKy9NM=; b=kMW4XP6aMVNZcW 2ZUutfzcleSEoVpVKXODWYhWYRGwkgVKa7/ZugbBRhXz5LFI57GD7APa5q+2pIUYXZj4pRg2920Eq i2j6jqSt5BpWBIiDTq+TvCkvFP9phR/dalUC5z8jUmY43IPwzy5O13dgisi7hQYfkioYkq8CXeaWN mW2+V3qAycNW5NJ0eWEkluTXnrumNtPrnao36a2WwrV9/PlTSft/lYfZjbFn5SJG18Qecm9/FhsaU or6SDeo1gb31XEentpHE4EY2p1N++rzcPRqVbY+2DX1dWBrQS3bPx6dnGZesh0redkuxVK+BCNcDJ egGeAg98jLsU+MAAlJ3Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1musOH-00Bhy2-OU; Wed, 08 Dec 2021 08:33:29 +0000 Received: from mail-ed1-x52d.google.com ([2a00:1450:4864:20::52d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1musOE-00BhxV-VM for linux-arm-kernel@lists.infradead.org; Wed, 08 Dec 2021 08:33:28 +0000 Received: by mail-ed1-x52d.google.com with SMTP id r25so5733030edq.7 for ; Wed, 08 Dec 2021 00:33:26 -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:mime-version :content-transfer-encoding; bh=ezHbFwEHOgtVXrEPyC2/Vvb45wpR1NFY6XpUn36BJXE=; b=Oaf+owd/RxE7FUplEWeI5CqQzsjKbRXuQa43xyIk8paq/kW39V2Jk0nlY1ZWyhxpzU X+N7Df1mmj2hufjljaOYnx6hIp5QRnh87y5eornCGGFjBBGRy+28h36VkFJBkOLHAIn0 tP4YpbDPUYZNhTcWm7KU3yIvoj6iSxSMmyAepmyNHhV38hpTgWKrg9ic9zKd9uOxTAMR Ig9dgtPY0sOotTxVnxNOvU8F+wcYjME6qhBsYZAjLi568fI6/TBQTAaVRtg3oolVohXr AToDvZFgbftWn0HolfqaZyNLXnSZwSbZ1HBfyMnqcJv3yyJR4VduqbXUBvD4tfZkn7Kw 43ww== 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:mime-version :content-transfer-encoding; bh=ezHbFwEHOgtVXrEPyC2/Vvb45wpR1NFY6XpUn36BJXE=; b=Bq7NHOTWi2wboEnH7pUSbsbvD/Yu1WcxBKcCaFb2Osy1PG1T9j4VFwRASCHboE8SO5 LZctNttEQ9bDia/j4nfPDXu0wWDhQRiYL6+n+wO3ly3/oX8JoByZCBkOUAuxlKsD0xny XGN2Drc2JS/rKo0D9eopW/MtIyZOpoG631yJpcp5PADKEfJJCumGySWwcx/YI/Uzmz0G DlMVL5XH8s41RsBd56uA+NBzoDa5MHiKBHPDNKEDOXVi44qQro7CkiMXeO3F4oHIftzC vCK0V6KCy7ytjzxm13yVyec7i4+xuAj+TANXwlYBUMGG2exXXrTNLN8yOMSk8HHRoSqK O6Cg== X-Gm-Message-State: AOAM533TgSXiQHyxZpdGXPB6jfvwyoTSnucp3KzRXqrIRmb3KL5jF4lm +JW/Y66q+5pP75z1nirA72PWsA== X-Google-Smtp-Source: ABdhPJxHqGG5uVa6peGzKP9j9aIy5j3Okpl/7+N6i/8RUzX2jx1jDDBoDhwrbHIhuMk49gm26vKjEw== X-Received: by 2002:a17:906:580a:: with SMTP id m10mr6157826ejq.213.1638952405323; Wed, 08 Dec 2021 00:33:25 -0800 (PST) Received: from localhost ([104.245.96.202]) by smtp.gmail.com with ESMTPSA id f17sm1493865edq.39.2021.12.08.00.33.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Dec 2021 00:33:24 -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@coda.cs.cmu.edu, linux-audit@redhat.com Cc: Leo Yan Subject: [PATCH v2 0/7] pid: Introduce helper task_is_in_root_ns() Date: Wed, 8 Dec 2021 16:33:13 +0800 Message-Id: <20211208083320.472503-1-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211208_003327_060196_627318A3 X-CRM114-Status: GOOD ( 10.92 ) 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 The kernel uses open code to check if a process is in root PID namespace or not in several places. Suggested by Suzuki, this patch set is to create a helper function task_is_in_init_pid_ns() to replace open code. This patch set has been applied on the mainline kernel and built for Arm64 kernel with enabling all relevant modules. Changes from v1: * Renamed helper function from task_is_in_root_ns() to task_is_in_init_pid_ns(). (Leon Romanovsky) * Improved patches' commit logs for more neat. Leo Yan (7): pid: Introduce helper task_is_in_init_pid_ns() coresight: etm3x: Use task_is_in_init_pid_ns() coresight: etm4x: Use task_is_in_init_pid_ns() connector/cn_proc: Use task_is_in_init_pid_ns() coda: Use task_is_in_init_pid_ns() audit: Use task_is_in_init_pid_ns() taskstats: Use task_is_in_init_pid_ns() drivers/connector/cn_proc.c | 2 +- drivers/hwtracing/coresight/coresight-etm3x-sysfs.c | 8 ++++---- drivers/hwtracing/coresight/coresight-etm4x-sysfs.c | 8 ++++---- fs/coda/inode.c | 2 +- fs/coda/psdev.c | 2 +- include/linux/pid_namespace.h | 5 +++++ kernel/audit.c | 2 +- kernel/taskstats.c | 2 +- 8 files changed, 18 insertions(+), 13 deletions(-)