fscrypt_has...tted_context(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… fscrypt_has_permitted_context(9) πŸ’…

okay bestie, this one's from the Kernel API Manual and it's lowkey one of the most important vibe checks in the whole fscrypt saga. like, it's literally the bouncer at the club door of encrypted directories. let's get into it 🫢


✨ NAME ✨

fscrypt_has_permitted_context β€” is a file's encryption policy permitted within its directory? 🧐

like... can this file actually sit with this directory, or is it giving "not on the guest list" energy?


🌸 SYNOPSIS 🌸

int fscrypt_has_permitted_context (struct inode *parent , struct inode *child );

that's it, that's the whole thing. two inodes walk into a function... πŸ’€


πŸŽ€ ARGUMENTS πŸŽ€

  • parent β€” inode for parent directory. like the mom of the situation, the one who decides who's allowed in. πŸ‘‘
  • child β€” inode for file being looked up, opened, or linked into parent. the one showing up at the door like "hi i'm here 😭" πŸ₯Ί

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so listen up, filesystems, because this is a must:

Filesystems must call this before permitting access to an inode in a situation where the parent directory is encrypted β€” either before allowing ->lookup to succeed, or for a regular file before allowing it to be opened β€” and before any operation that involves linking an inode into an encrypted directory, including link, rename, and cross rename. πŸ‘πŸ‘πŸ‘

the way that this works is it enforces the constraint that within a given encrypted directory tree, all files use the same encryption policy. everyone matching, everyone on brand, no chaos. πŸ’–

The pre-access check is needed to detect potentially malicious offline violations of this constraint, while the link and rename checks are needed to prevent online violations of this constraint.

🚨 bestie this is the important part: offline violations = sketchy malicious stuff happening when nobody's looking. online violations = people trying to sneak links/renames past you in real time. both are handled. no cap. πŸ”₯

⭐ RETURN ⭐

  • 1 if permitted πŸ’š (slay, come on in)
  • 0 if forbidden ❌ (sorry bestie, not today)

🌈 SEE ALSO 🌈

shoutout to the whole squad, all living in Kernel file ./fs/crypto/policy.c:


and that's the whole page, periodt πŸŽ€ this lil icon lives over at ./fs/crypto, dated October 2026, and its name is fscrypt_has...tted_context(9) β€” the truncated lil guy, iykyk πŸ˜­πŸ’œ mwah, go call your filesystem, bestie πŸ’…βœ¨

πŸ“¦ where this page comes from