🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #23311

[PATCH net v10 0/2] genetlink: Reject joining multicast groups no family owns

#23311
From: Anil Kaushik
Date: Fri, 27 Nov 2026 03:22
48 lines
13059 bytes
genl_bind() lets any user join a multicast group ID that no family owns.
A family registered later can get that ID, and the socket stays a member
without a capability check. Patch 1 makes genl_bind() return -ENOENT for
such an ID. Patch 2 adds a selftest for it.

v10:
- In the selftest, unload drop_monitor only after the test loaded it,
  and ignore a missing modprobe, so that a skip cannot become a
  failure (Sashiko).
- Say in the skip message and the commit message that kernels before
  v6.17 skip the checks, as they have no fixed nsfs inode (Sashiko).
- Decode only the membership bytes the kernel copied (Sashiko).
- Patch 1 is unchanged.

v9: https://lore.kernel.org/netdev/20261125144514.2717012-1-anilkaushikwireless@gmail.com/
- In the selftest, find the initial network namespace with its fixed
  nsfs inode number, not by comparing with PID 1, which is in the same
  namespace as the test in a container (Sashiko).
- Unload drop_monitor at the end of the selftest, so that the next run
  does not skip that check (Sashiko).
- Patch 1 is unchanged. The Sashiko point on it in v8, a family
  unregistered during the join, is the window the commit message
  describes. The fix for it was patch 2 of v5, which was not accepted.

v8: https://lore.kernel.org/netdev/20261123155503.2497063-1-anilkaushikwireless@gmail.com/

I used an LLM to help write and review the code, the tests and the
commit messages of this series. I checked and tested every change
myself.

Anil Kaushik (2):
  genetlink: Reject joining multicast groups no family owns
  selftests: net: test joining genetlink groups no family owns

 include/linux/netlink.h                      |   3 +
 include/uapi/linux/net_dropmon.h             |   2 +
 net/netlink/af_netlink.c                     |   6 +
 net/netlink/genetlink.c                      |   5 +-
 tools/testing/selftests/net/Makefile         |   1 +
 tools/testing/selftests/net/nl_genl_mcast.py | 138 +++++++++++++++++++
 6 files changed, 154 insertions(+), 1 deletion(-)
 create mode 100755 tools/testing/selftests/net/nl_genl_mcast.py


base-commit: 7b0c5f0c757cb61e28dc4128633877aaa8f6f9bd
-- 
2.25.1
Technical Details
Message-ID: <20261127032246.2886407-1-anilkaushikwireless@gmail.com>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-372430-linux-kernel-netdev=dewy.ru

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-372430-linux-kernel-netdev=dewy.ru
From: anilkaushikwireless@gmail.com (Anil Kaushik)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net v10 0/2] genetlink: Reject joining multicast groups no family owns
Date: Fri, 27 Nov 2026 03:22:44 +0000
Organization: Usenet Network
Message-ID: <20261127032246.2886407-1-anilkaushikwireless@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="627255"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:mgPEBUhQ6OhG2NEZ3uomAfWM8YA= sha256:9AwXr6hepOYMIK9J0pNRj1E0QnyNRp3rN06mcLItWv8=
	sha1:tDaAOplbAhkx8MPJhSqSBKsv9VE= sha256:thP5KxL0/6ZzMHokq07GQhlgby+iJfEqPEtsc3a/3n8=
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 1EB37125F0F; Fri, 27 Nov 2026 06:23:19 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.049
X-Spam-Status: No, score=-3.049 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
	FREEMAIL_FROM=0.001, 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=gmail.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 t0cUgD4Sru_z;
	Fri, 27 Nov 2026 06:23:15 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-372430-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id CBBB3125F04; Fri, 27 Nov 2026 06:23:05 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id 532212E925; Fri, 27 Nov 2026 03:23:01 +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=1795749777;
	b=fYluyUig4diVTNhyq/GA4pZ3vRL5+tYQjVNZHWrKJtxUu3uySHHAeuigxREsXFbTlh2t
	 KahXe3MWFcpA7bLoZuOVVtZHAjpc9YFooH4Mb/8IKyaPOhOGu24N39akDrT0466U+SBRj
	 oLfvCqgfgu0XxqDbt5uH8ANR4o9CojEGONn9aqYVfO7gTj+TshM8drxXsWyG58+t8RbVB
	 dv5rX1kUQCKP/7q3taUUCawG5qKcwwKDjYOz8tHJ2s3jJUSK92r0FvK1ix1kSOy9tGMDK
	 4YE715l3cZJBi1Cla3588DaXi8o1tWH7/S42wwH/JmYQSN7OTgjj/aTeWMtV53aNrfw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795749777;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received:
	 Received:From:To:Cc:Subject:Date:Message-Id:X-Mailer:X-Mailing-List:
	 List-Id:List-Post:List-Help:List-Subscribe:List-Unsubscribe:
	 List-Owner:Precedence:MIME-Version:Content-Transfer-Encoding;
	bh=gVHH6+w6le0xTHPAQTaeEYW7nDPuhbJZlCxYM0Qfygw=;
	b=JWGac5cBDtYRbIoAJSZuo9Lj14kdZmzrG0C44E4onE5VqWEVET3cQgTkh6pGoU+WyATf
	 9R0K7XM6ALL61fy5qMtPCYnnb3lLi6Kto8gqMa+g5qAAa9gUMV0UjJOZ5nenIUFjHpbT0
	 +xxMwuT2rqMIuC61b3na0GZjzatCpdoNJe5up/VCqwj11ZIRym8eviHonQTF2Q6TKA4qH
	 W9/FqvXUNSwVLwEao3RTMkW1smezex7a5UIJ57D3EcNlk+lHfS2wAjBjslXXWx9K4fFIf
	 JUlsXWDI5mjh/POR+yVvAnV8yBMfppRwekV1SJVXRS98FGoYXbxg9Fn2UuKi+BbNNHA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=NVqvKH5+;
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.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 6A2DA606A31E;
	Fri, 27 Nov 2026 03:22:57 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=NVqvKH5+
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.180
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795749776;
	b=N/uquXKIezs4eCXfUUgpSh25Bl2THn2oMzOWivpknUU9RkOoKQSksu8HS4Z0pB6ZtqdF
	 oxJa9Zntpf5E52Lj2YaI2bhP9Mai8p+5D64/YLL9z9dt4YuU0gjaaRG350407mstGIhK7
	 JXtjFWlKSp10FQLqA8XAx/eAIK6n1MYkOdNOypXVtCrQuSlZHRBbDNiHR5Vqm5ubTzquo
	 QnLJAEYDDsT+tMDfKVmZjhFk1xauD24jfddml2LZeELlE2cqeZYPpsPZC7DdTBqN4Di20
	 w5v4Stp1SqymmhDqg16bOZLBBx3oy0lxlAjaRQRL/NFXMcWsvyM9K2LPbkLRN7lFh5w==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795749776;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject:
	 Date:Message-Id:X-Mailer:MIME-Version:Content-Transfer-Encoding;
	bh=gVHH6+w6le0xTHPAQTaeEYW7nDPuhbJZlCxYM0Qfygw=;
	b=RCdRRJVEPnUhr57cyOV/cvWgXWAM8Nx+XoxR4zQFBXE5H4B9aT/mV7y9F67JJ0fAm0tW
	 mKg+NnMRl8Khj3qJzkVpw+9vTVuKf+CasisX2747RC1T+ATUp53PpqpypvF1jrwJP/2h/
	 RY87MARFlUfsUgmwQtJIiPVf/GKTuwSnG6AXAZb42jn/4KeBBdo+AoZMnS9rhGnITaIQq
	 F9Z9D1Er8+z2znP0DG4Ylcd93hiWe88gu18mVWSPNJRFFkoH4v2d5DxVNxdJEoro17fwy
	 BCIVXRY2WqS7w20+Luuisw0ymPy/WX+2FA+yXLQGRaEt1YDlpehIn0GOLJ3VPizCzZg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=NVqvKH5+;
	arc=none smtp.remote-ip=74.125.82.180
X-Received: from mail-dy1-f180.google.com (mail-dy1-f180.google.com [74.125.82.180])
	(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 2E766606A31C
	for <netdev@vger.kernel.org>; Fri, 27 Nov 2026 03:22:56 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 2E766606A31C
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-dy1-f180.google.com with SMTP id 5a478bee46e88-38692f62b22so10064688eec.0
        for <netdev@vger.kernel.org>; Thu, 26 Nov 2026 19:22:56 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1795749775; x=1796354575; darn=vger.kernel.org;
        h=content-transfer-encoding:mime-version:message-id:date:subject:cc
         :to:from:from:to:cc:subject:date:message-id:reply-to:content-type;
        bh=gVHH6+w6le0xTHPAQTaeEYW7nDPuhbJZlCxYM0Qfygw=;
        b=NVqvKH5+lsTodiBLJrm31BYjG5CR5qysR7PW+JLyD1KrTWmHn87Y5QtlZhbOEVlcgT
         gpl7ODF5hxKwBlctYepCz0cihw/9QyiRSKBk5rlK1hxAwhIXnL2EeASnhia07xALY1fG
         d5f9CrxXgpXvnuP8NX031iTiXSQsBitNr+gG4ZONz318AXtdie4lfU1TSzggS+1oJRBN
         i3wIa0xYsWZTQ3dmXlMY7iZrsUSlFmjbhnM3yiH7H65SY5dr4o+TT53iFctxcBZ+C/1+
         ahpAfSJVyWv/ub0KDiBS8IVAaOZ4QCWwIzdF+zAKXazEUsNFimO+pld03eX96mTyiPGn
         UosA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1795749775; x=1796354575;
        h=content-transfer-encoding:mime-version:message-id:date:subject:cc
         :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
         :message-id:reply-to:content-type;
        bh=gVHH6+w6le0xTHPAQTaeEYW7nDPuhbJZlCxYM0Qfygw=;
        b=UMdxzfyUMb5JVyyXErDFJxSwo3wn1KXlmhCX1HLGR0xmEZxR1CuEEpsCox9Q6LmbZt
         6KM4OtPCP3TgYaiB/DLtE8E6ATs07V+qFwLoVJgw0qX0MjkelnjvfGkfJ8h3sLmExEv2
         GdabzoWjLu7kiDrNVPH3176blkPQpnhOir6VscOwECW6m9wr+2sCQV57dhF/lOBRj5Zz
         klpSVcyryAwO8rwHw/YMSPb3v0Onm+MOO4o8UiosZLEJMNqrsEZKJB3veudzSCSzs8Vy
         hxMdAEX6/SIqEB3f6f+6MNyso7E3dawKNgOj6pu/QKKRb5Ry+PqrXTkw8djdINxyt7i3
         LZDQ==
X-Gm-Message-State: APuU4Z8k/YyygsxxlCqQ0QEcJSZnoBjlUzx0iJeQeQEhvwGguFvMJvIp
	NJj289kckcJ1JcaUlNsk7OdcjsEL3Je3kdKdQ+d0IrA/YGnLNCYYYGWu7tIy4g==
X-Gm-Gg: AZFdTZfjf6isn38VI5/OPglXmvN1xEqKOFWJ9HYISHKDSmAlN2fRohBihN2JdET2aje
	V2TdG8zgwBQ4xlMk8cQo45hmiDVHkmL6DlzznIyY8OhOO4qMHz59isBIuLKeD/znZmD3KtIDTlL
	B/FVh56IGKwQ+WfmJ8lQgT3opg5bNhoN5CafhIRJmU2MR0wWswglNGn02oJqrHW9lmBNOrGhX8r
	Liwkt9KhcVyLIwYFP0K/hIDfDUYaSepozk05M9h8QfT02DtOKEiOd1278u+cSs6MyQrLHRdCX5U
	tP0Qs2LvKDKnrrptOOFxMFBmv8vkuHZRGZpAFL/X8hRlmB4vip8WWjQ+tli/rxqalbWeZQ+wTvB
	BOLA71mXBxSH9Z6NYP/QkJzRkDm+d1ni0CqUHLNuYpF0XrJmv9K4BRQE+LEk09m6YvrLhCmfNIU
	I1s4WCtn/k4iJcS65YsMlHf26Ohd0XH+hYJtJOdG2fbSBrtdpskCZ2lHDrB25itTfSUvPTspZsT
	Gi/qtyAcKhAi9haOqV/Dahs9tSrbfZJ28vQ5TgrAlGsC2z59asK8Sy4fhCAR7O0yCM1bo0sQYlf
	pRIM6ohcfE7qWumXTNv+XtcaTr9acOwm/+tkKL9izV2GrpMvPbVcgDsqi2G1i69j+Ep5MQWIx1q
	NLd07Ydr+sbXRogNzGLhMQYNv7JeqYFWZdS8ZO0E/YFG3uXrQyF/iljVB0/rhcDsZXYYu/qwZVg
	==
X-Received: by 2002:a05:7300:2728:b0:383:c2f0:e753 with SMTP id 5a478bee46e88-3856c0d0a68mr26266744eec.3.1795749775103;
        Thu, 26 Nov 2026 19:22:55 -0800 (PST)
X-Received: from ramen-dev-security-2.asia-south1-c.c.ramen-dev-345017.internal (90.156.200.35.bc.googleusercontent.com. [35.200.156.90])
        by smtp.gmail.com with ESMTPSA id 5a478bee46e88-38566cd40c5sm81845568eec.10.2026.11.26.19.22.49
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Thu, 26 Nov 2026 19:22:54 -0800 (PST)
X-Cc: davem@davemloft.net,
	edumazet@kernel.org,
	kuba@kernel.org,
	pabeni@redhat.com,
	horms@kernel.org,
	idosch@nvidia.com,
	willemb@google.com,
	nicolas.dichtel@6wind.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,
	anilkaushikwireless@gmail.com
X-Mailer: git-send-email 2.25.1
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