Article View: linux.kernel.netdev
Article #24553Re: [PATCH net v10 1/2] genetlink: Reject joining multicast groups no family owns
From: Nicolas Dichtel
Date: Mon, 30 Nov 2026 10:27
Date: Mon, 30 Nov 2026 10:27
57 lines
14154 bytes
14154 bytes
Le 27/11/2026 ร 04:22, Anil Kaushik a รฉcritย :> 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.
> There are no group flags to check before the family registers, so this
> applies to privileged callers too: a program that joins a fixed ID such
> as NET_DM_GRP_ALERT before the family is loaded no longer gets its
> messages. I don't know of a program that does this. One that resolves
> the family first still joins. Say so in the comments on the static
> IDs.
>
> bind() takes a mask of groups, and most IDs in it can have no owner. Such
> a mask used to work, so keep it working: netlink_bind() skips an ID when
> the bind callback returns -ENOENT, and joins the others. Only genl_bind()
> returns -ENOENT. A skipped ID is not joined, so it is no longer in the
> groups that getsockname() and NETLINK_LIST_MEMBERSHIPS report.
> setsockopt() returns the error, as it asks for one group.
>
> This does not cover a family that is unregistered between the check and
> the point where the membership bit is set. Hitting it needs a
> privileged module unload at the same time, and the capability check
> already has the same window.
>
> 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
> bind(), an owned group and free IDs: ok, member of the owned group only
>
> genl_bind() was added, with its first capability check, in the commit
> in the Fixes tag.
>
> Link: https://lore.kernel.org/netdev/179324692107.3134.14443689892607921337@kernel.org/
> Fixes: 4d54cc32112d ("mptcp: avoid lock_fast usage in accept path")
> Signed-off-by: Anil Kaushik <anilkaushikwireless@gmail.com>
Reviewed-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Technical Details
Message-ID:
<25359215-983a-4fb1-af0e-810e6ce66a6d@6wind.com>Path:
mbox-mo1.pugleaf.net!news-lon.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374105-linux-kernel-netdev=dewy.ruReferences:
<20261127032246.2886407-1-anilkaushikwireless@gmail.com> <20261127032246.2886407-2-anilkaushikwireless@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lon.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374105-linux-kernel-netdev=dewy.ru
From: nicolas.dichtel@6wind.com (Nicolas Dichtel)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v10 1/2] genetlink: Reject joining multicast groups no
family owns
Date: Mon, 30 Nov 2026 11:27:28 +0100
Organization: Usenet Network
Message-ID: <25359215-983a-4fb1-af0e-810e6ce66a6d@6wind.com>
References: <20261127032246.2886407-1-anilkaushikwireless@gmail.com>
<20261127032246.2886407-2-anilkaushikwireless@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="1403006"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:ZNVTiygNWOhLRm7zXdnSdAD7QRo= sha256:KcGQiet/imMWzxF3czg7dhFoiuaN2o9/E2pD1NMkDX0=
sha1:nZ1eKsCFfOelvfSku4lsJDJJUG0= sha256:Kxrw94DK+Kw7MVLYCTTC3+0Vni6ekGPf/c72uh57kiE=
Content-Language: en-US
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id BF51B125FDC; Mon, 30 Nov 2026 13:27:50 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.151
X-Spam-Status: No, score=-3.151 tagged_above=-9999 required=6.31
tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1,
RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=6wind.com
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id pk-oa4FmrIfR;
Mon, 30 Nov 2026 13:27:46 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-374105-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=6wind.com
X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
by mail.dewy.ru (Postfix) with ESMTPS id BC061125FD5; Mon, 30 Nov 2026 13:27:36 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by sto.lore.kernel.org (Postfix) with ESMTP id 3A02260135C; Mon, 30 Nov 2026 10:27:36 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1796034452;
b=e6F9Hg6fR7Imw9Zv9jSZeoDiMf1a8eqVD4wHNS47H8N7vJI64ceArIhjZdpUYP3JZ4Y9
TUJUrQ9KJdqA6yMibNJ7M7gtx3C0qxE9Rkq5NHHiKDFeKDKF7Rx4GKScJ3Ga8f8/nElvS
F3FgCvyi68sXYUco/PfI4/msFqirl62i8FhduQgU2jcdLUNXB/NZDHb5xUnr6rNOjF/TE
u5lCafuuhWjv1y42SAQJFB83yqPPMd94fhHiVrp9T0OyGsbjlhMptvk1iTmF4POz0Jh+w
hOPPuhZxMG8/fgWWe/dpTFyIiN0hAgCJ1J3ymA+6O0I8FCW5ZUw0rspwOSKRnul2Ubw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796034452;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
X-Gm-Gg:X-Received:Received:Message-ID:Date:X-Mailing-List:List-Id:
List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
Precedence:MIME-Version:User-Agent:Reply-To:Subject:To:Cc:References:
From:Content-Language:Organization:In-Reply-To:Content-Type:
Content-Transfer-Encoding;
bh=lsYwiCEwJ1P1q8bQWXoq8SnKepkL5SvrlywQ3Ro7pvw=;
b=HmdG7c8mjcz2zbeKkHMRY3Od/CA9nSb+lSQYgHnKnkJzkjyTuJa0i1zSFvSXhDoHTJ2T
Bsysmv8p0mrxwRJdSPPVDuO/TUGDiKfBhdp/jo7H1muT6X5O/0jal2nLnzukwyNY2fwk8
j2cxGUSg5ny8AV0FCdwcRohB2eCG0WnuWIqAyMiLHKUDVHQa2YHvfDS6j38QfX5+tkLl2
wsJ+6kLei93Br2+ZqFUSAwxv3t6rnT0IwkU/vSAJARo5P0DrmPZgNHVOKW10j3YthJiQy
AVjuynp39hbnQoJ5nlgNqXFRghH9o6IRBqeClFruEspsDkK1NVkdsbkr0A723uLyR/Q==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=6wind.com header.i=@6wind.com header.a=rsa-sha256 header.s=google header.b=QmMs2SGT;
dmarc=pass header.from=6wind.com;
spf=pass smtp.mailfrom=6wind.com;
arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id B34F4606A338;
Mon, 30 Nov 2026 10:27:32 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=6wind.com header.i=@6wind.com header.a=rsa-sha256 header.s=google header.b=QmMs2SGT
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.44
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1796034451;
b=0gfLiKAyZf4wbSkobYmlLDRFts7jaxDoOQisKvcwH7RrlbjVrjILEPYDS6NqHtqK9nkF
jI6BMkaM3FSxOSLRazjxkoiaLT5lj3/g83puet9tEmSzdoSRapL+wVA8IwE0z+6UTvWUN
s1SaFWYp1XFSAl+Keo8Eyv8f73T38TCVZ0v1O8AFkJt5mgE4D8QQvNx2enFYtSzUTAFp9
qmB8jAttj+6c9/GsuJUbbViyuX5/HYbXtqQWg5qR9qE0lYz3zGs3/Md8Mu/qIYbETINI0
FUeBKZ+obPse4n5Y+2JGJbe3whbu0ziCIJL5qkeO759YUj3g7TurozyW+VQrJI9j6gQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796034451;
h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received:
Message-ID:Date:MIME-Version:User-Agent:Reply-To:Subject:To:Cc:
References:From:Content-Language:Organization:In-Reply-To:
Content-Type:Content-Transfer-Encoding;
bh=lsYwiCEwJ1P1q8bQWXoq8SnKepkL5SvrlywQ3Ro7pvw=;
b=o2UgdgZD48IdH4xLL4ZaEwhmVeg3hhcHMpB6ABVZCsTip7hWuChmMgULiNxmWCaJ8xOv
9GmCKqS+ajefvsbysf8Jkr8SMa4og6PSMVwuPoIwoov1odsn9lenEf1UOfHkim3SyK9iI
TIFFd9ITXUlKrvT24CXYo05e0bsddgQMhCI7sORtlcTP3mzep+OenJOocdzap+YN9PSyp
+72bk3YuLgmZ0KcnBsk/Cyfg+CVdvy4ka2xxtMF6xbj1jiqNiPtTV7m9NzHOadddYZ3cb
VYoFSisnf/Q+bQe/cn0JXKTo0y1wgcCIPzxsZh1igWuXtLvID+SooRkmuRFWyI0ls+w==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=pass header.from=6wind.com;
spf=pass smtp.mailfrom=6wind.com;
dkim=pass header.d=6wind.com header.i=@6wind.com header.a=rsa-sha256 header.s=google header.b=QmMs2SGT;
arc=none smtp.remote-ip=209.85.221.44
X-Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44])
(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1ED7B606A31C
for <netdev@vger.kernel.org>; Mon, 30 Nov 2026 10:27:30 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 1ED7B606A31C
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=6wind.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=6wind.com
X-Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-4a8eed31158so874674f8f.1
for <netdev@vger.kernel.org>; Mon, 30 Nov 2026 02:27:30 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=6wind.com; s=google; t=1796034449; x=1796639249; darn=vger.kernel.org;
h=content-transfer-encoding:content-type:in-reply-to:organization
:content-language:from:references:cc:to:subject:reply-to:user-agent
:mime-version:date:message-id:from:to:cc:subject:date:message-id
:reply-to:content-type;
bh=lsYwiCEwJ1P1q8bQWXoq8SnKepkL5SvrlywQ3Ro7pvw=;
b=QmMs2SGT3fxNfpXaZ1RQOHh3m4Y/rgkJH7Bf4CnUnfJTq9SMmiDx9EGygw8PLg/QeI
RJ0giWYwENW2T7Z1o9Qi/FstI6S3LmNN60ZOwPWdXJluNSQJF0nUwTf7WZ9d5cw4idVS
3YEqCgTImMmTS/gXQ4JZJ1KQsuEUyuumo3rw5osver2ay1Ohs8qK2hMLh6JiKt9RmE45
sf1/9XJmZdVnY02CJcsg9MWELTuShEon3Z60TLRxKEh9v4K72kV1rJN3yzJjE8xpqSBk
0oBiI4D9BGYyF9dd7Zh9y/7jTYl14LXDZ/eztm0vUpyktb2Qsa07EDpblKWv8iDJyMPQ
1acA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1796034449; x=1796639249;
h=content-transfer-encoding:content-type:in-reply-to:organization
:content-language:from:references:cc:to:subject:reply-to:user-agent
:mime-version:date:message-id:x-gm-gg:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to:content-type;
bh=lsYwiCEwJ1P1q8bQWXoq8SnKepkL5SvrlywQ3Ro7pvw=;
b=O3h0x1DFt8ggPytDyoYih2KHvnzU3pb1mqD+0isqjg6b5H9AmtkWY5sSD3HeLTwkXY
NNCtIfymvEhf2u1f0NPP3Jr7avopQW1ajOELhCDARJwDLFMZcqEMk3/k08OH7XmkvObK
nG2FVfDUSld9adRSXfa/arS4ya1Kjblr2pQsXaItSy4V4U2Df7OficIvnVOa89HvjnOO
/laGK71JS0bKrgc3Q8m1HvZJkC5Yb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d:5d0a:0:b0:4a5:d259:4c57 with SMTP id ffacd0b85a97d-4abab7df50dmr75625619f8f.2.1796034449424;
Mon, 30 Nov 2026 02:27:29 -0800 (PST)
X-Received: from ?IPV6:2a01:e0a:ab7:2110:6a1d:efff:fe52:1959? ([2a01:e0a:ab7:2110:6a1d:efff:fe52:1959])
by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4ab6a680355sm52490949f8f.27.2026.11.30.02.27.28
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Mon, 30 Nov 2026 02:27:29 -0800 (PST)
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-User-Agent: Mozilla Thunderbird
X-Reply-To: nicolas.dichtel@6wind.com
X-Cc: davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
pabeni@redhat.com, horms@kernel.org, idosch@nvidia.com, willemb@google.com,
jacob.e.keller@intel.com, jiri@resnulli.us, fw@strlen.de,
martineau@kernel.org, v3rdant.xiang@gmail.com, aliceryhl@google.com,
linux-kernel@vger.kernel.org, nhorman@tuxdriver.com, shuah@kernel.org,
linux-kselftest@vger.kernel.org
X-Organization: 6WIND
X-In-Reply-To: <20261127032246.2886407-2-anilkaushikwireless@gmail.com>