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=1796380486; b=hKM/FL/inyLEYoMVF6u+4CT1ebtx/QqMoaLitIZV1LXop7ggDnjMYRzJqWDnwFOgI7dp kLqbXsoqLjXWHuz1M+zrVqOAlYAqpqw1FyO6g0JlNhMAeVEdyLIwlKt3YtYVmAtJcPAdA ZoIFOaQrI5bGBK6yW+zkMV5PQMEnzZ1NS2nRuQQFZAH5bHFgD1KiRO44+ftfrd3QB+63W /PVX+nAJjQ7mBv4KybDNPkMytq4Di9c5lGaK+Je5FMxBGoG8GWpEDGd22rCKyB1cYzOC5 4E4ptmdY3JR1ORS0GBoSk6/ABl7VgNnXVs0gNRphqOu9io+8smyIg20r8yPWXHlsTkg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796380486; 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=17mXAiQrFtF7fkTqKIqCieYUbJuP1QnR3htBpSXn5LE=; b=vZhWU6iPR8b2qXW5RFhhho9TJRTSX3P+uXKCKhc1lVDv+wBNsdZNMSF+UUx4a2xWeh+V GbBn8+yxBjkspv2HB4ZWI5Z7IJ6oRveeWv5+dNTH0So+Rmg4VVYb6DjR6pumHindoBUZo ++r5pvnr6iDkmjh5tuL6l6Noz6KfyP+Z5/pD+ESlniF1q7ojsx7+Zus/WS1DHkR1x6gY6 IYjciBDEK6+xv48Kd8YzstYzNMJ7pmLTuD7CQqoxdn99DF01KOz5QDaUJqu7piLs398Ia KUm55lDHAZIwvne77TG+5twHwIGhP4DMPZBWYuN2GLxjJjQHmPj6bXoLsu9/GqAqQfQ== 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=izmTeSMb; 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 F01C2606A33E; Fri, 4 Dec 2026 10:34:45 +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=izmTeSMb Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D5FF1F000CE; Fri, 4 Dec 2026 10:34:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796380485; bh=17mXAiQrFtF7fkTqKIqCieYUbJuP1QnR3htBpSXn5LE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=izmTeSMbKDYdXHOEx4k50/md+QvwjzBMOblyoG4sL9NiVk1JeuHabXAiYYMq872P1 4ifMEETHqo9RhqtdaHYZYGh2S8ZKDlNwwdPU3PISAZdUysICXv6kW4Li53nH3byPrv IWELkZkidEpLF4DtG9WEC+S866CBEENoZC2lcDHU= 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 293/742] bpf: Require CAP_PERFMON for the dump of all storages of sockets Date: Fri, 4 Dec 2026 19:02:37 +0900 Message-ID: <20261204100642.825346446@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 f9e4fda5eb350f4a310eb266cad83d55c14b3e1c ] inet_diag dumps values of all sk_storage maps when the request names no map. It takes CAP_BPF and no fd. These are data of other programs, and tracing programs keep addresses and memory of the kernel there. Ask for CAP_PERFMON. "ss --bpf-maps" needs it then. A request with fds of maps works as before. Fixes: 2c78ee898d8f ("bpf: Implement CAP_BPF") Signed-off-by: Alexei Starovoitov Link: https://patch.msgid.link/20261125032938.670542-34-alexei.starovoitov@gmail.com Signed-off-by: Sasha Levin --- net/core/bpf_sk_storage.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/core/bpf_sk_storage.c b/net/core/bpf_sk_storage.c index ea22ec5ef5b19..04eef37fb31d5 100644 --- a/net/core/bpf_sk_storage.c +++ b/net/core/bpf_sk_storage.c @@ -502,6 +502,10 @@ bpf_sk_storage_diag_alloc(const struct nlattr *nla_stgs) nr_maps++; } + /* It's a dump of all maps, see bpf_sk_storage_diag_put() */ + if (!nr_maps && !perfmon_capable()) + return ERR_PTR(-EPERM); + diag = kzalloc_flex(*diag, maps, nr_maps); if (!diag) return ERR_PTR(-ENOMEM); -- 2.53.0