selinux_netlbl_sock_genattr(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ selinux_netlbl_sock_genattr ✨ (kernel API manual, section 9, bestie edition)

okay so picture this: you're deep in the kernel, section 9 of the manual, and you need a NetLabel socket secattr generated. That's the whole gig. Welcome to selinux_netlbl_sock_genattr πŸ’…


πŸŽ€ NAME πŸŽ€

selinux_netlbl_sock_genattr β€” generate the NetLabel socket secattr. That's it, that's the function, she's literally the secattr factory 🏭✨


🌸 SYNOPSIS 🌸

struct netlbl_lsm_secattr * selinux_netlbl_sock_genattr (struct sock *sk
);

one function, one argument, returns a pointer to a struct netlbl_lsm_secattr β€” no cap 🫢


πŸ¦‹ ARGUMENTS πŸ¦‹

  • sk β€” the socket. just… the socket. the whole vibe of this arg is "give me the socket" and honestly? iconic of her πŸ’–

πŸ”₯ DESCRIPTION πŸ”₯

So what does she actually do? She generates the NetLabel security attributes for a socket, and the way that she does it is by making full use of the socket's attribute cache β€” like, she's not out here doing extra work for no reason, she's checking the cache first, main character efficiency ✨

And then β€” returns a pointer to the security attributes on success πŸŽ‰ or an ERR_PTR on failure 😭 that's the whole contract, fr fr. Check that pointer, bestie, don't just raw-dog the dereference πŸ™ˆ


πŸ‘‘ SEE ALSO πŸ‘‘

Kernel file ./security/selinux/netlabel.c β€” that's where she lives, go say hi 🏠

and her whole friend group, the netlabel girlies:

like I said. whole friend group. go read all of them, iykyk πŸ’œ


lowkey important: on success you get a pointer to the security attributes, on failure you get an ERR_PTR β€” that's not a NULL, bestie, so handle it properly or the kernel will simply end you πŸ’€

🌸 and that's the page!! brought to you by ./security/selinux, dated October 2026, signed off in the footer as selinux_netlbl_sock_genattr(9) β€” mwah, go touch some sockets πŸ§šπŸ’–πŸŽ€

πŸ“¦ where this page comes from