security_transition_sid(9)
π
security_transition_sid(9) β like, the Kernel API Manual era π
okay so bestie, welcome to the glow-up era of SELinux SID math β¨ this one lives in the Kernel API Manual and it's honestly so iconic of it.
πΈ NAME πΈ
security_transition_sid β compute the SID for a new subject/object, no cap π
β¨ SYNOPSIS β¨
int security_transition_sid (u32 ssid , u32 tsid , u16 tclass , const
struct qstr *qstr , u32 *out_sid );
like, five args, all vibes, we love to see it π«Ά
π ARGUMENTS π
ssidβ the source security identifier π (where we're coming from, bestie)tsidβ the target security identifier β¨ (where we're going)tclassβ the target security class π― (the category of the whole situation)qstrβ object name πΈ (yes, the actual name-name)out_sidβ security identifier for the new subject/object π (this is where the answer goes, it's giving output parameter energy)
π¦ DESCRIPTION π¦
So here's the tea π: security_transition_sid computes a SID to use for labeling a new subject or object in the class tclass, based on a SID pair β (ssid, tsid). That's it, that's the whole job, and it does it flawlessly.
Return values, and pay attention because this is the part people miss π:
- returns
-EINVALif any of the parameters are invalid π - returns
-ENOMEMif insufficient memory is available π (no memory, no SID, that's the rule) - returns
0if the new SID was computed successfully β slay
fr fr: check your return value. 0 is the win, the negatives are the not-wins, and you literally cannot tell which without looking. main character error handling only π
π SEE ALSO π
Kernel file ./security/selinux/ss/services.c β that's the source file, go read it if you want the real lore π
and the whole friend group of related calls, all in (9) section, all iconic in their own way π:
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_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)security_read_state_kernel(9)
π« okay that's the whole page, ty for coming to my TED talk π«
<cute sign-off>mwah π this masterpiece comes from ./security/selinux/ss, dated October 2026 β cover the security_transition_sid(9) page in your journal and stan π</cute sign-off>
π¦ 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