selinux_netlbl_sock_genattr(9)
β¨ 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:
selinux_netlbl_sidlookup_cached(9)selinux_netlbl_sock_getattr(9)selinux_netlbl_cache_invalidate(9)selinux_netlbl_err(9)selinux_netlbl_sk_security_free(9)selinux_netlbl_sk_security_reset(9)selinux_netlbl_skbuff_getsid(9)selinux_netlbl_skbuff_setsid(9)selinux_netlbl_sctp_assoc_request(9)selinux_netlbl_inet_conn_request(9)selinux_netlbl_inet_csk_clone(9)selinux_netlbl_sctp_sk_clone(9)selinux_netlbl_socket_post_create(9)selinux_netlbl_sock_rcv_skb(9)selinux_netlbl_option(9)selinux_netlbl_socket_setsockopt(9)selinux_netlbl_socket_connect_helper(9)selinux_netlbl_socket_connect_locked(9)selinux_netlbl_socket_connect(9)
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
- 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