SEPOL_CHECK_CONTEXT(3)
π sepol_check_context β the vibe check for security contexts π
okay bestie, welcome to the SE Linux binary policy API documentation, section 3 of the manual (yes, that's the sepol_...context(3) girlies π«Ά). pull up a chair, grab a strawberry, and let's talk about checking whether your security context is actually valid. πβ¨
β¨ NAME β¨
sepol_check_context β checking the validity of a security context against a binary policy, fr fr. π
πΈ SYNOPSIS πΈ
#include <sepol/sepol.h>
int sepol_check_context(const char *context);
int sepol_set_policydb_from_file(FILE *fp);
two functions, one header, zero drama. iconic. π
π¦ DESCRIPTION π¦
so sepol_check_context does exactly what it says on the tin: it checks the validity of a security context against a binary policy. and like, not any policy β specifically one that was previously loaded from a file via sepol_set_policydb_from_file. no cap, that's the whole setup. π
who's using this?? bestie, it's what setfiles -c uses to validate a file contexts configuration against the binary policy when you do policy builds. that's its moment. its main character era. π
β οΈ okay important psa: if you're trying to validate a context against the active policy on a SELinux system, this is not the function you want. go usesecurity_check_contextfromlibselinuxinstead. iykyk. π
β RETURN VALUE β
- returns
0on success π₯³ - returns
-1witherrnoset otherwise π
that's it. that's the whole vibe check.
π sign-off π
this little baddie was brought to you by stephen.smalley.work@gmail.com, dated 15 March 2005 β old enough to be a whole legend, still serving. periodt. π§β¨
π¦ where this page comes from
- alpine 3.24: libsepol-doc 3.10-r0 Β· LGPL-2.0-or-later
- centos-stream 10: libsepol-devel 3.11-2.el10 Β· LGPL-2.1-or-later
- centos-stream 9: libsepol-devel 3.6-3.el9 Β· LGPLv2+
- centos-stream 9: libsepol-devel 3.6-3.el9 Β· LGPLv2+
- debian trixie: libsepol-dev 3.8.1-1 Β· LGPL-2.1-or-later
- fedora 43: libsepol-devel 3.9-2.fc43 Β· LGPL-2.1-or-later
- fedora 43: libsepol-devel 3.9-2.fc43 Β· LGPL-2.1-or-later
- fedora 44: libsepol-devel 3.10-1.fc44 Β· LGPL-2.1-or-later
- fedora 44: libsepol-devel 3.10-1.fc44 Β· LGPL-2.1-or-later
- fedora 44: libsepol-devel 3.11-1.fc44 Β· LGPL-2.1-or-later
- fedora 44: libsepol-devel 3.11-1.fc44 Β· LGPL-2.1-or-later
- nixpkgs unstable: libsepol 3.11
- opensuse-leap 16.0: libsepol-devel 3.8.1-160000.2.2 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: libsepol-devel 3.8.1-160000.2.2 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: libsepol-devel 3.8.1-160000.2.2 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: libsepol-devel 3.8.1-160000.2.2 Β· LGPL-2.1-or-later
- ubuntu questing: libsepol-dev 3.8.1-1
- ubuntu resolute: libsepol-dev 3.9-2 Β· LGPL-2.1-or-later
- ubuntu stonking: libsepol-dev 3.11-1 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms