aa_splitcon(3)
π NAME π
okay so this is the aa_splitcon(3) page from AppArmor β yes, the manual page, bestie. aa_splitcon does exactly one iconic thing: it splits the confinement context into a label and mode. that's the whole gig. π
β¨ SYNOPSIS β¨
#include <sys/apparmor.h>
char *aa_splitcon(char *con, char **mode);
Link with -lapparmor when compiling. yes, literally that flag π«Ά
π¦ DESCRIPTION π¦
aa_splitcon() splits a confinement context into separate label and mode strings. The @con string gets modified so that the label portion is NUL terminated. The enforcement mode is also NUL terminated, and the parenthesis surrounding the mode are removed. If @mode is non-NULL, then on success it will point to the first character in the enforcement mode string. slay. β¨
Also, highkey important kernel detail: the Linux kernel's /proc/<PID>/attr/current interface appends a trailing newline character to AppArmor contexts that are read from that file. If @con contains a single trailing newline character, aa_splitcon() strips it prior to all other processing. one newline, bestie, not a whole collection π
πΈ RETURN VALUE πΈ
Returns a pointer to the first character in the label string. NULL is returned on error. no cap. π
π EXAMPLE π
Here's the exact vibe check from the page:
Context Label Mode
----------------------------- ------------------ -------
unconfined unconfined NULL
unconfined\n unconfined NULL
/bin/ping (enforce) /bin/ping enforce
/bin/ping (enforce)\n /bin/ping enforce
/usr/sbin/rsyslogd (complain) /usr/sbin/rsyslogd complain
π BUGS π
None known. If you find any, please report them at https://gitlab.com/apparmor/apparmor/-/issues. fr fr, that's the place. π
π SEE ALSO π
Go peek at aa_getcon(2) and https://wiki.apparmor.net. iykyk π¦
okay bye bestie β this page was brought to you by AppArmor 4.1.8, dated 2026-10-18. mwah π
π¦ where this page comes from
- arch rolling: apparmor 4.1.8-2 Β· GPL-2.0-only AND LGPL-2.0-only AND LGPL-2.1-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms