Page MenuHomeFreeBSD

audit: move the wait from the queue length from the commit to alloc
ClosedPublic

Authored by kib on Jun 16 2025, 4:07 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Oct 8, 2:32 PM
Unknown Object (File)
Tue, Sep 23, 3:06 PM
Unknown Object (File)
Sat, Sep 13, 6:05 AM
Unknown Object (File)
Sep 3 2025, 12:16 AM
Unknown Object (File)
Aug 3 2025, 3:21 PM
Unknown Object (File)
Aug 2 2025, 8:26 PM
Unknown Object (File)
Jul 31 2025, 5:02 AM
Unknown Object (File)
Jul 29 2025, 5:04 AM
Subscribers

Details

Summary
AUDIT_SYSCALL_EXIT() and indirectly audit_commit() is intended to be
called from arbitrary top-level context.  This means that any sleepable
locks can be owned by the caller, and which makes the sleeping in
audit_commit() forbidden.

Since we need to sleep for the record in audit_alloc() anyway, move the
sleep for the queue limit there.  At worst, if the audit is suspended is
disabled when we actually reach the commit location, this means that we
lost time uselessly.

PR:     287566

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kib requested review of this revision.Jun 16 2025, 4:07 PM
sys/security/audit/audit.c
443

Shouldn't this come before the increment of audit_pre_q_len? Otherwise there is some theoretical risk of deadlock if audit_qctrl.aq_hiwater threads enter this sleep.

sys/security/audit/audit.c
443

I am not sure why. Note that we still check for audit_q_len, not audit_pre_q_len against high watermark. audit_q_len should eventually go down while audit records are processed.

Also it is really not different from the current watermark organization, I only moved the wait place earlier, still before audit_q_len increment.

markj added inline comments.
sys/security/audit/audit.c
443

Ok, I see now.

I might also move the allocation of ar to the end of the function.

This revision is now accepted and ready to land.Jun 16 2025, 4:33 PM
This revision now requires review to proceed.Jun 16 2025, 5:01 PM
This revision is now accepted and ready to land.Jun 16 2025, 5:17 PM