aa_path_link(9)
π aa_path_link(9) β from the Kernel API Manual, bestie
Okay so this page is aa_path_link(9) and it lives in the Kernel API Manual, and honestly? It's lowkey iconic. Let's get into it. π¦
β¨ NAME β¨
aa_path_link β the one that handles the hard link permission check. That's it, that's the whole vibe. π
πΈ SYNOPSIS πΈ
int aa_path_link (const struct cred *subj_cred , struct aa_label *label
, struct dentry *old_dentry , const struct path *new_dir , struct dentry
*new_dentry );
That's the whole signature, character for character β don't come for me, I copied it exactly. π
π«Ά ARGUMENTS π«Ά
Bestie, here's who's who in this function's little friend group:
subj_credβ the subject cred. Like, the credentials of whoever's doing the thing. π³labelβ the label being enforced. This one isNOT NULL, no exceptions, so don't even try it. πold_dentryβ the target dentry. AlsoNOT NULL. The thing being pointed at. π―new_dirβ the directory the new link will be created in.NOT NULLagain, the girlies love a constraint. πnew_dentryβ the link being created. And yes βNOT NULL. π
π₯ DESCRIPTION π₯
So what she actually does: she handles the permission test for a link & target pair. That's the whole assignment. π
Permission is encoded as a pair. The way it works is: the link permission is determined first, and then β only if that's allowed β the target gets tested. No skipping ahead, no cutting the line. β¨
And here's the spicy bit that makes her different: the target test is done from the point of the link match (not the start of the DFA). Which means the target permission is literally dependent on the link permission match. It's giving main-character link permission, honestly. π
There's also the subset test, if it's required β that one forces the permissions granted on the link to be a subset of the permissions granted to the target. Like, the link can't have more than the target. Periodt. π
β RETURN β
0 if it's allowed β slay, we love a zero. Otherwise? An error. π
π§ SEE ALSO π§
Go read these next, iykyk β all from the kernel file ./security/apparmor/file.c: file_audit_cb(9), aa_audit_file(9), aa_lookup_condperms(9), aa_str_perms(9), aa_path_perm(9), xindex_is_subset(9), aa_file_perm(9). π
ngl, if you skipped the "NOT NULL" notes, go back β they were there for a reason. π«Ά
Okay that's the whole page!! Coming to you from ./security/apparmor, dated October 2026 β mwah, hope this helped bestie, go be iconic with your hard links π
πβ¨
π¦ 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