From patchwork Wed Dec 8 08:33:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12695301 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 BF7BAC433F5 for ; Wed, 8 Dec 2021 08:36:32 +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:References:In-Reply-To: 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: List-Owner; bh=7eEiVERfkjr5Wf2XId8Jg043izL7Y2fhQHSdUFneSGA=; b=tsp/K9jUA4juPp Sh3lY9qwC7UPMWu+BmSmFg9hNQlehYoDZfFW8+lrV02plPOmkueN+IAMsw5Jd36+XTpt+g1i9gBve cJwkJ9spLQp6Jht5YboTSn2gPMkmPmWOhJZknDh1OSvg283vOR+rwTy9yqdkFtzpkm4R+KAc6f7Fz YbT0pp4WQ+wG8vCAZmT/XEKYApSIHq3iyM45dk4pROh4x00AtMPAcomSwPH8lH25OsgTL6fwSXVFe eKKUh4J4pTpYV4T+TQ+W99PSk7LTS4M3Q0I/nUvK8QOHqzHEzRLrTPoPqpFie9Fhu8wsXd4/0pria pKAsNKSnm5c8BP9595jA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1musPc-00BiWB-R7; Wed, 08 Dec 2021 08:34:53 +0000 Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1musOU-00Bi43-Tc for linux-arm-kernel@lists.infradead.org; Wed, 08 Dec 2021 08:33:44 +0000 Received: by mail-ed1-x529.google.com with SMTP id l25so5665209eda.11 for ; Wed, 08 Dec 2021 00:33:42 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=JOIrFFDk5p1ePCS4wLsIC6TxcwfDzOnZW25hdk34YK4=; b=kSQY+Eco2ps92/BlhAqd7jefj8Pdfe4ynmziuDHzEAafJ37bIJPkawc6HSkLE5sODW tDuULAoTyoSbi7H+ZfhjLgCPoo0RA4hi8mEUOLjpdNsGwEB5Tea03e3pfkI8UdM0S1w8 PqMC/RTOL8e/Zbcdr5gBsIXxFIeJBuFF9UhrydqJqZTOJSdLj4vk29fuhsC5UqVNVyY3 0f5Gefqwl3HwzyQdOWS6bJsMnOfwX0FMEFcypOxGhsxBAEExLdd9VF7okrcLVtOdy+Du mhwUMtVYhBHQW2a67E6uwfob9IcIN8VvpJDoFM/9iIhf/vyDwwf3XW6c16TfGoLAkXmd hc/Q== 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=JOIrFFDk5p1ePCS4wLsIC6TxcwfDzOnZW25hdk34YK4=; b=DYy5ZqjsSC1KPPrF7Pi2CI5cNrmO1OJPAfXI8tNAYZYQ6IUoLvBN0wHy58HFpmJMQ9 JGyDA+CgV3RUOY4ZslAxpxmwCg8iszHZo6BlUoLrZf6k1718w+M6Gq2taJtD5F30HuQe Ry1jW+/CeVOoOY9RaUGlSCKZJ104hkbYUYUVlom4W/U53QP2/ueTbVqXwWPi3rucCiz4 0ppFQ+00dCttUyB6VJu/cvQwRDAp+Z76dZZxN3u36ycyp/ClFs7IKFjzpGM4RH5PNqD0 PDN/5NO9IRbgc+2B+aMYPTaXMTP+PMBYCrmIE9ihWhu3JCrC6gyLjoAtae3OqL5vX7gl j/sA== X-Gm-Message-State: AOAM532FcuFjaZWOaQV2QlSDKIKSuKXgXTE+OPzgWXdfg8EboRkgk6Ta YWOvLddWp9zz4E9XUaHRsTe49Q== X-Google-Smtp-Source: ABdhPJwnBjeapybURWXW5vGntY1jPXQPELsuOkB3wJNQFHsP8w+vL940CmsfbOEisLwAdfpYEq7JGg== X-Received: by 2002:a50:d543:: with SMTP id f3mr16932046edj.56.1638952421670; Wed, 08 Dec 2021 00:33:41 -0800 (PST) Received: from localhost ([104.245.96.202]) by smtp.gmail.com with ESMTPSA id y15sm1805947eda.13.2021.12.08.00.33.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Dec 2021 00:33:41 -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 6/7] audit: Use task_is_in_init_pid_ns() Date: Wed, 8 Dec 2021 16:33:19 +0800 Message-Id: <20211208083320.472503-7-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211208083320.472503-1-leo.yan@linaro.org> References: <20211208083320.472503-1-leo.yan@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211208_003342_981172_C8F66F53 X-CRM114-Status: GOOD ( 12.30 ) 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 Replace open code with task_is_in_init_pid_ns() for checking root PID namespace. Signed-off-by: Leo Yan Acked-by: Balbir Singh Acked-by: Paul Moore Reviewed-by: Richard Guy Briggs --- kernel/audit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/audit.c b/kernel/audit.c index 121d37e700a6..56ea91014180 100644 --- a/kernel/audit.c +++ b/kernel/audit.c @@ -1034,7 +1034,7 @@ static int audit_netlink_ok(struct sk_buff *skb, u16 msg_type) case AUDIT_MAKE_EQUIV: /* Only support auditd and auditctl in initial pid namespace * for now. */ - if (task_active_pid_ns(current) != &init_pid_ns) + if (!task_is_in_init_pid_ns(current)) return -EPERM; if (!netlink_capable(skb, CAP_AUDIT_CONTROL))