apparmor_sock_graft(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… apparmor_sock_graft β€” a kernel API manual, bestie edition πŸŽ€

okay so real talk, this is section 9 of the Kernel API Manual (apparmor_sock_graft(9), if you're keeping track, which you are, because you're iconic like that ✨). It's a tiny little function with a big job, and we're gonna get into it.


✨ NAME ✨

apparmor_sock_graft β€” initializes a newly created socket 🌱

like, fresh-out-the-box socket energy. brand new. no cap. 🫢


🌸 SYNOPSIS 🌸

void apparmor_sock_graft (struct sock *sk , struct socket *parent );

that's it. that's the whole signature. short, sweet, returns void β€” so it does stuff, it just doesn't gossip about it back to you πŸ’…


πŸ¦‹ ARGUMENTS πŸ¦‹

  • sk β€” the child sock πŸ‘Ά the new baby, the main character of this operation ngl
  • parent β€” the parent socket πŸ‘‘ the one that brought the child sock into this world, and whose context might come up later (see the note, bestie πŸ‘€)

πŸŽ€ NOTE πŸŽ€

okay so this is the part where I hold your hand, because there's lore here 🫢

could set off of SOCK_CTX(parent) but need to track inode and we can just set sk security information off of current creating process label β€” so it could be based on SOCK_CTX(parent), but there's this whole inode-tracking situation, and honestly we can just set the sk security information off of the current creating process's label. simple. done. slay. ✨

Labeling of sk for the accept case β€” probably should be sock based instead of task, because of the case where an implicitly labeled socket is shared by different tasks. 🫠 like, imagine one implicitly labeled socket being passed between different tasks β€” yeah, that's exactly why the accept case probably wants to be sock based instead of task based. it's giving "we know, it's on the list" energy fr fr.

no behaviour changes are being promised here, bestie β€” these are design notes from the source, not me inventing anything πŸ™ˆ

🌈 SEE ALSO 🌈

the whole friend group πŸ’œ β€” Kernel file ./security/apparmor/lsm.c plus all of these:

go read them. all of them. it's a whole vibe πŸ‘‘πŸ”₯


and that's the page!! source is ./security/apparmor, dated October 2026 β€” that's the version and the date, mwah πŸ’‹ hope this helped bestie, go forth and graft those socks πŸ§šπŸ’–

πŸ“¦ where this page comes from