From: Ido Schimmel <idosch@nvidia.com>
To: Anil Kaushik <anilkaushikwireless@gmail.com>
Cc: netdev@vger.kernel.org, "David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>,
Nicolas Dichtel <nicolas.dichtel@6wind.com>,
XingWang Xiang <v3rdant.xiang@gmail.com>,
Alice Ryhl <aliceryhl@google.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] genetlink: Reject joining multicast groups no family owns
Date: Thu, 29 Oct 2026 22:35:40 +0200 [thread overview]
Message-ID: <20261029203540.GA1485981@shredder> (raw)
In-Reply-To: <20261029062214.3407223-1-anilkaushikwireless@gmail.com>
On Thu, Oct 29, 2026 at 06:22:14AM +0000, Anil Kaushik wrote:
> genl_bind() checks the GENL_MCAST_CAP_* flags of a group only when a
> family owns it. For a group ID that no family owns, it returns 0, so any
> user can join it.
>
> A family registered later can get that ID, and the socket stays a member:
> nothing checks it again. An unprivileged user can join the free IDs, load
> a family module with CTRL_CMD_GETFAMILY, which calls request_module(),
> and then receive the notifications of a group with
> GENL_MCAST_CAP_NET_ADMIN or GENL_MCAST_CAP_SYS_ADMIN. For example the
> drop_monitor "events" group always gets ID 1, and is free until the
> drop_monitor module is loaded.
>
> Fix by returning -ENOENT from genl_bind() when no family owns the group.
> Nothing is ever sent to such a group, so joining it has no use.
>
> Found by the Sashiko review of the gtp multicast group fix. Tested as an
> unprivileged user who joins all free IDs, then loads gtp and
> drop_monitor:
>
> Before:
> joins: ok=62 EPERM=2
> gtp/gtp (ID 15): member
> NET_DM/events (ID 1): member
>
> After:
> joins: ok=19 ENOENT=43 EPERM=2
> gtp/gtp (ID 15): not member
> NET_DM/events (ID 1): not member
>
> Link: https://lore.kernel.org/netdev/179324692107.3134.14443689892607921337@kernel.org/
> Fixes: e03781879a0d ("drop_monitor: Require 'CAP_SYS_ADMIN' when joining "events" group")
> Signed-off-by: Anil Kaushik <anilkaushikwireless@gmail.com>
FWIW, this restores the behavior of commit 5ad6300524c0 ("genetlink:
disallow subscribing to unknown mcast groups"). The entire function was
later removed by commit 1e82a62fec61 ("genetlink: remove genl_bind") for
unrelated reasons.
So, given that the kernel already rejected such bindings between v3.19
and v5.7, I think that the potential for regressions is low.
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
prev parent reply other threads:[~2026-10-29 20:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-29 6:22 [PATCH net] genetlink: Reject joining multicast groups no family owns Anil Kaushik
2026-10-29 7:49 ` Anil Kaushik
2026-10-29 15:44 ` Nicolas Dichtel
2026-10-29 20:35 ` Ido Schimmel [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261029203540.GA1485981@shredder \
--to=idosch@nvidia.com \
--cc=aliceryhl@google.com \
--cc=anilkaushikwireless@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nicolas.dichtel@6wind.com \
--cc=pabeni@redhat.com \
--cc=v3rdant.xiang@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.