from_kgid_munged(9)
β¨ from_kgid_munged(9) β¨
okay so bestie, welcome to the kernel API manual β this one's from from_kgid_munged(9) and it's literally about turning a kernel-internal gid into one you can actually hand to userspace π
πΈ NAME πΈ
from_kgid_munged β Create a gid from a kgid user-namespace pair. fr fr that's the whole vibe π«Ά
π SYNOPSIS π
gid_t from_kgid_munged (struct user_namespace *targ , kgid_t kgid );
π ARGUMENTS π
targβ The user namespace we want a gid in. like, where do you want this gid to live, bestie πkgidβ The kernel internal gid to start with. this is the raw ingredient β¨
π¦ DESCRIPTION π¦
So the whole thing is: map kgid into the user-namespace specified by targ and return the resulting gid. That's it. That's the job. slay π
There is always a mapping into the initial user_namespace β like, no matter what, that one's guaranteed, periodt.
Now here's the iconic part: unlike from_kgid, from_kgid_munged never fails and always returns a valid gid. Never. Not once. This is exactly what makes from_kgid_munged appropriate for use in syscalls like stat and getgid, where failing the system call and failing to provide a valid gid are literally not options π like you cannot just show up empty-handed.
and ifkgidhas no mapping intarg? thenoverflowgidis returned. that's the fallback, that's the safety net, that's the munging, iykyk π
π SEE ALSO π
Kernel file ./kernel/user_namespace.c
make_kuid(9)from_kuid(9)from_kuid_munged(9)make_kgid(9)from_kgid(9)make_kprojid(9)from_kprojid(9)from_kprojid_munged(9)verify_root_map(9)
go read the whole friend group, they're all iconic in their own way π§π
and that's the page!! π this one shipped out of ./kernel back in October 2026, so yeah β old money, timeless energy. mwah ππ
π¦ 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