create_test_...with_mapping(9)
β¨ create_test_...with_mapping(9) β¨
okay so bestie, welcome to the Kernel API Manual β this is the little corner of the kernel docs about create_test_user_ns_with_mapping, and honestly? it's giving "tiny helper, huge main character energy" π
let's get into it π«Ά
πΈ NAME πΈ
create_test_user_ns_with_mapping β makes you a mock user namespace with a UID mapping, no cap π
π¦ SYNOPSIS π¦
struct user_namespace * create_test_user_ns_with_mapping (struct kunit
*test , struct user_namespace *parent_ns , kuid_t mapped_kuid );
like, that's the whole vibe. three args, one pointer back. slay β¨
π ARGUMENTS π
testβ the KUnit test context, aka where the test framework keeps its stuff π§parent_nsβ the parent namespace (typicallyinit_user_ns, iykyk) πmapped_kuidβ thekuidthat uid 0 in this namespace maps to over in the parent π
π₯ DESCRIPTION π₯
It creates a minimal user namespace structure for testing, where uid 0 in the namespace maps to a specific kuid in the parent namespace. that's the whole job, and it does it flawlessly, periodt π
literally minimal, literally on purpose.
β RETURN β
Returns a pointer to the allocated namespace β or NULL on failure π so like, check it, bestie, don't just vibe forward blindly π
π SEE ALSO π
Kernel file ./security/commoncap_test.c β the source of truth, go look π¦
test_vfsuid_root_in_currentns_init_ns(9)test_vfsuid_root_in_currentns_invalid(9)test_vfsuid_root_in_currentns_nonzero(9)test_kuid_root_in_ns_init_ns_uid0(9)test_kuid_root_in_ns_init_ns_nonzero(9)test_kuid_root_in_ns_with_mapping(9)test_kuid_root_in_ns_with_different_mappings(9)
π reminder: these are the sibling tests, so if you're deep in./securityandcommoncap_test.c, you're exactly where you're supposed to be π
mwah, that's the page π brought to you from ./security, dated October 2026, and yeah the manual name is Kernel API Manual β now go write that test, bestie, you've got this πΈπβ¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms