On 12/4/18 11:38 AM, Stephen Smalley wrote:
On 12/4/18 11:03 AM, BMK wrote:
Hello,
I am currently struggling with a strange SELinux problem,
for which I am not able to find an answer by reading the documentation
and researching online.
The problem is, that some AVC denial log entries seem to get lost in
permissive mode,
in other words, they are not logged...
I've already deactivated all dont audit rules and I know for sure that
the denial actually occurs, because I can trace it via strace...
Although I can't see a corresponding entry in the audit.log.
By the way, in enforcing mode I can see suddenly the missing denial
entry...
If the permissive mode lacks/drops some denials which we can only see
in enforcing mode,
then this would be truly terrible for the policy writers...
Otherwise I am out of ideas, what other things could cause the loss of
SELinux denials...
I hope you can point me to right direction with this matter and
I thank you in advance for your help.
Permissive mode only logs the first instance of a denial by design to
avoid flooding the logs with repeated instances of the same denial. So
if you triggered the denial a while ago and repeat the operation, you
might not see the denial again. To be precise, in permissive mode, upon
the first denial of a permission, the permission is audited and then
added to the AVC entry so that subsequent denials using that cache entry
won't keep producing a denial. You can flush the cache to force denials
to re-appear by reloading policy (load_policy) or by switching back and
forth between permissive and enforcing mode (setenforce 1 && setenforce 0).
NB Any semodule operation will also trigger a policy reload (unless you
specify -n or are acting on a policy other than the active one), so
semodule -DB would also have flushed the cache for you when it removed
all dontaudit rules.
If that doesn't explain the behavior you are seeing, then we can't
really help without more information about the problem, e.g. the denial
message you say is visible in enforcing mode but not permissive mode,
your kernel version, possibly the strace output, a reproducer if you
have one, what distro / policy you are using, etc.
There are cases where the audit system could drop records due to OOM
conditions, its ratelimit, or its backlog limit. In those cases, you
should have a audit: message logged indicating that messages were lost.
Check your dmesg or journalctl logs for such messages from the audit
system. Those are audit system issues rather than SELinux. You can
configure the limits via auditctl and/or the audit configuration. But
generally those only apply when the audit system is under heavy load
from many denials (or many other audit messages) and you should see at
least some of them.