match_exception_partial(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 match_exception_partial 🌸

okay so this is a page from the Kernel API Manual, bestie β€” like, the kernel's own little handbook of functions β€” and today's main character is match_exception_partial. she's a lil boolean-returning function and she has ONE job. let's get into it πŸ’…


✨ NAME ✨

match_exception_partial β€” she iterates the exception list trying to find a partial match. that's it, that's the whole gig πŸŽ€


✨ SYNOPSIS ✨

bool match_exception_partial (struct list_head *exceptions , short type , u32 major , u32 minor , short access );

✨ ARGUMENTS ✨

  • exceptions β€” the list of exceptions. literally just the list, she's gonna walk it πŸšΆβ€β™€οΈ
  • type β€” device type. it's either DEVCG_DEV_BLOCK or DEVCG_DEV_CHAR, pick your fighter πŸ₯Š
  • major β€” device file major number. pass ~0 if you want it to match all of them, no cap πŸ‘‘
  • minor β€” device file minor number. same deal, ~0 matches all of them ✨
  • access β€” the permission mask, and it's one of DEVCG_ACC_READ, DEVCG_ACC_WRITE, or DEVCG_ACC_MKNOD. choose wisely bb πŸ”

✨ DESCRIPTION ✨

so the way this works is β€” it counts as a partial match if an exception's range is found to contain any of the devices specified by the parameters you passed in. note the emphasis on any bestie, the original really put asterisks around it, that's how you know it matters πŸ’€

and why do we even care? because this is used to make sure no extra access is being granted that's forbidden by any of the exception list. like, she's the vibe check for permissions β€” no sneaky extra access getting through on her watch πŸ™ˆβœ¨


✨ RETURN ✨

returns true in case the provided range mat matches an exception completely 🫢

(and yes, the source page literally says "mat" β€” we're not fixing her, she's iconic and we respect her typos πŸ’–)


✨ SEE ALSO ✨

kernel file ./security/device_cgroup.c, plus the whole friend group:


okay that's the whole lore πŸ¦‹ and a lil sign-off for the record books: this one lives under ./security, and the page is dated October 2026 β€” so yeah, she's from the future, main character energy fr fr β­πŸ‘‘

go read the other pages, ily, bye πŸ’œπŸŽ€

πŸ“¦ where this page comes from