lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250912195339.20635-14-yana2bsh@gmail.com>
Date: Fri, 12 Sep 2025 22:53:36 +0300
From: Yana Bashlykova <yana2bsh@...il.com>
To: "David S. Miller" <davem@...emloft.net>
Cc: Yana Bashlykova <yana2bsh@...il.com>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>,
	Paolo Abeni <pabeni@...hat.com>,
	Shuah Khan <shuah@...nel.org>,
	netdev@...r.kernel.org,
	linux-kselftest@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	lvc-project@...uxtesting.org
Subject: [PATCH 6.1 13/15] selftests: net: genetlink: add large family ID resolution test

Add test case for resolving family IDs of large Generic Netlink families
(those with 199+ multicast groups):

1. Tests that standard genl_ctrl_resolve() may fail due to:
   - Response size exceeding single message limit
   - Implementation expecting single response

2. Verifies custom my_genl_ctrl_resolve() works by:
   - Using dump mechanism to collect all responses
   - Properly handling multi-message replies
   - Correctly identifying target family

The test validates that large families can be reliably resolved despite
kernel message size limitations.

Signed-off-by: Yana Bashlykova <yana2bsh@...il.com>
---
 tools/testing/selftests/net/genetlink.c | 37 +++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/tools/testing/selftests/net/genetlink.c b/tools/testing/selftests/net/genetlink.c
index 0a05402caa20..361840aae918 100644
--- a/tools/testing/selftests/net/genetlink.c
+++ b/tools/testing/selftests/net/genetlink.c
@@ -1142,6 +1142,43 @@ TEST(genl_ctrl_policy)
 	nl_socket_free(ctrl_sock);
 }
 
+/**
+ * TEST(resolve_large_family_id) - Tests resolution of family ID for
+ * LARGE_GENL Generic Netlink family
+ *
+ * Validates special handling required for families with many multicast groups (199+):
+ * 1. Standard genl_ctrl_resolve() fails due to message size limitations
+ * 2. Custom my_genl_ctrl_resolve() succeeds by using dump mechanism
+ *
+ * Background:
+ * - Kernel successfully registers large families
+ * - Standard resolution fails because:
+ *   * Response doesn't fit in single message
+ *   * genl_ctrl_resolve() expects single response
+ * - Custom solution works by:
+ *   * Using dump request to get all messages
+ *   * Searching for target family in callback
+ *
+ * Verification:
+ * 1. Custom resolver returns valid ID (> 0)
+ * 2. Standard resolver either fails or succeeds (platform-dependent)
+ */
+
+TEST(resolve_large_family_id)
+{
+	int family_id;
+	int no_family_id;
+
+	/* Test custom resolver */
+	family_id = my_genl_ctrl_resolve(LARGE_GENL_FAMILY_NAME);
+	EXPECT_TRUE(family_id > 0);
+
+	/* Test standard resolver (may fail) */
+	no_family_id = genl_ctrl_resolve(socket_alloc_and_conn(),
+					 LARGE_GENL_FAMILY_NAME);
+	EXPECT_TRUE(no_family_id > 0);
+}
+
 /**
  * TEST(capture_end) - Terminates Netlink traffic monitoring session
  *
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ