From nobody Tue Jun 16 01:00:51 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4gfTFJ15zxz6gGMM for ; Tue, 16 Jun 2026 01:00:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gfTFJ04gqz440d for ; Tue, 16 Jun 2026 01:00:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1781571652; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=JXZHdcfS7XwjAdOahcSGsd30WLDSa8TGIkl7SImBwSs=; b=bx8MJASo88A57VeKV8rj5KAhrKG/C6hmAazn7/7tdn33W1BlutuXqFw1H1obvAAl8DDk6i uW2nyRy2XfIHQr121d8jmt2kSENQSzHytaYJ6IjelYoUU9VRS7F9gdCshQy1WtWu+eCZOD 3WaHPaS0tfbbkT7+0euV+NGhAUcsoTjpwSZGY4o81j5y/4QR8pHZW9xLEl3lzKywUJsQDy u40FEUZY8HkTD/ZW7aecna9sAvUybZmZKkGeI/q97OQEvSJa+6s0zCj7Vvaz+C3/LzoJri JNPy6uh46UkEs8BvCE+LzmnCR9SugCauVJQu5B+FyJcA5w5a3Biw7u84DX+vsg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1781571652; a=rsa-sha256; cv=none; b=uFXJvWutAKKBbDKQzy9JWIp7yoKZSXno+dz7dj7j68xK5K9v/mgACIM8iO0rcQAU4mIVZc aMNNmi3wCqttYGINs4hwgZPB6PO2Ag6PTpESsFjxNMFw2HUvq7egvTUZ4MNEUmvXZsvMHN Vhn6JQyxfcyKMq5u9ZSzqtkf1F4O2A4lN74lxkZT0j0b0NVqT6aflgCg8NnRa0cVDjYFfh m69FCEKLzLoRnOZDo/3Hee09Oi+p9ohS3+XBukBUUUwrsdPcHascr4H/yEVoHn6IZJQ2XB HNoXwaQC4AtRDIWSn9F7430vjGRvDkiUnvq3iT7QnOoIp0q9Pu3O2QQCj88lVw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1781571652; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=JXZHdcfS7XwjAdOahcSGsd30WLDSa8TGIkl7SImBwSs=; b=kZVcLBCcohV9cIOuVwphjsE2svqHefYXZGxBOofM+1iyHTy7J4ieTjWV+5CnQyIccyUtJG F6Y4lb6bTL1YLJSxbmUSzGaxgK4Drx7D8rLUXm3DkiG1wIu0iMFrX4WeUWQVHDVkNPl1H4 +mKY/8nni6sknxH5AjP63F4+h7yvttGo5INENydi/ocjji1OlaWCmAzVM2mlBf6uVA0Wg1 VrCvvOATE9nWAU8GPBKXgCpRWu+GnFYDzmCzPSz7SA0Xfi94467eimrmHXSl12O79bk6NI s4yuSIQomAbEuXpk4Rm/gznzceH6GEYT4SOFS9HMDHt2/9bH96kRuAXmqKr1bw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gfTFH6VpYz1JJ6 for ; Tue, 16 Jun 2026 01:00:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 23c7a by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 16 Jun 2026 01:00:51 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav Subject: git: 9cc0ff7c25d4 - stable/15 - audit: Add poll / select support List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: 9cc0ff7c25d40ba2e87ae8cd66576aa51a9aff2a Auto-Submitted: auto-generated Date: Tue, 16 Jun 2026 01:00:51 +0000 Message-Id: <6a30a043.23c7a.7026385a@gitrepo.freebsd.org> The branch stable/15 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=9cc0ff7c25d40ba2e87ae8cd66576aa51a9aff2a commit 9cc0ff7c25d40ba2e87ae8cd66576aa51a9aff2a Author: Dag-Erling Smørgrav AuthorDate: 2026-06-05 21:50:38 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-06-16 01:00:11 +0000 audit: Add poll / select support It was previously not possible to poll() or select() on the trigger device, which made implementing proper signal handling in auditd difficult. MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: kevans, markj Differential Revision: https://reviews.freebsd.org/D57457 (cherry picked from commit 0620c99d278b6a2fd6fe995f5bb365158e04ad7c) --- sys/security/audit/audit_trigger.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/sys/security/audit/audit_trigger.c b/sys/security/audit/audit_trigger.c index 482f7c56a2ef..e2520292cc5d 100644 --- a/sys/security/audit/audit_trigger.c +++ b/sys/security/audit/audit_trigger.c @@ -32,8 +32,10 @@ #include #include #include +#include #include #include +#include #include #include @@ -45,8 +47,6 @@ * used to communicate with userland. /dev/audit reliably delivers one-byte * messages to a listening application (or discards them if there is no * listening application). - * - * Currently, select/poll are not supported on the trigger device. */ struct trigger_info { unsigned int trigger; @@ -58,6 +58,7 @@ static struct cdev *audit_dev; static int audit_isopen = 0; static TAILQ_HEAD(, trigger_info) trigger_list; static struct mtx audit_trigger_mtx; +static struct selinfo audit_trigger_rsel; static int audit_open(struct cdev *dev, int oflags, int devtype, struct thread *td) @@ -127,6 +128,22 @@ audit_write(struct cdev *dev, struct uio *uio, int ioflag) return (EOPNOTSUPP); } +static int +audit_poll(struct cdev *dev, int events, struct thread *td) +{ + int revents = 0; + + if (events & (POLLIN | POLLRDNORM)) { + mtx_lock(&audit_trigger_mtx); + if (!TAILQ_EMPTY(&trigger_list)) + revents = events & (POLLIN | POLLRDNORM); + else + selrecord(td, &audit_trigger_rsel); + mtx_unlock(&audit_trigger_mtx); + } + return (revents); +} + int audit_send_trigger(unsigned int trigger) { @@ -142,6 +159,7 @@ audit_send_trigger(unsigned int trigger) } ti->trigger = trigger; TAILQ_INSERT_TAIL(&trigger_list, ti, list); + selwakeup(&audit_trigger_rsel); wakeup(&trigger_list); mtx_unlock(&audit_trigger_mtx); return (0); @@ -153,6 +171,7 @@ static struct cdevsw audit_cdevsw = { .d_close = audit_close, .d_read = audit_read, .d_write = audit_write, + .d_poll = audit_poll, .d_name = "audit" };