* [PATCH net v8 0/2] genetlink: Reject joining multicast groups no family owns @ 2026-11-23 15:55 Anil Kaushik 2026-11-23 15:55 ` [PATCH net v8 1/2] " Anil Kaushik 2026-11-23 15:55 ` [PATCH net v8 2/2] selftests: net: test joining genetlink " Anil Kaushik 0 siblings, 2 replies; 5+ messages in thread From: Anil Kaushik @ 2026-11-23 15:55 UTC (permalink / raw) To: netdev Cc: davem, edumazet, kuba, pabeni, horms, idosch, nicolas.dichtel, jacob.e.keller, jiri, fw, martineau, v3rdant.xiang, aliceryhl, linux-kernel, nhorman, shuah, linux-kselftest, anilkaushikwireless 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. v8: - In the selftest, read the group memberships in host byte order, so it also works on big-endian (Sashiko). - Skip the selftest outside the initial network namespace: the family dump there does not list the families that are not netnsok, so it could take one of their groups as free (Sashiko). - Close the selftest sockets, also when a check is skipped (Sashiko). - Skip the drop_monitor check when NET_DM gets no group ID that was free, so it cannot pass without testing anything (Sashiko). - Rebase on net. v7: https://lore.kernel.org/netdev/20261116124030.1595567-1-anilkaushikwireless@gmail.com/ - Add a selftest as patch 2, as Nicolas asked. - Say in the comments on the static IDs, and on NET_DM_GRP_ALERT, that they can be joined only after the family is registered (Sashiko). - Say in the commit message that the unregister window was already there for the capability check. v6: https://lore.kernel.org/netdev/20261112094205.1120090-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 | 127 +++++++++++++++++++ 6 files changed, 143 insertions(+), 1 deletion(-) create mode 100755 tools/testing/selftests/net/nl_genl_mcast.py base-commit: 7b0c5f0c757cb61e28dc4128633877aaa8f6f9bd -- 2.25.1 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH net v8 1/2] genetlink: Reject joining multicast groups no family owns 2026-11-23 15:55 [PATCH net v8 0/2] genetlink: Reject joining multicast groups no family owns Anil Kaushik @ 2026-11-23 15:55 ` Anil Kaushik 2026-11-24 15:56 ` netdev-bot+sashiko 2026-11-23 15:55 ` [PATCH net v8 2/2] selftests: net: test joining genetlink " Anil Kaushik 1 sibling, 1 reply; 5+ messages in thread From: Anil Kaushik @ 2026-11-23 15:55 UTC (permalink / raw) To: netdev Cc: davem, edumazet, kuba, pabeni, horms, idosch, nicolas.dichtel, jacob.e.keller, jiri, fw, martineau, v3rdant.xiang, aliceryhl, linux-kernel, nhorman, shuah, linux-kselftest, anilkaushikwireless 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> --- include/linux/netlink.h | 3 +++ include/uapi/linux/net_dropmon.h | 2 ++ net/netlink/af_netlink.c | 6 ++++++ net/netlink/genetlink.c | 5 ++++- 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/include/linux/netlink.h b/include/linux/netlink.h index 882e9c1b6c1d..b4eb873850e7 100644 --- a/include/linux/netlink.h +++ b/include/linux/netlink.h @@ -48,6 +48,9 @@ struct netlink_kernel_cfg { unsigned int groups; unsigned int flags; void (*input)(struct sk_buff *skb); + /* -ENOENT means no one owns the group: bind() skips it and joins the + * others, setsockopt() returns the error. + */ int (*bind)(struct net *net, int group); void (*unbind)(struct net *net, int group); void (*release) (struct sock *sk, unsigned long *groups); diff --git a/include/uapi/linux/net_dropmon.h b/include/uapi/linux/net_dropmon.h index 87cbef48d4c7..4f2fee982c8a 100644 --- a/include/uapi/linux/net_dropmon.h +++ b/include/uapi/linux/net_dropmon.h @@ -58,6 +58,8 @@ enum { /* * Our group identifiers + * + * The group can be joined only after the NET_DM family is registered. */ #define NET_DM_GRP_ALERT 1 diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 69bb951b5fb8..ee573ba6396d 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c @@ -1033,6 +1033,12 @@ static int netlink_bind(struct socket *sock, struct sockaddr_unsized *addr, err = nlk->netlink_bind(net, group + 1); if (!err) continue; + /* no one owns this group, still join the others */ + if (err == -ENOENT) { + __clear_bit(group, &groups); + err = 0; + continue; + } netlink_undo_bind(group, groups, sk); return err; } diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c index 5cc1037d4917..e5d4f3c4e22a 100644 --- a/net/netlink/genetlink.c +++ b/net/netlink/genetlink.c @@ -85,6 +85,8 @@ static DEFINE_IDR(genl_fam_idr); * cater to that by giving it a static family and group ID. * Bit 18 is marked as already used since the PMCRAID driver * did the same thing as the VFS quota code (maybe copied?) + * These IDs can be joined only after the family that owns them + * is registered. */ static unsigned long mc_group_start = 0x3 | BIT(GENL_ID_CTRL) | BIT(GENL_ID_VFS_DQUOT) | @@ -1825,7 +1827,7 @@ static int genl_bind(struct net *net, int group) { const struct genl_family *family; unsigned int id; - int ret = 0; + int ret = -ENOENT; down_read(&cb_lock); @@ -1841,6 +1843,7 @@ static int genl_bind(struct net *net, int group) continue; grp = &family->mcgrps[i]; + ret = 0; if ((grp->flags & GENL_MCAST_CAP_NET_ADMIN) && !ns_capable(net->user_ns, CAP_NET_ADMIN)) ret = -EPERM; -- 2.25.1 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net v8 1/2] genetlink: Reject joining multicast groups no family owns 2026-11-23 15:55 ` [PATCH net v8 1/2] " Anil Kaushik @ 2026-11-24 15:56 ` netdev-bot+sashiko 0 siblings, 0 replies; 5+ messages in thread From: netdev-bot+sashiko @ 2026-11-24 15:56 UTC (permalink / raw) To: anilkaushikwireless Cc: netdev, davem, edumazet, kuba, pabeni, horms, idosch, nicolas.dichtel, jacob.e.keller, jiri, fw, martineau, v3rdant.xiang, aliceryhl, linux-kernel, nhorman, shuah, linux-kselftest Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider. Critical: 0 · High: 0 · Medium: 1 · Low: 0 If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough). - [Medium] Check-then-act race (TOCTOU) between the ownership/capability check in genl_bind() and the point where af_netlink sets the… -- genetlink: Reject joining multicast groups no family owns With this commit, genl_bind() returns -ENOENT when no genetlink family owns the requested multicast group. Unprivileged users can then no longer join free group IDs that a privileged family takes later. netlink_bind() skips such IDs in a bind() mask instead of failing, and setsockopt(NETLINK_ADD_MEMBERSHIP) returns the error. Link: https://lore.kernel.org/netdev/179324692107.3134.14443689892607921337@kernel.org/ > diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c > index 5cc1037d4917e..e5d4f3c4e22ac 100644 > --- a/net/netlink/genetlink.c > +++ b/net/netlink/genetlink.c [ ... ] > @@ -1825,7 +1827,7 @@ static int genl_bind(struct net *net, int group) > { > const struct genl_family *family; > unsigned int id; > - int ret = 0; > + int ret = -ENOENT; > > down_read(&cb_lock); > > @@ -1841,6 +1843,7 @@ static int genl_bind(struct net *net, int group) > continue; > > grp = &family->mcgrps[i]; > + ret = 0; > if ((grp->flags & GENL_MCAST_CAP_NET_ADMIN) && > !ns_capable(net->user_ns, CAP_NET_ADMIN)) > ret = -EPERM; [Severity: Medium] The commit message says "This does not cover a family that is unregistered between the check and the point where the membership bit is set." Can that window still leave a socket as a member of a group ID that no family owns? That is the state this patch is meant to prevent. genl_bind() decides ownership under down_read(&cb_lock). It then drops cb_lock and returns 0. The caller sets the bit later, and holds only netlink_table_grab() when it does: netlink_bind() err = nlk->netlink_bind(net, group + 1); /* cb_lock taken, dropped */ ... netlink_table_grab(); ... nlk->groups[0] = (nlk->groups[0] & ~0xffffffffUL) | groups; netlink_setsockopt(NETLINK_ADD_MEMBERSHIP) follows the same pattern through netlink_update_socket_mc(). One possible interleaving: CPU0 CPU1 bind() to group X of family F genl_bind() returns 0 up_read(&cb_lock) genl_unregister_family(F) genl_lock_all() genl_unregister_mc_groups() __netlink_clear_multicast_users(X) /* CPU0 bit not set yet */ clear_bit(X, mc_groups) idr_remove() netlink_table_grab() sets bit X in nlk->groups After this, the socket is a member of X and X has no owner. A later family G can be given X by find_first_zero_bit() in genl_allocate_reserve_groups(). An unprivileged user can trigger that registration with CTRL_CMD_GETFAMILY -> request_module(). Nothing checks the socket again. It would get G's notifications even when the group has GENL_MCAST_CAP_NET_ADMIN or GENL_MCAST_CAP_SYS_ADMIN set. The unregister side usually needs a privileged rmmod, but an unprivileged user can keep calling bind() until an admin unloads a module. Module init error paths, such as ila_init(), seg6_init() and fou_init(), can also unregister a family. That can happen after a request_module() the attacker triggered, if init fails partway. There is also a side effect. F->bind(i) ran for the old family, but on close genl_unbind() would call G->unbind(i). The family bind and unbind callbacks could then get out of balance. Could this be closed fully? One option is to recheck ownership, or a registration generation, under netlink_table_grab() before setting the bit. Another is to clear stale members of a group ID when it is given to a new family. -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261123155503.2497063-1-anilkaushikwireless%40gmail.com ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH net v8 2/2] selftests: net: test joining genetlink groups no family owns 2026-11-23 15:55 [PATCH net v8 0/2] genetlink: Reject joining multicast groups no family owns Anil Kaushik 2026-11-23 15:55 ` [PATCH net v8 1/2] " Anil Kaushik @ 2026-11-23 15:55 ` Anil Kaushik 2026-11-24 15:56 ` netdev-bot+sashiko 1 sibling, 1 reply; 5+ messages in thread From: Anil Kaushik @ 2026-11-23 15:55 UTC (permalink / raw) To: netdev Cc: davem, edumazet, kuba, pabeni, horms, idosch, nicolas.dichtel, jacob.e.keller, jiri, fw, martineau, v3rdant.xiang, aliceryhl, linux-kernel, nhorman, shuah, linux-kselftest, anilkaushikwireless Check that a Generic Netlink group ID no family owns cannot be joined: - setsockopt(NETLINK_ADD_MEMBERSHIP) on a free ID fails with ENOENT, and still works on an owned group. - bind() with a mask of free IDs succeeds and joins nothing. With an owned group in the mask, it joins only that group. - A socket bound to the free IDs is not a member of the NET_DM groups after drop_monitor is loaded. Skipped when NET_DM is already registered or drop_monitor is not available. The free IDs are found with a family dump, which only lists the families of the current network namespace, so these checks are skipped outside the initial one. Suggested-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Signed-off-by: Anil Kaushik <anilkaushikwireless@gmail.com> --- tools/testing/selftests/net/Makefile | 1 + tools/testing/selftests/net/nl_genl_mcast.py | 127 +++++++++++++++++++ 2 files changed, 128 insertions(+) create mode 100755 tools/testing/selftests/net/nl_genl_mcast.py diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile index baea3e7f0f8f..875ce0443814 100644 --- a/tools/testing/selftests/net/Makefile +++ b/tools/testing/selftests/net/Makefile @@ -74,6 +74,7 @@ TEST_PROGS := \ netns-name.sh \ netns-sysctl.sh \ nk_qlease.py \ + nl_genl_mcast.py \ nl_netdev.py \ nl_nlctrl.py \ nsh_gso.sh \ diff --git a/tools/testing/selftests/net/nl_genl_mcast.py b/tools/testing/selftests/net/nl_genl_mcast.py new file mode 100755 index 000000000000..4e86a5556b62 --- /dev/null +++ b/tools/testing/selftests/net/nl_genl_mcast.py @@ -0,0 +1,127 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: GPL-2.0 + +""" +Tests for joining Generic Netlink multicast groups that no family owns. +""" + +import os +import socket +import struct + +from lib.py import ksft_run, ksft_exit, ksft_eq, ksft_raises +from lib.py import KsftSkipEx, NlctrlFamily, NlError + +NETLINK_GENERIC = 16 +SOL_NETLINK = 270 +NETLINK_ADD_MEMBERSHIP = 1 +NETLINK_LIST_MEMBERSHIPS = 9 + + +def _groups(fam): + """Return the multicast groups of a family as {name: id}.""" + return {g['name']: g['id'] + for grp in fam.get('mcast-groups', []) for g in grp.values()} + + +def _free_ids(ctrl): + """Return the IDs in 1..32 that no family owns.""" + # Outside init_net, the dump skips the families that are not netnsok, + # but their groups are still owned. + try: + netns = os.stat('/proc/self/ns/net').st_ino + init_netns = os.stat('/proc/1/ns/net').st_ino + except OSError as e: + raise KsftSkipEx("cannot check the network namespace") from e + if netns != init_netns: + raise KsftSkipEx("not in the initial network namespace") + + owned = set() + for fam in ctrl.getfamily({}, dump=True): + owned.update(_groups(fam).values()) + free = [gid for gid in range(1, 33) if gid not in owned] + if not free: + raise KsftSkipEx("no free group ID in 1..32") + return free + + +def _sock(): + return socket.socket(socket.AF_NETLINK, socket.SOCK_RAW, NETLINK_GENERIC) + + +def _members(sk): + buf = sk.getsockopt(SOL_NETLINK, NETLINK_LIST_MEMBERSHIPS, 64) + # An array of u32 in host byte order + words = struct.unpack(f'={len(buf) // 4}I', buf) + return sum(w << (32 * i) for i, w in enumerate(words)) + + +def _bit(gid): + return 1 << (gid - 1) + + +def _notify_id(ctrl): + return _groups(ctrl.getfamily({'family-name': 'nlctrl'}))['notify'] + + +def join_free(ctrl) -> None: + """setsockopt() on an ID no family owns fails with ENOENT.""" + with _sock() as sk: + sk.bind((0, 0)) + for gid in _free_ids(ctrl): + # ENOENT + with ksft_raises(FileNotFoundError): + sk.setsockopt(SOL_NETLINK, NETLINK_ADD_MEMBERSHIP, gid) + + notify = _notify_id(ctrl) + sk.setsockopt(SOL_NETLINK, NETLINK_ADD_MEMBERSHIP, notify) + ksft_eq(_members(sk), _bit(notify)) + + +def bind_mask(ctrl) -> None: + """bind() skips the IDs no family owns and joins the others.""" + free = sum(_bit(gid) for gid in _free_ids(ctrl)) + notify = _notify_id(ctrl) + + with _sock() as sk: + sk.bind((0, free)) + ksft_eq(_members(sk), 0) + + with _sock() as sk: + sk.bind((0, free | _bit(notify))) + ksft_eq(_members(sk), _bit(notify)) + + +def bind_before_family(ctrl) -> None: + """A free ID joined with bind() stays unjoined when a family takes it.""" + names = [fam['family-name'] for fam in ctrl.getfamily({}, dump=True)] + if 'NET_DM' in names: + raise KsftSkipEx("NET_DM is already registered") + + free = _free_ids(ctrl) + with _sock() as sk: + sk.bind((0, sum(_bit(gid) for gid in free))) + + # Looking up the family loads drop_monitor. + try: + ids = _groups(ctrl.getfamily({'family-name': 'NET_DM'})) + except NlError as e: + raise KsftSkipEx("drop_monitor is not available") from e + + if not any(gid in free for gid in ids.values()): + raise KsftSkipEx("NET_DM got no group ID that was free") + + for name, gid in ids.items(): + ksft_eq(_members(sk) & _bit(gid), 0, + comment=f"member of NET_DM {name}") + + +def main() -> None: + """ Ksft boiler plate main """ + ctrl = NlctrlFamily() + ksft_run([join_free, bind_mask, bind_before_family], args=(ctrl, )) + ksft_exit() + + +if __name__ == "__main__": + main() -- 2.25.1 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net v8 2/2] selftests: net: test joining genetlink groups no family owns 2026-11-23 15:55 ` [PATCH net v8 2/2] selftests: net: test joining genetlink " Anil Kaushik @ 2026-11-24 15:56 ` netdev-bot+sashiko 0 siblings, 0 replies; 5+ messages in thread From: netdev-bot+sashiko @ 2026-11-24 15:56 UTC (permalink / raw) To: anilkaushikwireless Cc: netdev, davem, edumazet, kuba, pabeni, horms, idosch, nicolas.dichtel, jacob.e.keller, jiri, fw, martineau, v3rdant.xiang, aliceryhl, linux-kernel, nhorman, shuah, linux-kselftest Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider. Critical: 0 · High: 0 · Medium: 1 · Low: 1 If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough). - [Medium] In tools/testing/selftests/net/nl_genl_mcast.py, _free_ids() decides whether it runs in init_net by comparing the inode of… - [Low] bind_before_family() in tools/testing/selftests/net/nl_genl_mcast.py first checks that NET_DM… -- selftests: net: test joining genetlink groups no family owns This adds a Python selftest that checks Generic Netlink multicast group IDs that no family owns cannot be joined. It covers setsockopt(NETLINK_ADD_MEMBERSHIP), bind() with a group mask, and loading drop_monitor after a bind(). The free IDs come from a family dump, and the checks are meant to be skipped outside the initial network namespace. > diff --git a/tools/testing/selftests/net/nl_genl_mcast.py b/tools/testing/selftests/net/nl_genl_mcast.py > new file mode 100755 > index 0000000000000..4e86a5556b627 > --- /dev/null > +++ b/tools/testing/selftests/net/nl_genl_mcast.py [ ... ] > +def _free_ids(ctrl): > + """Return the IDs in 1..32 that no family owns.""" > + # Outside init_net, the dump skips the families that are not netnsok, > + # but their groups are still owned. > + try: > + netns = os.stat('/proc/self/ns/net').st_ino > + init_netns = os.stat('/proc/1/ns/net').st_ino > + except OSError as e: > + raise KsftSkipEx("cannot check the network namespace") from e > + if netns != init_netns: > + raise KsftSkipEx("not in the initial network namespace") [Severity: Medium] Does comparing against /proc/1/ns/net actually detect init_net? /proc/1 is resolved in the PID namespace of the procfs mount. Some containers have their own PID and network namespaces, for example Docker or Podman without --net=host, or systemd-nspawn. There, PID 1 is the container's init and shares the test's non-init netns. The inodes match, so this skip doesn't fire. In that netns, ctrl_dumpfamily() hides the families that are not netnsok: net/netlink/genetlink.c:ctrl_dumpfamily() { ... if (!rt->netnsok && !net_eq(net, &init_net)) continue; ... } genl_bind() still walks the global genl_fam_idr with no netns or netnsok filter, so the groups of those families are still owned. acpi_event_genl_family in drivers/acpi/event.c is one example. It has an mcast group, no .netnsok, and is registered on any ACPI system. The NET_DM events group is another one if drop_monitor is loaded on the host. Those IDs then land in the free list. In join_free(), setsockopt(NETLINK_ADD_MEMBERSHIP) on the acpi_event group succeeds. On the NET_DM group without CAP_SYS_ADMIN it raises PermissionError. Either way, ksft_raises(FileNotFoundError) fails. In bind_mask(), netlink_bind() keeps the bits that genl_bind() accepted, so ksft_eq(_members(sk), 0) fails as well. Because of this, the commit message statement "these checks are skipped outside the initial one" doesn't hold in that setup. Separately, a non-root user can't stat /proc/1/ns/net, because it needs ptrace read access to PID 1. That gives EACCES, and the OSError branch skips the tests. Should the commit message mention this case? [ ... ] > +def bind_before_family(ctrl) -> None: > + """A free ID joined with bind() stays unjoined when a family takes it.""" > + names = [fam['family-name'] for fam in ctrl.getfamily({}, dump=True)] > + if 'NET_DM' in names: > + raise KsftSkipEx("NET_DM is already registered") > + > + free = _free_ids(ctrl) > + with _sock() as sk: > + sk.bind((0, sum(_bit(gid) for gid in free))) > + > + # Looking up the family loads drop_monitor. > + try: > + ids = _groups(ctrl.getfamily({'family-name': 'NET_DM'})) > + except NlError as e: > + raise KsftSkipEx("drop_monitor is not available") from e [Severity: Low] Should drop_monitor be unloaded again once this test is done? ctrl_getfamily() autoloads it here: net/netlink/genetlink.c:ctrl_getfamily() { ... request_module("net-pf-%d-proto-%d-family-%s", PF_NETLINK, NETLINK_GENERIC, name); ... } No exit path in bind_before_family() removes the module again. That covers the success path, the "NET_DM got no group ID that was free" skip, and an assertion failure. Every later run on the same boot then hits the "NET_DM is already registered" skip at the top of bind_before_family(). So this check runs at most once per boot, and reruns only report SKIP. > + > + if not any(gid in free for gid in ids.values()): > + raise KsftSkipEx("NET_DM got no group ID that was free") > + > + for name, gid in ids.items(): > + ksft_eq(_members(sk) & _bit(gid), 0, > + comment=f"member of NET_DM {name}") [ ... ] -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261123155503.2497063-1-anilkaushikwireless%40gmail.com ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-11-24 15:56 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2026-11-23 15:55 [PATCH net v8 0/2] genetlink: Reject joining multicast groups no family owns Anil Kaushik 2026-11-23 15:55 ` [PATCH net v8 1/2] " Anil Kaushik 2026-11-24 15:56 ` netdev-bot+sashiko 2026-11-23 15:55 ` [PATCH net v8 2/2] selftests: net: test joining genetlink " Anil Kaushik 2026-11-24 15:56 ` netdev-bot+sashiko
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®