From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CD791284694; Tue, 6 Jan 2026 17:15:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767719756; cv=none; b=A5MpbsBkOg3BfF7eMRSg93r0n+lUKSCnl6sn096qq8EFQ7jvemkQSriJIOccdVxu+mD4b4by/UL4S31O6zgf1E5zxW0Elh1F1qeMxXuIBQFxDiAc7sIZK8cFVJhYnO2UDdjqgoHnP9he4nYR4TSoaRyuLB+dVBmXAjfJQHg/+OQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767719756; c=relaxed/simple; bh=ipV2Lxt7loP5oUsk6t8AnTlWi1eJZ7LlnLbHg0V/zDY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PSHSVXu5zdg27H0LQltxK6vx8CTwmJneoo+2ioIcsRZpqEeMqxjBNbURCc4QNsWacNFNapvKyyRYTbchFbE+9Cl79QfiUhwie4klykOj6xDbDzZGi1ANj6tMbT0xAChptlHpgrF5DDlJSA3R6Nu50Tk3iF0iIzX8StLWgyydnV8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=R3k2J0Z+; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="R3k2J0Z+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25204C116C6; Tue, 6 Jan 2026 17:15:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1767719756; bh=ipV2Lxt7loP5oUsk6t8AnTlWi1eJZ7LlnLbHg0V/zDY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R3k2J0Z+UIuivf8SafLuffAHStdlim4k9zhazaPPwgKlJppE8z5sPSH0v+nj38M1b Y9RQWlpgIeS3MPQhTGTuYQhwJxZEiCAoYDWTr6h2PRHbVvlXfgfWUOSLRVJ7ISaPoH 01AHAWTUm0o42V+k0RDFFvnnYCvoYz4J852wnjwI= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Ondrej Mosnacek , Alexei Starovoitov , Sasha Levin Subject: [PATCH 6.12 003/567] bpf, arm64: Do not audit capability check in do_jit() Date: Tue, 6 Jan 2026 17:56:25 +0100 Message-ID: <20260106170451.468463022@linuxfoundation.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260106170451.332875001@linuxfoundation.org> References: <20260106170451.332875001@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ondrej Mosnacek [ Upstream commit 189e5deb944a6f9c7992355d60bffd8ec2e54a9c ] Analogically to the x86 commit 881a9c9cb785 ("bpf: Do not audit capability check in do_jit()"), change the capable() call to ns_capable_noaudit() in order to avoid spurious SELinux denials in audit log. The commit log from that commit applies here as well: """ The failure of this check only results in a security mitigation being applied, slightly affecting performance of the compiled BPF program. It doesn't result in a failed syscall, an thus auditing a failed LSM permission check for it is unwanted. For example with SELinux, it causes a denial to be reported for confined processes running as root, which tends to be flagged as a problem to be fixed in the policy. Yet dontauditing or allowing CAP_SYS_ADMIN to the domain may not be desirable, as it would allow/silence also other checks - either going against the principle of least privilege or making debugging potentially harder. Fix it by changing it from capable() to ns_capable_noaudit(), which instructs the LSMs to not audit the resulting denials. """ Fixes: f300769ead03 ("arm64: bpf: Only mitigate cBPF programs loaded by unprivileged users") Signed-off-by: Ondrej Mosnacek Link: https://lore.kernel.org/r/20251204125916.441021-1-omosnace@redhat.com Signed-off-by: Alexei Starovoitov Signed-off-by: Sasha Levin --- arch/arm64/net/bpf_jit_comp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/net/bpf_jit_comp.c b/arch/arm64/net/bpf_jit_comp.c index ca6d002a6f137..82b57436f2f10 100644 --- a/arch/arm64/net/bpf_jit_comp.c +++ b/arch/arm64/net/bpf_jit_comp.c @@ -871,7 +871,7 @@ static void __maybe_unused build_bhb_mitigation(struct jit_ctx *ctx) arm64_get_spectre_v2_state() == SPECTRE_VULNERABLE) return; - if (capable(CAP_SYS_ADMIN)) + if (ns_capable_noaudit(&init_user_ns, CAP_SYS_ADMIN)) return; if (supports_clearbhb(SCOPE_SYSTEM)) { -- 2.51.0