lsm: use attr/apparmor/current to get apparmor label

On some kernels, attr/current can be intercepted by BPF LSM, causing
errors (#2033). Using attr/apparmor/current is preferable, because it
is guaranteed to return the apparmor label. attr/current will still be
used as a fallback for older kernels.

Fixes: #2033

Signed-off-by: Filip Hejsek <filip.hejsek@gmail.com>
This commit is contained in:
Filip Hejsek 2025-09-13 19:49:24 +02:00 committed by Andrei Vagin
parent 80c280610e
commit a8c5e11715

View file

@ -29,7 +29,9 @@ static int apparmor_get_label(pid_t pid, char **profile_name)
FILE *f;
char *space;
f = fopen_proc(pid, "attr/current");
f = fopen_proc(pid, "attr/apparmor/current");
if (!f)
f = fopen_proc(pid, "attr/current");
if (!f)
return -1;