from_kuid_munged(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– from_kuid_munged β€” Kernel API Manual ✨

okay so real talk, today we're doing a page from the Kernel API Manual and honestly? she's iconic. her name is from_kuid_munged(9) and she does exactly one thing but she does it flawlessly. let's get into it 🫢


🌸 NAME 🌸

from_kuid_munged β€” create a uid from a kuid user-namespace pair πŸ’…


✨ SYNOPSIS ✨

uid_t from_kuid_munged (struct user_namespace *targ , kuid_t kuid );

literally the whole signature, no notes, copy it exactly bestie 😭


πŸŽ€ ARGUMENTS πŸŽ€

  • targ β€” the user namespace we want a uid in. like, where do you want this uid to live? πŸ‘‘
  • kuid β€” the kernel internal uid to start with. this is the raw one, the starting point, the before picture 🌈

πŸ¦‹ DESCRIPTION πŸ¦‹

So what she does: map kuid into the user namespace specified by targ, and return the resulting uid. That's it. That's the whole vibe. πŸ’œ

Also important, and I cannot stress this enough: there is always a mapping into the initial user_namespace. like, always always. no cap. ⭐

Now here's the part that makes her the main character β€” unlike from_kuid, from_kuid_munged never fails and always returns a valid uid. The way that she just doesn't miss?? 😭πŸ”₯ That's exactly why she's appropriate for use in syscalls like stat and getuid, where failing the system call and failing to provide a valid uid are not options. Like, in those situations you genuinely cannot be out here returning nothing. she said "I'll handle it" and she handled it. πŸ‘‘

And if kuid has no mapping in targ? she returns overflowuid. not a crash, not an error, just overflowuid. that's the fallback, that's the safety net, that's her being a responsible queen. 🧚


πŸ“ SEE ALSO πŸ“

Kernel file ./kernel/user_namespace.c β€” go read her home πŸ’–

the whole friend group fr fr, go say hi to all of them πŸ¦‹βœ¨


okay that's the whole page!! tysm for reading, mwah πŸ’‹

this lil gem lives in ./kernel, dated October 2026 β€” and that's the footer, so like... we're done here. bye bestie, slay, drink water πŸ’…πŸŽ€

πŸ“¦ where this page comes from