From patchwork Fri Feb 4 13:50:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12735092 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 307B7C433F5 for ; Fri, 4 Feb 2022 13:53:12 +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=2V+Ki5Tiar9/YXIcidUEmByX29nabFhF/E/B+fRevjQ=; b=UdCmBv/nIzuGbj 56caqZPvz6zehPlpTV39ymUa0bpw5mOnFh+KQ3yOBFNk+bai6TwQZ8DGldI0W5R2de+Qpx83hvlwP ivNVK6Hxd0/5lM1zuZL6Ae4OCTIuP4dB2QdzolMhXV1WU7M+cLoHuXJMBPRGCWQgoTH7+o3lNzK55 FdKC2xT6zUx0YfKdtnbX4aW1kFsjpdgFfXSUETS043WaopPq170nsZxJMm7MrRUAxPz19ok4G7+05 aECiil3vLEJyg3LvDvNvsYuVCC6T93ZRtqIg3Zc3T1SCBpcUzCLVPKYJOQ1pDhJaKHwXwtOErAfbO JPBjicMoIAaVxmmyLI8A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFz0J-004RlD-Qr; Fri, 04 Feb 2022 13:51:59 +0000 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFyzp-004Rbs-Jf for linux-arm-kernel@lists.infradead.org; Fri, 04 Feb 2022 13:51:30 +0000 Received: by mail-pl1-x635.google.com with SMTP id z5so5188405plg.8 for ; Fri, 04 Feb 2022 05:51:29 -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=jHiD4MZsT86vIRdRdRlX5LZloPcWWK9EQ4fdq/sL1Xw=; b=XddfgqU7OpX9vruzWD+1hKmS2fgZLoAmSviJEa6Bt4GOAiLOXFbXNfZWds/PtwoXBI zh2aSqxht1r4J7fMsBrYsNgY50Y9PHxe68Kan4djBgizWIdgOjyB9bL2BWmGgIQ79o+T VNAXhbeMt8LjP2o56beGyrkiVM7tZNIFwBBNNBCg6TtI3K5AAyIVSz8oUanaTi0hsFbJ 4UHwbdWdZpBi8hhS48cnbLobfT7xGwVI3fmW19PxsRimm7C5rSE+YjW2uNAQgVbxlklt syRtsUGm1KF/9LwBmPUMECk0WkFTK0mPUwpaATSf+Tnoa7XfXzIMsTj3LQuDVd9iqzA7 iv5A== 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=jHiD4MZsT86vIRdRdRlX5LZloPcWWK9EQ4fdq/sL1Xw=; b=XCPMoGdN2kRIitQZ/9ojrByidHZdeZNAuMnoz893knsd6Dg53qUMCwsnMqKxS9IFN0 poBDHXEgmGNNjlt6TYazJt+oW64FGNNVSGZurRj2hDnlaDEA8/pWkYAPDw3oIzTEUSiN JflgjPelNWjLoUhjvzdPAud7Hgy5RVznBTy4gHyOwwNKjfWK0/lYxv2W/HN60UeIAign 4NYElMM7hL3gQZvu1gJNtjQai/1gJq0mhxuD4DATjpFN55eRbp3zz3CYjSC5zMOaDW4c loV2lHhMSJ3iHkSVlhNxB48lhrA26dpGLJQDM6Kv94Auk0dWzblu3MdJR5lj8Wq2E+Ow z/Bg== X-Gm-Message-State: AOAM531/u0bef3NajEJpKNQ5FYNjklc3cZL01wgtQL09RQ79wU/p5C5i J4MYMSXl1mPw6Hk/3rdq3a1ngQ== X-Google-Smtp-Source: ABdhPJxICqla4E74jvOrFuoYt2TchjK8Wbbi/Rm9tdVZAG7tiXooKMjmsnAOesCdgglSCvqHC/9VIw== X-Received: by 2002:a17:902:c209:: with SMTP id 9mr3104089pll.119.1643982689012; Fri, 04 Feb 2022 05:51:29 -0800 (PST) Received: from localhost.localdomain ([134.195.101.46]) by smtp.gmail.com with ESMTPSA id 13sm2668131pfm.161.2022.02.04.05.51.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Feb 2022 05:51:28 -0800 (PST) From: Leo Yan To: Mathieu Poirier , Suzuki K Poulose , Mike Leach , Alexander Shishkin , Jan Harkes , coda@cs.cmu.edu, Paul Moore , Eric Paris , Balbir Singh , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, codalist@coda.cs.cmu.edu, linux-audit@redhat.com Cc: Leo Yan , Richard Guy Briggs Subject: [PATCH v4 4/5] audit: Use task_is_in_init_pid_ns() Date: Fri, 4 Feb 2022 21:50:50 +0800 Message-Id: <20220204135051.60639-5-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220204135051.60639-1-leo.yan@linaro.org> References: <20220204135051.60639-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-20220204_055129_686485_5EC5B969 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 7690c29d4ee4..4dfa58865d9a 100644 --- a/kernel/audit.c +++ b/kernel/audit.c @@ -1056,7 +1056,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))