* [PATCH 0/2] Minor bugfixes for kunit userns tests
@ 2026-09-11 12:58 Christian Brauner
2026-09-11 12:58 ` [PATCH 1/2] userns: rename insert_extent() and sort_idmaps() Christian Brauner
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Christian Brauner @ 2026-09-11 12:58 UTC (permalink / raw)
To: Bill Wendling
Cc: Christian Brauner, Bradley Morgan, Thomas Weißschuh,
Kees Cook, Gustavo A. R. Silva, Aleksa Sarai, Jan Kara,
Nathan Chancellor, Miguel Ojeda, Thomas Gleixner, Nicolas Schier,
Gary Guo, Alice Ryhl, Douglas Anderson, Anand Moon,
Oleg Nesterov, Alexander Viro, kernel test robot,
codemender-patching+linux, linux-kernel, linux-fsdevel,
linux-hardening
Hey,
two fixes for the kunit userns tests.
Christian Brauner (2):
userns: rename insert_extent() and sort_idmaps()
userns: declare the KUnit-visible helpers whenever KUnit is enabled
include/linux/user_namespace.h | 9 +++++----
kernel/tests/user_ns_map_kunit.c | 6 +++---
kernel/user_namespace.c | 19 ++++++++++---------
3 files changed, 18 insertions(+), 16 deletions(-)
--
2.53.0
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH 1/2] userns: rename insert_extent() and sort_idmaps() 2026-09-11 12:58 [PATCH 0/2] Minor bugfixes for kunit userns tests Christian Brauner @ 2026-09-11 12:58 ` Christian Brauner 2026-09-11 14:34 ` Jan Kara 2026-09-11 19:22 ` Bill Wendling 2026-09-11 12:58 ` [PATCH 2/2] userns: declare the KUnit-visible helpers whenever KUnit is enabled Christian Brauner 2026-09-11 14:44 ` [PATCH 0/2] Minor bugfixes for kunit userns tests Bradley Morgan 2 siblings, 2 replies; 8+ messages in thread From: Christian Brauner @ 2026-09-11 12:58 UTC (permalink / raw) To: Bill Wendling Cc: Bradley Morgan, Thomas Weißschuh, Kees Cook, Gustavo A. R. Silva, Aleksa Sarai, Jan Kara, Nathan Chancellor, Miguel Ojeda, Thomas Gleixner, Nicolas Schier, Gary Guo, Alice Ryhl, Douglas Anderson, Anand Moon, Oleg Nesterov, Alexander Viro, kernel test robot, codemender-patching+linux, linux-kernel, linux-fsdevel, linux-hardening, Christian Brauner The KUnit test suite turned insert_extent() and sort_idmaps() into global symbols and declared them in include/linux/user_namespace.h. That header is pulled in nearly everywhere through linux/cgroup.h and the btrfs self-tests carry a static insert_extent() of their own, so any config with both test suites enabled fails to build: fs/btrfs/tests/inode-tests.c:16:13: error: conflicting types for 'insert_extent' include/linux/user_namespace.h:212:12: note: previous declaration of 'insert_extent' A global symbol needs a prefix. Rename them to uid_gid_map_insert_extent() and uid_gid_map_sort(). It's the better name anyway. No functional changes. Fixes: f6f1a2496ba5 ("userns: Add KUnit test suite for uid_gid_map") Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202609110843.okbPe7GM-lkp@intel.com/ Closes: https://lore.kernel.org/oe-kbuild-all/202609110937.zHKPPXJk-lkp@intel.com/ Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org> --- include/linux/user_namespace.h | 5 +++-- kernel/tests/user_ns_map_kunit.c | 6 +++--- kernel/user_namespace.c | 19 ++++++++++--------- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h index 633157781edc..637cd7e91a45 100644 --- a/include/linux/user_namespace.h +++ b/include/linux/user_namespace.h @@ -209,8 +209,9 @@ extern bool current_in_userns(const struct user_namespace *target_ns); struct ns_common *ns_get_owner(struct ns_common *ns); #if IS_ENABLED(CONFIG_USER_NS_MAP_KUNIT_TEST) -extern int insert_extent(struct uid_gid_map *map, struct uid_gid_extent *extent); -extern int sort_idmaps(struct uid_gid_map *map); +extern int uid_gid_map_insert_extent(struct uid_gid_map *map, + struct uid_gid_extent *extent); +extern int uid_gid_map_sort(struct uid_gid_map *map); #endif /* CONFIG_USER_NS_MAP_KUNIT_TEST */ #else diff --git a/kernel/tests/user_ns_map_kunit.c b/kernel/tests/user_ns_map_kunit.c index 24c21e43a36c..033dccc6a535 100644 --- a/kernel/tests/user_ns_map_kunit.c +++ b/kernel/tests/user_ns_map_kunit.c @@ -24,7 +24,7 @@ static void user_ns_map_insert(struct kunit *test) extent.lower_first = i * 100; extent.count = 5; - ret = insert_extent(&map, &extent); + ret = uid_gid_map_insert_extent(&map, &extent); KUNIT_ASSERT_EQ(test, ret, 0); } @@ -54,14 +54,14 @@ static void user_ns_map_insert_extended(struct kunit *test) extent.lower_first = value * 100; extent.count = 5; - ret = insert_extent(&map, &extent); + ret = uid_gid_map_insert_extent(&map, &extent); KUNIT_ASSERT_EQ(test, ret, 0); } KUNIT_EXPECT_EQ(test, map.nr_extents, NR_EXTENTS); /* Now sort the map to set up reverse mapping */ - ret = sort_idmaps(&map); + ret = uid_gid_map_sort(&map); KUNIT_ASSERT_EQ(test, ret, 0); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, map.reverse); diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c index f9cbb4b92b48..98b0279b6cc6 100644 --- a/kernel/user_namespace.c +++ b/kernel/user_namespace.c @@ -780,12 +780,13 @@ static bool mappings_overlap(struct uid_gid_map *new_map, } /* - * insert_extent - Safely insert a new idmap extent into struct uid_gid_map. + * uid_gid_map_insert_extent - Safely insert a new idmap extent into + * struct uid_gid_map. * Takes care to allocate a 4K block of memory if the number of mappings exceeds * UID_GID_MAP_MAX_BASE_EXTENTS. */ -VISIBLE_IF_KUNIT int insert_extent(struct uid_gid_map *map, - struct uid_gid_extent *extent) +VISIBLE_IF_KUNIT int uid_gid_map_insert_extent(struct uid_gid_map *map, + struct uid_gid_extent *extent) { struct uid_gid_extent *dest; @@ -821,7 +822,7 @@ VISIBLE_IF_KUNIT int insert_extent(struct uid_gid_map *map, *dest = *extent; return 0; } -EXPORT_SYMBOL_IF_KUNIT(insert_extent); +EXPORT_SYMBOL_IF_KUNIT(uid_gid_map_insert_extent); /* cmp function to sort() forward mappings */ static int cmp_extents_forward(const void *a, const void *b) @@ -854,10 +855,10 @@ static int cmp_extents_reverse(const void *a, const void *b) } /* - * sort_idmaps - Sorts an array of idmap entries. + * uid_gid_map_sort - Sorts an array of idmap entries. * Can only be called if number of mappings exceeds UID_GID_MAP_MAX_BASE_EXTENTS. */ -VISIBLE_IF_KUNIT int sort_idmaps(struct uid_gid_map *map) +VISIBLE_IF_KUNIT int uid_gid_map_sort(struct uid_gid_map *map) { if (map->nr_extents <= UID_GID_MAP_MAX_BASE_EXTENTS) return 0; @@ -878,7 +879,7 @@ VISIBLE_IF_KUNIT int sort_idmaps(struct uid_gid_map *map) return 0; } -EXPORT_SYMBOL_IF_KUNIT(sort_idmaps); +EXPORT_SYMBOL_IF_KUNIT(uid_gid_map_sort); /** * verify_root_map() - check the uid 0 mapping @@ -1047,7 +1048,7 @@ static ssize_t map_write(struct file *file, const char __user *buf, (next_line != NULL)) goto out; - ret = insert_extent(&new_map, &extent); + ret = uid_gid_map_insert_extent(&new_map, &extent); if (ret < 0) goto out; ret = -EINVAL; @@ -1091,7 +1092,7 @@ static ssize_t map_write(struct file *file, const char __user *buf, * If we want to use binary search for lookup, this clones the extent * array and sorts both copies. */ - ret = sort_idmaps(&new_map); + ret = uid_gid_map_sort(&new_map); if (ret < 0) goto out; -- 2.53.0 ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] userns: rename insert_extent() and sort_idmaps() 2026-09-11 12:58 ` [PATCH 1/2] userns: rename insert_extent() and sort_idmaps() Christian Brauner @ 2026-09-11 14:34 ` Jan Kara 2026-09-11 19:22 ` Bill Wendling 1 sibling, 0 replies; 8+ messages in thread From: Jan Kara @ 2026-09-11 14:34 UTC (permalink / raw) To: Christian Brauner Cc: Bill Wendling, Bradley Morgan, Thomas Weißschuh, Kees Cook, Gustavo A. R. Silva, Aleksa Sarai, Jan Kara, Nathan Chancellor, Miguel Ojeda, Thomas Gleixner, Nicolas Schier, Gary Guo, Alice Ryhl, Douglas Anderson, Anand Moon, Oleg Nesterov, Alexander Viro, kernel test robot, codemender-patching+linux, linux-kernel, linux-fsdevel, linux-hardening On Fri 11-09-26 14:58:39, Christian Brauner wrote: > The KUnit test suite turned insert_extent() and sort_idmaps() into global > symbols and declared them in include/linux/user_namespace.h. That header > is pulled in nearly everywhere through linux/cgroup.h and the btrfs > self-tests carry a static insert_extent() of their own, so any config > with both test suites enabled fails to build: > > fs/btrfs/tests/inode-tests.c:16:13: error: conflicting types for 'insert_extent' > include/linux/user_namespace.h:212:12: note: previous declaration of 'insert_extent' > > A global symbol needs a prefix. Rename them to > uid_gid_map_insert_extent() and uid_gid_map_sort(). It's the better name > anyway. > > No functional changes. > > Fixes: f6f1a2496ba5 ("userns: Add KUnit test suite for uid_gid_map") > Reported-by: kernel test robot <lkp@intel.com> > Closes: https://lore.kernel.org/oe-kbuild-all/202609110843.okbPe7GM-lkp@intel.com/ > Closes: https://lore.kernel.org/oe-kbuild-all/202609110937.zHKPPXJk-lkp@intel.com/ > Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org> Sure. Feel free to add: Reviewed-by: Jan Kara <jack@suse.cz> Honza > --- > include/linux/user_namespace.h | 5 +++-- > kernel/tests/user_ns_map_kunit.c | 6 +++--- > kernel/user_namespace.c | 19 ++++++++++--------- > 3 files changed, 16 insertions(+), 14 deletions(-) > > diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h > index 633157781edc..637cd7e91a45 100644 > --- a/include/linux/user_namespace.h > +++ b/include/linux/user_namespace.h > @@ -209,8 +209,9 @@ extern bool current_in_userns(const struct user_namespace *target_ns); > struct ns_common *ns_get_owner(struct ns_common *ns); > > #if IS_ENABLED(CONFIG_USER_NS_MAP_KUNIT_TEST) > -extern int insert_extent(struct uid_gid_map *map, struct uid_gid_extent *extent); > -extern int sort_idmaps(struct uid_gid_map *map); > +extern int uid_gid_map_insert_extent(struct uid_gid_map *map, > + struct uid_gid_extent *extent); > +extern int uid_gid_map_sort(struct uid_gid_map *map); > #endif /* CONFIG_USER_NS_MAP_KUNIT_TEST */ > > #else > diff --git a/kernel/tests/user_ns_map_kunit.c b/kernel/tests/user_ns_map_kunit.c > index 24c21e43a36c..033dccc6a535 100644 > --- a/kernel/tests/user_ns_map_kunit.c > +++ b/kernel/tests/user_ns_map_kunit.c > @@ -24,7 +24,7 @@ static void user_ns_map_insert(struct kunit *test) > extent.lower_first = i * 100; > extent.count = 5; > > - ret = insert_extent(&map, &extent); > + ret = uid_gid_map_insert_extent(&map, &extent); > KUNIT_ASSERT_EQ(test, ret, 0); > } > > @@ -54,14 +54,14 @@ static void user_ns_map_insert_extended(struct kunit *test) > extent.lower_first = value * 100; > extent.count = 5; > > - ret = insert_extent(&map, &extent); > + ret = uid_gid_map_insert_extent(&map, &extent); > KUNIT_ASSERT_EQ(test, ret, 0); > } > > KUNIT_EXPECT_EQ(test, map.nr_extents, NR_EXTENTS); > > /* Now sort the map to set up reverse mapping */ > - ret = sort_idmaps(&map); > + ret = uid_gid_map_sort(&map); > KUNIT_ASSERT_EQ(test, ret, 0); > KUNIT_ASSERT_NOT_ERR_OR_NULL(test, map.reverse); > > diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c > index f9cbb4b92b48..98b0279b6cc6 100644 > --- a/kernel/user_namespace.c > +++ b/kernel/user_namespace.c > @@ -780,12 +780,13 @@ static bool mappings_overlap(struct uid_gid_map *new_map, > } > > /* > - * insert_extent - Safely insert a new idmap extent into struct uid_gid_map. > + * uid_gid_map_insert_extent - Safely insert a new idmap extent into > + * struct uid_gid_map. > * Takes care to allocate a 4K block of memory if the number of mappings exceeds > * UID_GID_MAP_MAX_BASE_EXTENTS. > */ > -VISIBLE_IF_KUNIT int insert_extent(struct uid_gid_map *map, > - struct uid_gid_extent *extent) > +VISIBLE_IF_KUNIT int uid_gid_map_insert_extent(struct uid_gid_map *map, > + struct uid_gid_extent *extent) > { > struct uid_gid_extent *dest; > > @@ -821,7 +822,7 @@ VISIBLE_IF_KUNIT int insert_extent(struct uid_gid_map *map, > *dest = *extent; > return 0; > } > -EXPORT_SYMBOL_IF_KUNIT(insert_extent); > +EXPORT_SYMBOL_IF_KUNIT(uid_gid_map_insert_extent); > > /* cmp function to sort() forward mappings */ > static int cmp_extents_forward(const void *a, const void *b) > @@ -854,10 +855,10 @@ static int cmp_extents_reverse(const void *a, const void *b) > } > > /* > - * sort_idmaps - Sorts an array of idmap entries. > + * uid_gid_map_sort - Sorts an array of idmap entries. > * Can only be called if number of mappings exceeds UID_GID_MAP_MAX_BASE_EXTENTS. > */ > -VISIBLE_IF_KUNIT int sort_idmaps(struct uid_gid_map *map) > +VISIBLE_IF_KUNIT int uid_gid_map_sort(struct uid_gid_map *map) > { > if (map->nr_extents <= UID_GID_MAP_MAX_BASE_EXTENTS) > return 0; > @@ -878,7 +879,7 @@ VISIBLE_IF_KUNIT int sort_idmaps(struct uid_gid_map *map) > > return 0; > } > -EXPORT_SYMBOL_IF_KUNIT(sort_idmaps); > +EXPORT_SYMBOL_IF_KUNIT(uid_gid_map_sort); > > /** > * verify_root_map() - check the uid 0 mapping > @@ -1047,7 +1048,7 @@ static ssize_t map_write(struct file *file, const char __user *buf, > (next_line != NULL)) > goto out; > > - ret = insert_extent(&new_map, &extent); > + ret = uid_gid_map_insert_extent(&new_map, &extent); > if (ret < 0) > goto out; > ret = -EINVAL; > @@ -1091,7 +1092,7 @@ static ssize_t map_write(struct file *file, const char __user *buf, > * If we want to use binary search for lookup, this clones the extent > * array and sorts both copies. > */ > - ret = sort_idmaps(&new_map); > + ret = uid_gid_map_sort(&new_map); > if (ret < 0) > goto out; > > -- > 2.53.0 > -- Jan Kara <jack@suse.com> SUSE Labs, CR ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] userns: rename insert_extent() and sort_idmaps() 2026-09-11 12:58 ` [PATCH 1/2] userns: rename insert_extent() and sort_idmaps() Christian Brauner 2026-09-11 14:34 ` Jan Kara @ 2026-09-11 19:22 ` Bill Wendling 1 sibling, 0 replies; 8+ messages in thread From: Bill Wendling @ 2026-09-11 19:22 UTC (permalink / raw) To: Christian Brauner Cc: Bradley Morgan, Thomas Weißschuh, Kees Cook, Gustavo A. R. Silva, Aleksa Sarai, Jan Kara, Nathan Chancellor, Miguel Ojeda, Thomas Gleixner, Nicolas Schier, Gary Guo, Alice Ryhl, Douglas Anderson, Anand Moon, Oleg Nesterov, Alexander Viro, kernel test robot, codemender-patching+linux, linux-kernel, linux-fsdevel, linux-hardening On Fri, Sep 11, 2026 at 5:59 AM Christian Brauner <brauner@kernel.org> wrote: > > The KUnit test suite turned insert_extent() and sort_idmaps() into global > symbols and declared them in include/linux/user_namespace.h. That header > is pulled in nearly everywhere through linux/cgroup.h and the btrfs > self-tests carry a static insert_extent() of their own, so any config > with both test suites enabled fails to build: > > fs/btrfs/tests/inode-tests.c:16:13: error: conflicting types for 'insert_extent' > include/linux/user_namespace.h:212:12: note: previous declaration of 'insert_extent' > > A global symbol needs a prefix. Rename them to > uid_gid_map_insert_extent() and uid_gid_map_sort(). It's the better name > anyway. > > No functional changes. > > Fixes: f6f1a2496ba5 ("userns: Add KUnit test suite for uid_gid_map") > Reported-by: kernel test robot <lkp@intel.com> > Closes: https://lore.kernel.org/oe-kbuild-all/202609110843.okbPe7GM-lkp@intel.com/ > Closes: https://lore.kernel.org/oe-kbuild-all/202609110937.zHKPPXJk-lkp@intel.com/ > Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org> Apologies for this. This version of the KUnit testing is susceptible to exposting duplicate symbols. :-( Reviewed-by: Bill Wendling <morbo@google.com> -bw > --- > include/linux/user_namespace.h | 5 +++-- > kernel/tests/user_ns_map_kunit.c | 6 +++--- > kernel/user_namespace.c | 19 ++++++++++--------- > 3 files changed, 16 insertions(+), 14 deletions(-) > > diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h > index 633157781edc..637cd7e91a45 100644 > --- a/include/linux/user_namespace.h > +++ b/include/linux/user_namespace.h > @@ -209,8 +209,9 @@ extern bool current_in_userns(const struct user_namespace *target_ns); > struct ns_common *ns_get_owner(struct ns_common *ns); > > #if IS_ENABLED(CONFIG_USER_NS_MAP_KUNIT_TEST) > -extern int insert_extent(struct uid_gid_map *map, struct uid_gid_extent *extent); > -extern int sort_idmaps(struct uid_gid_map *map); > +extern int uid_gid_map_insert_extent(struct uid_gid_map *map, > + struct uid_gid_extent *extent); > +extern int uid_gid_map_sort(struct uid_gid_map *map); > #endif /* CONFIG_USER_NS_MAP_KUNIT_TEST */ > > #else > diff --git a/kernel/tests/user_ns_map_kunit.c b/kernel/tests/user_ns_map_kunit.c > index 24c21e43a36c..033dccc6a535 100644 > --- a/kernel/tests/user_ns_map_kunit.c > +++ b/kernel/tests/user_ns_map_kunit.c > @@ -24,7 +24,7 @@ static void user_ns_map_insert(struct kunit *test) > extent.lower_first = i * 100; > extent.count = 5; > > - ret = insert_extent(&map, &extent); > + ret = uid_gid_map_insert_extent(&map, &extent); > KUNIT_ASSERT_EQ(test, ret, 0); > } > > @@ -54,14 +54,14 @@ static void user_ns_map_insert_extended(struct kunit *test) > extent.lower_first = value * 100; > extent.count = 5; > > - ret = insert_extent(&map, &extent); > + ret = uid_gid_map_insert_extent(&map, &extent); > KUNIT_ASSERT_EQ(test, ret, 0); > } > > KUNIT_EXPECT_EQ(test, map.nr_extents, NR_EXTENTS); > > /* Now sort the map to set up reverse mapping */ > - ret = sort_idmaps(&map); > + ret = uid_gid_map_sort(&map); > KUNIT_ASSERT_EQ(test, ret, 0); > KUNIT_ASSERT_NOT_ERR_OR_NULL(test, map.reverse); > > diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c > index f9cbb4b92b48..98b0279b6cc6 100644 > --- a/kernel/user_namespace.c > +++ b/kernel/user_namespace.c > @@ -780,12 +780,13 @@ static bool mappings_overlap(struct uid_gid_map *new_map, > } > > /* > - * insert_extent - Safely insert a new idmap extent into struct uid_gid_map. > + * uid_gid_map_insert_extent - Safely insert a new idmap extent into > + * struct uid_gid_map. > * Takes care to allocate a 4K block of memory if the number of mappings exceeds > * UID_GID_MAP_MAX_BASE_EXTENTS. > */ > -VISIBLE_IF_KUNIT int insert_extent(struct uid_gid_map *map, > - struct uid_gid_extent *extent) > +VISIBLE_IF_KUNIT int uid_gid_map_insert_extent(struct uid_gid_map *map, > + struct uid_gid_extent *extent) > { > struct uid_gid_extent *dest; > > @@ -821,7 +822,7 @@ VISIBLE_IF_KUNIT int insert_extent(struct uid_gid_map *map, > *dest = *extent; > return 0; > } > -EXPORT_SYMBOL_IF_KUNIT(insert_extent); > +EXPORT_SYMBOL_IF_KUNIT(uid_gid_map_insert_extent); > > /* cmp function to sort() forward mappings */ > static int cmp_extents_forward(const void *a, const void *b) > @@ -854,10 +855,10 @@ static int cmp_extents_reverse(const void *a, const void *b) > } > > /* > - * sort_idmaps - Sorts an array of idmap entries. > + * uid_gid_map_sort - Sorts an array of idmap entries. > * Can only be called if number of mappings exceeds UID_GID_MAP_MAX_BASE_EXTENTS. > */ > -VISIBLE_IF_KUNIT int sort_idmaps(struct uid_gid_map *map) > +VISIBLE_IF_KUNIT int uid_gid_map_sort(struct uid_gid_map *map) > { > if (map->nr_extents <= UID_GID_MAP_MAX_BASE_EXTENTS) > return 0; > @@ -878,7 +879,7 @@ VISIBLE_IF_KUNIT int sort_idmaps(struct uid_gid_map *map) > > return 0; > } > -EXPORT_SYMBOL_IF_KUNIT(sort_idmaps); > +EXPORT_SYMBOL_IF_KUNIT(uid_gid_map_sort); > > /** > * verify_root_map() - check the uid 0 mapping > @@ -1047,7 +1048,7 @@ static ssize_t map_write(struct file *file, const char __user *buf, > (next_line != NULL)) > goto out; > > - ret = insert_extent(&new_map, &extent); > + ret = uid_gid_map_insert_extent(&new_map, &extent); > if (ret < 0) > goto out; > ret = -EINVAL; > @@ -1091,7 +1092,7 @@ static ssize_t map_write(struct file *file, const char __user *buf, > * If we want to use binary search for lookup, this clones the extent > * array and sorts both copies. > */ > - ret = sort_idmaps(&new_map); > + ret = uid_gid_map_sort(&new_map); > if (ret < 0) > goto out; > > -- > 2.53.0 > ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/2] userns: declare the KUnit-visible helpers whenever KUnit is enabled 2026-09-11 12:58 [PATCH 0/2] Minor bugfixes for kunit userns tests Christian Brauner 2026-09-11 12:58 ` [PATCH 1/2] userns: rename insert_extent() and sort_idmaps() Christian Brauner @ 2026-09-11 12:58 ` Christian Brauner 2026-09-11 14:36 ` Jan Kara 2026-09-11 19:23 ` Bill Wendling 2026-09-11 14:44 ` [PATCH 0/2] Minor bugfixes for kunit userns tests Bradley Morgan 2 siblings, 2 replies; 8+ messages in thread From: Christian Brauner @ 2026-09-11 12:58 UTC (permalink / raw) To: Bill Wendling Cc: Bradley Morgan, Thomas Weißschuh, Kees Cook, Gustavo A. R. Silva, Aleksa Sarai, Jan Kara, Nathan Chancellor, Miguel Ojeda, Thomas Gleixner, Nicolas Schier, Gary Guo, Alice Ryhl, Douglas Anderson, Anand Moon, Oleg Nesterov, Alexander Viro, kernel test robot, codemender-patching+linux, linux-kernel, linux-fsdevel, linux-hardening, Christian Brauner VISIBLE_IF_KUNIT drops the static qualifier whenever CONFIG_KUNIT is enabled but the prototypes for the two helpers it exposes are only declared when CONFIG_USER_NS_MAP_KUNIT_TEST is set. kernel/user_namespace.c:787:22: warning: no previous prototype for 'insert_extent' [-Wmissing-prototypes] kernel/user_namespace.c:860:22: warning: no previous prototype for 'sort_idmaps' [-Wmissing-prototypes] Guard the declarations on CONFIG_KUNIT so they match the definitions. Fixes: f6f1a2496ba5 ("userns: Add KUnit test suite for uid_gid_map") Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202609111048.yhHILE11-lkp@intel.com/ Closes: https://lore.kernel.org/oe-kbuild-all/202609111305.ta3EOA2x-lkp@intel.com/ Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org> --- include/linux/user_namespace.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h index 637cd7e91a45..91232053775d 100644 --- a/include/linux/user_namespace.h +++ b/include/linux/user_namespace.h @@ -208,11 +208,11 @@ extern bool in_userns(const struct user_namespace *ancestor, extern bool current_in_userns(const struct user_namespace *target_ns); struct ns_common *ns_get_owner(struct ns_common *ns); -#if IS_ENABLED(CONFIG_USER_NS_MAP_KUNIT_TEST) +#if IS_ENABLED(CONFIG_KUNIT) extern int uid_gid_map_insert_extent(struct uid_gid_map *map, struct uid_gid_extent *extent); extern int uid_gid_map_sort(struct uid_gid_map *map); -#endif /* CONFIG_USER_NS_MAP_KUNIT_TEST */ +#endif /* CONFIG_KUNIT */ #else -- 2.53.0 ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] userns: declare the KUnit-visible helpers whenever KUnit is enabled 2026-09-11 12:58 ` [PATCH 2/2] userns: declare the KUnit-visible helpers whenever KUnit is enabled Christian Brauner @ 2026-09-11 14:36 ` Jan Kara 2026-09-11 19:23 ` Bill Wendling 1 sibling, 0 replies; 8+ messages in thread From: Jan Kara @ 2026-09-11 14:36 UTC (permalink / raw) To: Christian Brauner Cc: Bill Wendling, Bradley Morgan, Thomas Weißschuh, Kees Cook, Gustavo A. R. Silva, Aleksa Sarai, Jan Kara, Nathan Chancellor, Miguel Ojeda, Thomas Gleixner, Nicolas Schier, Gary Guo, Alice Ryhl, Douglas Anderson, Anand Moon, Oleg Nesterov, Alexander Viro, kernel test robot, codemender-patching+linux, linux-kernel, linux-fsdevel, linux-hardening On Fri 11-09-26 14:58:40, Christian Brauner wrote: > VISIBLE_IF_KUNIT drops the static qualifier whenever CONFIG_KUNIT is > enabled but the prototypes for the two helpers it exposes are only > declared when CONFIG_USER_NS_MAP_KUNIT_TEST is set. > > kernel/user_namespace.c:787:22: warning: no previous prototype for 'insert_extent' [-Wmissing-prototypes] > kernel/user_namespace.c:860:22: warning: no previous prototype for 'sort_idmaps' [-Wmissing-prototypes] > > Guard the declarations on CONFIG_KUNIT so they match the definitions. > > Fixes: f6f1a2496ba5 ("userns: Add KUnit test suite for uid_gid_map") > Reported-by: kernel test robot <lkp@intel.com> > Closes: https://lore.kernel.org/oe-kbuild-all/202609111048.yhHILE11-lkp@intel.com/ > Closes: https://lore.kernel.org/oe-kbuild-all/202609111305.ta3EOA2x-lkp@intel.com/ > Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org> Looks good. Feel free to add: Reviewed-by: Jan Kara <jack@suse.cz> Honza > --- > include/linux/user_namespace.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h > index 637cd7e91a45..91232053775d 100644 > --- a/include/linux/user_namespace.h > +++ b/include/linux/user_namespace.h > @@ -208,11 +208,11 @@ extern bool in_userns(const struct user_namespace *ancestor, > extern bool current_in_userns(const struct user_namespace *target_ns); > struct ns_common *ns_get_owner(struct ns_common *ns); > > -#if IS_ENABLED(CONFIG_USER_NS_MAP_KUNIT_TEST) > +#if IS_ENABLED(CONFIG_KUNIT) > extern int uid_gid_map_insert_extent(struct uid_gid_map *map, > struct uid_gid_extent *extent); > extern int uid_gid_map_sort(struct uid_gid_map *map); > -#endif /* CONFIG_USER_NS_MAP_KUNIT_TEST */ > +#endif /* CONFIG_KUNIT */ > > #else > > -- > 2.53.0 > -- Jan Kara <jack@suse.com> SUSE Labs, CR ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] userns: declare the KUnit-visible helpers whenever KUnit is enabled 2026-09-11 12:58 ` [PATCH 2/2] userns: declare the KUnit-visible helpers whenever KUnit is enabled Christian Brauner 2026-09-11 14:36 ` Jan Kara @ 2026-09-11 19:23 ` Bill Wendling 1 sibling, 0 replies; 8+ messages in thread From: Bill Wendling @ 2026-09-11 19:23 UTC (permalink / raw) To: Christian Brauner Cc: Bradley Morgan, Thomas Weißschuh, Kees Cook, Gustavo A. R. Silva, Aleksa Sarai, Jan Kara, Nathan Chancellor, Miguel Ojeda, Thomas Gleixner, Nicolas Schier, Gary Guo, Alice Ryhl, Douglas Anderson, Anand Moon, Oleg Nesterov, Alexander Viro, kernel test robot, codemender-patching+linux, linux-kernel, linux-fsdevel, linux-hardening On Fri, Sep 11, 2026 at 5:59 AM Christian Brauner <brauner@kernel.org> wrote: > > VISIBLE_IF_KUNIT drops the static qualifier whenever CONFIG_KUNIT is > enabled but the prototypes for the two helpers it exposes are only > declared when CONFIG_USER_NS_MAP_KUNIT_TEST is set. > > kernel/user_namespace.c:787:22: warning: no previous prototype for 'insert_extent' [-Wmissing-prototypes] > kernel/user_namespace.c:860:22: warning: no previous prototype for 'sort_idmaps' [-Wmissing-prototypes] > > Guard the declarations on CONFIG_KUNIT so they match the definitions. > > Fixes: f6f1a2496ba5 ("userns: Add KUnit test suite for uid_gid_map") > Reported-by: kernel test robot <lkp@intel.com> > Closes: https://lore.kernel.org/oe-kbuild-all/202609111048.yhHILE11-lkp@intel.com/ > Closes: https://lore.kernel.org/oe-kbuild-all/202609111305.ta3EOA2x-lkp@intel.com/ > Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org> Feel free to add: Reviewed-by: Bill Wendling <morbo@google.com> -bw > --- > include/linux/user_namespace.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h > index 637cd7e91a45..91232053775d 100644 > --- a/include/linux/user_namespace.h > +++ b/include/linux/user_namespace.h > @@ -208,11 +208,11 @@ extern bool in_userns(const struct user_namespace *ancestor, > extern bool current_in_userns(const struct user_namespace *target_ns); > struct ns_common *ns_get_owner(struct ns_common *ns); > > -#if IS_ENABLED(CONFIG_USER_NS_MAP_KUNIT_TEST) > +#if IS_ENABLED(CONFIG_KUNIT) > extern int uid_gid_map_insert_extent(struct uid_gid_map *map, > struct uid_gid_extent *extent); > extern int uid_gid_map_sort(struct uid_gid_map *map); > -#endif /* CONFIG_USER_NS_MAP_KUNIT_TEST */ > +#endif /* CONFIG_KUNIT */ > > #else > > -- > 2.53.0 > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/2] Minor bugfixes for kunit userns tests 2026-09-11 12:58 [PATCH 0/2] Minor bugfixes for kunit userns tests Christian Brauner 2026-09-11 12:58 ` [PATCH 1/2] userns: rename insert_extent() and sort_idmaps() Christian Brauner 2026-09-11 12:58 ` [PATCH 2/2] userns: declare the KUnit-visible helpers whenever KUnit is enabled Christian Brauner @ 2026-09-11 14:44 ` Bradley Morgan 2 siblings, 0 replies; 8+ messages in thread From: Bradley Morgan @ 2026-09-11 14:44 UTC (permalink / raw) To: Christian Brauner, Bill Wendling Cc: Thomas Weißschuh, Kees Cook, Gustavo A. R. Silva, Aleksa Sarai, Jan Kara, Nathan Chancellor, Miguel Ojeda, Thomas Gleixner, Nicolas Schier, Gary Guo, Alice Ryhl, Douglas Anderson, Anand Moon, Oleg Nesterov, Alexander Viro, kernel test robot, codemender-patching+linux, linux-kernel, linux-fsdevel, linux-hardening On 11 September 2026 13:58:38 BST, Christian Brauner <brauner@kernel.org> wrote: >Hey, > >two fixes for the kunit userns tests. > >Christian Brauner (2): > userns: rename insert_extent() and sort_idmaps() > userns: declare the KUnit-visible helpers whenever KUnit is enabled > > include/linux/user_namespace.h | 9 +++++---- > kernel/tests/user_ns_map_kunit.c | 6 +++--- > kernel/user_namespace.c | 19 ++++++++++--------- > 3 files changed, 18 insertions(+), 16 deletions(-) > > Whole series. Reviewed-by: Bradley Morgan <brads@mainlining.org> Thanks for the patch. --- Thanks! https://lore.kernel.org/all/EE579805-42F2-4C58-B752-F28779EEB717@grrlz.net/ ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2026-09-11 19:24 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2026-09-11 12:58 [PATCH 0/2] Minor bugfixes for kunit userns tests Christian Brauner 2026-09-11 12:58 ` [PATCH 1/2] userns: rename insert_extent() and sort_idmaps() Christian Brauner 2026-09-11 14:34 ` Jan Kara 2026-09-11 19:22 ` Bill Wendling 2026-09-11 12:58 ` [PATCH 2/2] userns: declare the KUnit-visible helpers whenever KUnit is enabled Christian Brauner 2026-09-11 14:36 ` Jan Kara 2026-09-11 19:23 ` Bill Wendling 2026-09-11 14:44 ` [PATCH 0/2] Minor bugfixes for kunit userns tests Bradley Morgan
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®