from_kgid_munged(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ 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 if kgid has no mapping in targ? then overflowgid is returned. that's the fallback, that's the safety net, that's the munging, iykyk 🌈

πŸ‘‘ SEE ALSO πŸ‘‘

Kernel file ./kernel/user_namespace.c

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