From f6f1a2496ba5dcc076d7fb7aa329887cd6ae55fa Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Tue, 8 Sep 2026 22:27:30 +0000 Subject: userns: Add KUnit test suite for uid_gid_map Add a KUnit test suite to verify the insertion and sorting of mappings in struct uid_gid_map. This test suite validates both base extent insertion (<= 5 mappings) and extended extent insertion (> 5 mappings, which triggers the allocation of the forward and reverse pointers). This is especially useful for verifying that the __counted_by_ptr attribute added to 'forward' and 'reverse' pointers works correctly without causing any runtime bounds-checking panics or traps. Signed-off-by: Bill Wendling Link: https://patch.msgid.link/20260908222734.3048684-2-morbo@google.com Tested-by: Bradley Morgan Reviewed-by: Bradley Morgan Signed-off-by: Christian Brauner (Amutable) --- init/Kconfig | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'init/Kconfig') diff --git a/init/Kconfig b/init/Kconfig index 8583d9f06c52..27c1ffc675bf 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -1457,6 +1457,17 @@ config USER_NS If unsure, say N. +config USER_NS_MAP_KUNIT_TEST + tristate "KUint test for user namespace map insertion" if !KUNIT_ALL_TESTS + depends on USER_NS && KUNIT + default KUNIT_ALL_TESTS + help + This builds the KUnit test for user namespace uid/gid map insertion. + It validates map insertion, limits, dynamic allocation of the + extended extents array, and mapping sorting functions. + + If unsure, say N. + config PID_NS bool "PID Namespaces" default y -- cgit v1.2.3