From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796380479; b=eaC5uWZyj6U/NUbBB0HVCOxw7t9kiRGhm8P1LTbxLjKzX6k/2V40aV1XQmB0JAXI0G3F NaGWhMYXJIuZaxMfkOujhEzaXL39S9RPqyEXreW/20VRR2yrwpb6zbI1FKH57OtyNL3kV a0x82/Km9TISyo4Vdxhzq5qb7gxyOSUtFTw/O+0gyfh7bCsAdmo6TIA2huJ/Mb9SQt3x7 JLmqqL25qP0UUAVrwUMTcH8oWKpTLy3iNOHfdnlwqNoyvNyNYSN6RH2szpQtyNFf14AqH vvLpy3nUu/oQUnJAFIZhYmHhdzqpqc71F+z14tb+XZ0o7DraGYwU/lEhGu1e7mjeQlg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796380479; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=FVZFIyQ6SiajdYDAbXNYMgqPJxokHbGEBW1kncpkHBw=; b=1F5bidrPMK4Z0QbVmZGwYTEclpMvFJakVhcvqj3GuvKJaovBsOIVHIxO1rfUeG4fXmHJ p6mCd5bI7JELHcgZGZXGMtTAj4iCSSgLYDZDwAVCS1a7YAdUafqhoOuQXgg8u4qX25Ie8 wWeQX1RW83s6nImVIPr3usts7wfxH39PwmXD403NuRoKQRtzhTOx3huJYNCOr7d1lwbqf rCD2SwbjQjBcgBmRKfem5Y9B+Z6twZrHn7zokxpSD35M1XxK9EpAXay1mSP3oS1JjdAr0 9UaLCLikRXw/vCiOe5lGXV3Diz9+m6rkbG9CNzX0VSFyah2xTJFSUQMR3BGnSKgNamg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=XnmtjwjQ; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 396F0606A6A3; Fri, 4 Dec 2026 10:34:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=XnmtjwjQ Received: by smtp.kernel.org (Postfix) with ESMTPSA id A80571F00897; Fri, 4 Dec 2026 10:34:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796380479; bh=FVZFIyQ6SiajdYDAbXNYMgqPJxokHbGEBW1kncpkHBw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=XnmtjwjQ2AtITDBBS3fDrrvLjOjCnwZjaCPnddLbDA+oHGXAJ8uc0BLyBNHG3aD8g vqMbhTRacI7ksDqrXFXHnTjY33sSfGQQzHaIIIHGdJHyG6QxW8uGXM+MIbV9hCWNsb cYWAe9mdgewZJaAMMq2qeac0u1i9Xcmfd8cu9xDU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Alexei Starovoitov , Sasha Levin Subject: [PATCH 7.3 291/742] bpf: Require CAP_PERFMON to read pinned maps with special fields Date: Fri, 4 Dec 2026 19:02:35 +0900 Message-ID: <20261204100642.772076143@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100635.034361255@linuxfoundation.org> References: <20261204100635.034361255@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Alexei Starovoitov [ Upstream commit 398557b30b9cd673a762d284c714b5c6b2769fbe ] A read of a pinned map prints values as they are in memory. bpf_timer, bpf_wq, bpf_list_head and bpf_rb_root are arrays of u64 for BTF and have addresses. Refuse open() of the file. BPF_OBJ_GET works as before. Fixes: b00628b1c7d5 ("bpf: Introduce bpf timers.") Signed-off-by: Alexei Starovoitov Link: https://patch.msgid.link/20261125032938.670542-32-alexei.starovoitov@gmail.com Signed-off-by: Sasha Levin --- kernel/bpf/inode.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kernel/bpf/inode.c b/kernel/bpf/inode.c index f3b1e440d0cb1..eea2c41571e1c 100644 --- a/kernel/bpf/inode.c +++ b/kernel/bpf/inode.c @@ -310,6 +310,11 @@ static int bpffs_map_open(struct inode *inode, struct file *file) struct seq_file *m; int err; + /* Special fields are printed as they are. Most have addresses. */ + if (btf_record_has_field(map->record, ~(BPF_SPIN_LOCK | BPF_RES_SPIN_LOCK)) && + !perfmon_capable()) + return -EPERM; + iter = map_iter_alloc(map); if (!iter) return -ENOMEM; -- 2.53.0