summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorChristian Brauner <brauner@kernel.org>2026-09-09 09:45:17 +0200
committerChristian Brauner <brauner@kernel.org>2026-09-09 09:45:48 +0200
commit34a496d638705dc227cc6dd2aaaa9e450893502f (patch)
tree7fc226bb2f249a4f225e06a03782d3d8dfc00475 /include/linux
parent03c9d11bfda9cdb81d4979f30ddb0f3c4d5a2aae (diff)
parentf6f1a2496ba5dcc076d7fb7aa329887cd6ae55fa (diff)
downloadlinux-next-34a496d638705dc227cc6dd2aaaa9e450893502f.tar.gz
linux-next-34a496d638705dc227cc6dd2aaaa9e450893502f.zip
Merge patch series "userns: Add __counted_by_ptr attribute to struct uid_gid_map"
Add kunit tests for user namespace idmappings. * patches from https://patch.msgid.link/20260908222734.3048684-1-morbo@google.com: userns: Add KUnit test suite for uid_gid_map userns: Add __counted_by_ptr attribute to struct uid_gid_map Link: https://patch.msgid.link/20260908222734.3048684-1-morbo@google.com Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/user_namespace.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h
index e38d9e60569f..633157781edc 100644
--- a/include/linux/user_namespace.h
+++ b/include/linux/user_namespace.h
@@ -29,8 +29,8 @@ struct uid_gid_map { /* 64 bytes -- 1 cache line */
u32 nr_extents;
};
struct {
- struct uid_gid_extent *forward;
- struct uid_gid_extent *reverse;
+ struct uid_gid_extent *forward __counted_by_ptr(nr_extents);
+ struct uid_gid_extent *reverse __counted_by_ptr(nr_extents);
};
};
};
@@ -207,6 +207,12 @@ extern bool in_userns(const struct user_namespace *ancestor,
const struct user_namespace *child);
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);
+#endif /* CONFIG_USER_NS_MAP_KUNIT_TEST */
+
#else
static inline struct user_namespace *get_user_ns(struct user_namespace *ns)