security_change_sid(9)
π security_change_sid β like, the Kernel API Manual energy, bestie (section 9) β¨
Okay so this is a page straight out of the Kernel API Manual, section 9, and it's all about one lil function that does one very specific glow-up job: computing a SID for relabeling an object. That's it. That's the whole vibe. Let's get into it π«Ά
β¨ NAME β¨
security_change_sid β compute the SID for object relabeling π
Like, it literally computes a SID so you can relabel an object. Iconic, lowkey essential, no cap.
π¦ SYNOPSIS π¦
int security_change_sid (u32 ssid , u32 tsid , u16 tclass , u32 *out_sid
);
That's the whole signature, copied exactly, don't come for me about the spacing π
π ARGUMENTS π
ssidβ the source security identifier. Like, where we're coming from, bestie.tsidβ the target security identifier. Where we're headed. Main character destination energy.tclassβ the target security class. Gotta know what kind of object we're talking about.out_sidβ the security identifier for the selected member. This is where the answer lands, so keep it safe π
πΈ DESCRIPTION πΈ
So here's the tea: security_change_sid computes a SID to use for relabeling an object of class tclass, and it does that based on a SID pair β (ssid, tsid). Cute, right? Pair 'em up and get your relabel SID β¨
And the return values? Let's do a vibe check:
- Returns
-EINVALif any of the parameters are invalid β so, bad input, bestie, it's giving "try again". - Returns
-ENOMEMif insufficient memory is available β literally not enough memory to go around π - Returns
0if the SID was computed successfully β slay! That's the win condition. Ate. π
So yeah, check your params, make sure there's memory, and then you get that sweet, sweet 0. Periodt.
π₯ SEE ALSO π₯
Okay this list is long long, so buckle up. But every single one of these is here for a reason and I'm not skipping a single one, iykyk:
- Kernel file
./security/selinux/ss/services.c 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)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)
Obsessed with this friend group tbh π
And that's the whole page, bestie π Quick cute sign-off: this one comes from ./security/selinux/ss, dated October 2026, and yeah β it's security_change_sid(9) all the way down. π§ββοΈβ¨
π¦ 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