Skip to contentSkip to conversation

perf and cap_syslog

DISCUSSION Dominick Grift 2 participants 2 messages Dec 5, 2019 SELinux security module

lore
Share & tools
lore
#0 lore raw

I am also trying out the new perf_event access vectors. I use the perf util for this.

Whilst I wwas confining perf at some point there were no avc denials anymore but perf was segfaulting in enforcing mode. After some brute force it turns out that it wanted access to cap_syslog.

My question: why was it not logging the capability2 syslog event? Could this be due to an access vectors ordering issue?

Signature · 3 lines
Key fingerprint = 5F4D 3CDB D3F8 3652 FBD8 02D5 3B6C 5F1D 2C7B 6B02
https://sks-keyservers.net/pks/lookup?op=get&search=0x3B6C5F1D2C7B6B02
Dominick Grift
#1 lore raw
Quoted 7 lines · Dominick Grift

I am also trying out the new perf_event access vectors. I use the perf util for this.

Whilst I wwas confining perf at some point there were no avc denials anymore but perf was segfaulting in enforcing mode. After some brute force it turns out that it wanted access to cap_syslog.

My question: why was it not logging the capability2 syslog event? Could this be due to an access vectors ordering issue?

Sometimes capability checks are not audited by the kernel because a denial is not fatal to the operation; it just causes the kernel to fall back to an unprivileged code path or provide a hashed or NULL value for sensitive data. Offhand, I'd guess you are hitting one of these two checks:
./kernel/kallsyms.c: if (has_capability_noaudit(current, CAP_SYSLOG))
./lib/vsprintf.c: if (!has_capability_noaudit(current, CAP_SYSLOG) ||

In these cases, you'll end up with NULL pointer values to avoid leaking kernel pointers to userspace, and perf apparently doesn't bother checking before dereferencing them.