Skip to content

aureport: fix AVC result column always showing "unset" - #546

Open
Cropi wants to merge 1 commit into
linux-audit:masterfrom
Cropi:fix-avc-result-unset
Open

aureport: fix AVC result column always showing "unset"#546
Cropi wants to merge 1 commit into
linux-audit:masterfrom
Cropi:fix-avc-result-unset

Conversation

@Cropi

@Cropi Cropi commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

When running aureport -a without a --success or --failed filter,
the result column in the AVC report always shows "unset" instead of
"denied" or "granted", even though the raw audit record clearly contains
the verdict.

Root cause

In parse_avc(), two unrelated things were done inside one guard:

if (event_success != S_UNSET && s->success == S_UNSET) {
    an.avc_result = AVC_DENIED / AVC_GRANTED;
    s->success    = S_FAILED  / S_SUCCESS;
}

The guard exists to protect s->success: only copy the AVC verdict
into the event's success field when the user is actively filtering by
success/failure, and only if it hasn't been set by a SYSCALL record yet
(syscall result is authoritative).

The problem is that an.avc_result — the field aureport prints in the
result column — was also trapped inside that guard. Without a filter,
event_success == S_UNSET, so the whole block was skipped and
an.avc_result stayed at its initial value of AVC_UNSET.
aulookup_result(AVC_UNSET) returns the string "unset".

Fix

Separate the two concerns. Always read the verdict from the record into
an.avc_result. Keep the guard only around the s->success assignment.

In parse_avc(), two unrelated concerns were bundled under one guard:

  if (event_success != S_UNSET && s->success == S_UNSET) {
      an.avc_result = AVC_DENIED / AVC_GRANTED;   /* concern 1 */
      s->success   = S_FAILED  / S_SUCCESS;        /* concern 2 */
  }

The guard was correct for concern 2: only propagate the AVC verdict to
s->success when the caller is filtering by success/failure and s->success
hasn't been set yet (syscall pass/fail is authoritative).

However, it also gated concern 1: populating an.avc_result, which is the
field aureport -a prints in the "result" column. Without --success or
--failed on the command line, event_success == S_UNSET, so the block was
skipped entirely and an.avc_result stayed at its initial AVC_UNSET value.
aulookup_result(AVC_UNSET) returns "unset", making the result column
always show "unset" regardless of what the AVC record actually says.

Fix: unconditionally extract the verdict from the record into an.avc_result,
and move the event_success guard to cover only the s->success assignment.

Signed-off-by: Cropi <alakatos@redhat.com>
@stevegrubb

Copy link
Copy Markdown
Contributor

I'm not seeing the problem. All of mine say denied. Is this only on allows? IOW, how do you reproduce this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants