security_read_state_kernel(9)
π security_read_state_kernel(9)
okay so this is a page from the Kernel API Manual β yes, the security_read_state_kernel one, we're doing this, grab a snack π
β¨ NAME β¨
security_read_state_kernel β bestie, it reads the policy. that's the whole vibe. π
π¦ SYNOPSIS π¦
int security_read_state_kernel (void **data , size_t *len );
π ARGUMENTS π
dataβ the binary policy data itself, dropped in here π«Άlenβ how long that data is, in bytes. numbers only, no vibes.
π DESCRIPTION π
So what it does is: it allocates kernel memory for reading SELinux policy. iconic behavior, honestly.
But listen β this one is for internal use only. it is not the function you use to hand data back to user space. do not do that. i'm serious. π
β οΈ also, and this is the important part: this function must be called with policy_mutex held. like, not optional, not "eh it'll probably be fine". hold the mutex. periodt. π
πΈ SEE ALSO πΈ
the kernel file lives at ./security/selinux/ss/services.c and here's the whole friend group, all of them, no cap:
security_compute_av(9)security_sid_to_context(9)security_sid_to_context_inval(9)security_context_to_sid(9)security_context_to_sid_default(9)security_transition_sid(9)security_member_sid(9)security_change_sid(9)services_convert_context(9)security_load_policy(9)ocontext_to_sid(9)security_port_sid(9)security_ib_pkey_sid(9)security_ib_endport_sid(9)security_netif_sid(9)security_node_sid(9)__security_genfs_sid(9)security_genfs_sid(9)security_fs_use(9)security_net_peersid_resolve(9)security_policycap_supported(9)security_netlbl_cache_add(9)security_netlbl_secattr_to_sid(9)security_netlbl_sid_to_secattr(9)__security_read_policy(9)security_read_policy(9)
π sign-off π
this lil masterpiece comes from ./security/selinux/ss, dated October 2026, and it's filed under security_read_state_kernel(9). slay, go hold that mutex πβ¨
π¦ 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