From: Stanislav Kinsburskii <skinsburskii@gmail.com>
To: Shuah Khan <shuah@kernel.org>, Paul Moore <paul@paul-moore.com>,
Eric Paris <eparis@redhat.com>,
Al Viro <viro@zeniv.linux.org.uk>,
Amy Griffis <amy.griffis@hp.com>
Cc: Stanislav Kinsburskii <skinsburskii@gmail.com>,
Frank Hofmann <hofmann@deshaw.com>,
Noah Orlando <orlandon@deshaw.com>,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
audit@vger.kernel.org
Subject: [PATCH 0/3] audit: Measure and reduce syscall filtering overhead
Date: Thu, 06 Aug 2026 18:01:18 -0700 [thread overview]
Message-ID: <20260806-audit-v1-0-ddd0d94ff0b6@gmail.com> (raw)
This series adds a repeatable microbenchmark for audit's fixed syscall
overhead and uses it to address two cases where audit continues doing work
which cannot produce a record.
Patch 1 adds audit_bench, a manually run getpid(2) microbenchmark under
tools/testing/selftests/audit. It leaves policy management to the caller
so the same workload can measure different rule configurations without
silently changing the system policy.
Patch 2 fixes audit_n_rules and audit_signals accounting when rules are
removed automatically with a watch or tree, or after an LSM rule update
fails. These paths could leave the counters nonzero after the last
applicable rule had disappeared, causing every subsequent syscall to
allocate a non-dummy audit context. It also centralizes rule accounting
so all rule removal paths share the same bookkeeping.
The median getpid latency in the same unpinned VM was:
no rules stale state fixed
automatically removed watch 38 ns 55 ns 38 ns
automatically removed tree 38 ns 59 ns 38 ns
Patch 3 builds on those lifecycle helpers. It maintains an aggregate mask
of the syscall numbers present in exit rules and checks that mask before
walking the exit filter list. The mask is architecture-independent and
therefore conservative: overlapping syscall numbers may cause an
unnecessary scan, but cannot suppress a match.
For an unrelated getpid workload, the median latency scaled as follows:
exit rules 1 32 128 256
before 55 ns 71 ns 428 ns 791 ns
after 55 ns 55 ns 55 ns 55 ns
The aggregate mask is updated through the centralized accounting helpers.
Insertion sets the relevant bits before publishing the rule with
list_add_rcu(); removal unlinks the rule before clearing them. This keeps
the lockless rejection test conservative during concurrent rule changes.
The series does not change the audit userspace ABI or rule matching
semantics. The benchmark and complete reproduction procedures are
documented in the individual patches.
---
Stanislav Kinsburskii (3):
selftests/audit: Add syscall overhead benchmark
audit: Fix filter rule accounting after automatic removal
audit: Skip exit filtering for syscalls without rules
MAINTAINERS | 1 +
kernel/audit.h | 7 +
kernel/audit_tree.c | 1 +
kernel/audit_watch.c | 2 +
kernel/auditfilter.c | 140 +++++++++++------
kernel/auditsc.c | 13 ++
tools/testing/selftests/Makefile | 1 +
tools/testing/selftests/audit/.gitignore | 2 +
tools/testing/selftests/audit/Makefile | 9 ++
tools/testing/selftests/audit/README | 30 ++++
tools/testing/selftests/audit/audit_bench.c | 227 ++++++++++++++++++++++++++++
11 files changed, 389 insertions(+), 44 deletions(-)
---
base-commit: ea2bff00da89d7767d677bb68470130ba96f4928
change-id: 20260806-audit-96a1e71d38b1
Best regards,
--
Stanislav Kinsburskii <skinsburskii@gmail.com>
next reply other threads:[~2026-08-07 1:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-07 1:01 Stanislav Kinsburskii [this message]
2026-08-07 1:01 ` [PATCH 1/3] selftests/audit: Add syscall overhead benchmark Stanislav Kinsburskii
2026-08-07 1:01 ` [PATCH 2/3] audit: Fix filter rule accounting after automatic removal Stanislav Kinsburskii
2026-08-07 1:01 ` [PATCH 3/3] audit: Skip exit filtering for syscalls without rules Stanislav Kinsburskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260806-audit-v1-0-ddd0d94ff0b6@gmail.com \
--to=skinsburskii@gmail.com \
--cc=amy.griffis@hp.com \
--cc=audit@vger.kernel.org \
--cc=eparis@redhat.com \
--cc=hofmann@deshaw.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=orlandon@deshaw.com \
--cc=paul@paul-moore.com \
--cc=shuah@kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox