From nobody Tue Jun 16 01:00:53 2026 X-Original-To: dev-commits-src-branches@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 4gfTFL0KPBz6gGMR for ; Tue, 16 Jun 2026 01:00:54 +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 4gfTFK3Wk8z44H4 for ; Tue, 16 Jun 2026 01:00:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1781571653; 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=FQomgO8o99cjf7lD3WMe8k8vSiyQMNeoXvudBNQTfDY=; b=vuQOCZIElGzouj0yXJhM4EYTmAXDhAmojR52Q/uv64i2uVlS3RxviInRfD6ZGBLHdIfnLN qO1By6oLIcsGHfsFyaP7iqNLEXe2dU00hg3wr4keaSjTj5fhnaW7OSo1fP0goiG2ypijqr XU89XbMGps6PWELZH7euB+YoLnjXIt07vV2la2RZtRTTmvzk3Gx5rf/hq4YCZjakEWxQ20 2tSnKEzZS9Yi1ITL1OdoG0EByd8taFqYmi8vRZVs6FWKHD4VvDh5TxMGXqn659CQNr8IYG Pqhh384xOnDXGtTXgfhXX5AmdF3Uk7+cuAY6faVXSAZZQ3bXMyYthMJwtsrarQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1781571653; a=rsa-sha256; cv=none; b=Ifk8cnf8HVmej4J/mvYkMLh2fdrgLWfy+qjIwhNjZ/8/fXyw7BW3uiOKTeVclk/N2U85g6 UZzSp8MKZu7MlDM3iJXq+KML6OemNPWB55jNnxAMiYB5CzoKZa8C4LNwctnOkIKnmcwla/ msnCi13Svld/q7FBZ8t529tdFszhifisx644yoDTQr1LlYJ9d/8+h+6xr9aI7FX3dAswNX rvx1wqpdQDkXimNcX2iY//HVrj1bIodRcb19ecJSpvCcd9gNbGJ1jOFocmCv4I40yROE60 2iJV59EOhO/sAlyD43tkte4cY8wDgjHoxq56TJ30tfJKubY34+KLYhE5wh0G2w== 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=1781571653; 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=FQomgO8o99cjf7lD3WMe8k8vSiyQMNeoXvudBNQTfDY=; b=V7okP7HxaaSZzDDx0hvMGyokGXQTe1lEmDSZa6UjU6VWC8RuygnNjZstaGbnlqVP1/Gsx7 edDFD5O8dO6gSShsjJNBA8GwQqCqK9WPVnANwerDk2BSwCVAQiDEokmTr4uYXmCJ4VTnvK t7MdRSdmoLybwb6PlhqzTEkZilqbWXD5nsvalbzl2l2JmW6JDHbeeUO7LDkj0lIqIEJpXe o7fpJI1HiW3rFlWOXQhDVMv/fqFERUJYLMEUTLEAFsrO+gseYs4vdjXazQHho8uI/6146s nddGizXFNMOq45uIJqjKkOkOalX4jL6ryfiCXGYgy4W6YYUAjOaK8sH6tDjilg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gfTFK35zdz1JJj for ; Tue, 16 Jun 2026 01:00:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 235d4 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 16 Jun 2026 01:00:53 +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: 5ecad8243830 - stable/14 - audit: Add poll / select support List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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/14 X-Git-Reftype: branch X-Git-Commit: 5ecad824383041655ca95c0628c709d6573a7150 Auto-Submitted: auto-generated Date: Tue, 16 Jun 2026 01:00:53 +0000 Message-Id: <6a30a045.235d4.73f1cfb8@gitrepo.freebsd.org> The branch stable/14 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=5ecad824383041655ca95c0628c709d6573a7150 commit 5ecad824383041655ca95c0628c709d6573a7150 Author: Dag-Erling Smørgrav AuthorDate: 2026-06-05 21:50:38 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-06-16 01:00:21 +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 ffa29b6d9951..d4b75a7f4baf 100644 --- a/sys/security/audit/audit_trigger.c +++ b/sys/security/audit/audit_trigger.c @@ -33,8 +33,10 @@ #include #include #include +#include #include #include +#include #include #include @@ -46,8 +48,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; @@ -59,6 +59,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) @@ -128,6 +129,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) { @@ -143,6 +160,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); @@ -154,6 +172,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" };