From patchwork Sun Dec 5 14:50:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12694808 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 6C7A7C433FE for ; Sun, 5 Dec 2021 14:53:08 +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=PNRIsW+4P6w1NzNVDkKRnESMmxqjor1QaRAGLihMIr8=; b=4QL1KVSswD5XRd W/dCxzCcgPVzPKr0Rizzid2DmqRL+LwAW2zTvstAR4HKZP2Bln8CD9AHFklmN/iIOk/v8NW8PPcPK haRciFW9tdZrjuoGK4PjXmbu+wQ/Qpfu56BJqbm29foy9kFHNZNpHSlSepbjd5JKS6tPcXTVIwg0v fT8dIpFp+58eBGf/SnWdI9sbKdayAJWlSuZ5ETqk4bLkvDW60ormni+PmHFfs/qTH20c1jXdYn186 MOxdD1Ic5rzqSn+5Urv8ymjNA7+BdbwY/C29XMxDv2+N3btkx8cqqv4sEC14eICpBqHUvlbSRe2vj voKcZ6AxP1Xh//aOksQQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mtsrI-001Y61-Nv; Sun, 05 Dec 2021 14:51:20 +0000 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mtsrE-001Y5T-Pg for linux-arm-kernel@lists.infradead.org; Sun, 05 Dec 2021 14:51:18 +0000 Received: by mail-pj1-x102a.google.com with SMTP id iq11so5840364pjb.3 for ; Sun, 05 Dec 2021 06:51:16 -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=uX2NVH/p4XWwvuMtSonYvqXVGhVcHlyl1MPTyjaypn0=; b=PaMy4nrJdo1cDW6ZbiNHyyzXar8/bwxYeaE9YGrcEvKHRMZ7IBPDoZ8dPHtJ9f5TDW Wt62+MdjtdPOmb+svcwZLUAjXyfphJFeiE6mHLZr8fAV3FaXdR91qW0ASgo7jgn3rqkL s7F9+7CbI1PHTjUrQFJZU3aERsA7/48IakhiyY3wfnHrgszsTlAg4roR/+7bULuh4vOH mtDLD70CarYhOIAOqPaXLbyoF6jjoe78diqfNQ6CXIK3O0OApICEcMnk5MnrUYgL5QPI E8dzVCF3S/vabXi0WxV0DgNGnBGhlO0KX2y48ylqXyOwNUK8/AZtLZ6q+g1l4TejB5e6 AxQw== 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=uX2NVH/p4XWwvuMtSonYvqXVGhVcHlyl1MPTyjaypn0=; b=25/n9TvDDq8QXE259vkPxefmwbfLppjnOz38I5yfv/c3+u7nd4bbEaBEzd2xZlnEX1 jMavEs6cHvogR3k9dmj3lHQfEpPl2dESVwbVhw4k7UQ7ofwIKoRQjgiCn5k9rnBRPGd1 vMjTBgCPtppOuRz3yCRSYWRMF915nQIT5DlPN3xSDfSJoQeKkXNvg3YZhBcoC7FjyS9n C4kdTor+qg39XlN76SnaAP97m8gOe1g926hwrh0i5evbwKcJdABtipDxC0B9zDCk5QrN PRiBNfm84KAGW3EgJWrOpe00Lb5WI6CQeb1Iayq2NKkVm1NuCh99hy0pGXfo1eE8Px/u IG8g== X-Gm-Message-State: AOAM5326cYu7ICJqMne6zgBu8wSxaaw1JlZYSW1Z2GOiI3AH5I9H+lEX 7XspNKPMxaVBHbWdBb/jLbgraw== X-Google-Smtp-Source: ABdhPJwIOvPWvYd84S7H/yFRTlICWYP9VDs8JGx/x+rzDNk2TRJA5YnOqtqrDB73G+o+IYj1tQbg2Q== X-Received: by 2002:a17:90b:384d:: with SMTP id nl13mr30543184pjb.80.1638715875608; Sun, 05 Dec 2021 06:51:15 -0800 (PST) Received: from localhost ([2602:feda:dda:dc04:ff07:a102:a8ea:7103]) by smtp.gmail.com with ESMTPSA id b6sm9417632pfm.170.2021.12.05.06.51.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Dec 2021 06:51:15 -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 0/7] pid: Introduce helper task_is_in_root_ns() Date: Sun, 5 Dec 2021 22:50:58 +0800 Message-Id: <20211205145105.57824-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-20211205_065116_867779_96E615F3 X-CRM114-Status: UNSURE ( 9.46 ) X-CRM114-Notice: Please train this message. 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_root_ns() so we can use it replace open code. To test this patch set, I built Arm64 kernel with enabling all relevant modules, and verified the kernel with CoreSight module on Arm64 Juno board. Leo Yan (7): pid: Introduce helper task_is_in_root_ns() coresight: etm3x: Use task_is_in_root_ns() to check PID namespace coresight: etm4x: Use task_is_in_root_ns() to check PID namespace connector/cn_proc: Use task_is_in_root_ns() to check PID namespace coda: Use task_is_in_root_ns() audit: Use task_is_in_root_ns() taskstats: Use task_is_in_root_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(-)