From nobody Wed Jun 25 00:41:16 2025 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 4bRjg073JSz60Tbn; Wed, 25 Jun 2025 00:41:16 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bRjg05hC4z3JvY; Wed, 25 Jun 2025 00:41:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750812076; 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=/VVHchO1e/AE8tf3mt10OcG0LIq4pL82gqTnUw0F5Z4=; b=DXE80iUMipoYD2rkBYsEMCzH1m0zQc6CDc+Hko6Auc1pb/2gm1sDPXfEvwvRr9pPkkpKAh FnLAjlagGPO87MZ+Ckn2thgopUPobr4+4PjH/GDtdgCBjoebmmwSf/maT8psJ8tGu/HMwU ExYXH36s4xCZlf/cY2C/CJw+bRtmkxWq/vP2kTZPptrsJL26Mp/OnbQO3RghET+LsY1sAH PLRiLnDmdkC8U4Tc/t+tFoiPJDcXRoPAFfslkU3R1F/UzJz/AOCGAujgwGchYt/8LlaiqM hg//mf96mJU7dP5PmtRpJC1u6AwE7B7DjaEYMzNRM0LDxKQTqPJjy5fiviUr6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750812076; 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=/VVHchO1e/AE8tf3mt10OcG0LIq4pL82gqTnUw0F5Z4=; b=QWJ5AGC7/ln4vU27dcWwpGuosS+BO6f4AxGCTNabCO0O09V13UqKkMeX5//LmWUHgYuIrl tV2I8nWZNiT1rHV7lLikHZ1HefH4YbwGQbWDnDZPCY99Ma8hkHkcifWnVXIAhQckBpzOdI pJYg9EjS8/GAwCiyQQTDfiy/koynYvok7qG7BuqPbvlb+YUQQqzevyLB9snmcRulh9BPV7 Z+YkgwUCgRNIsdCxls9LTNPEI0KWfh8DZPsKrh4/SZC4/oL7+0Wm7Pd6SGzlF/kzLbSKoL mEB8MFf0hpTNARZ0yt1hOxLp3pm40Fy6fQNNjlKXl3+DW16gXgd/SbWbbZdBQg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1750812076; a=rsa-sha256; cv=none; b=MQgeCnhaIt704SIPfWKGEPpJyqpGUj+HLvtphMFfLHzz31PCFKx8E4w/UPU4KHN/ZKt7tj P1X6tpTMfwUzaWKcC2VqSH/km3gAO7PB5WzqdxNUy6No9MyuDxJUJG/0vXZZ9nuqurcesu t+/8wB2pchKh5fpkiDLEF1kPdg2DtyVsZoQCVUJWqCfLFt9c7o9vkOjxQOnHm4hK/oaEk/ eJq+ij8OFflWHDt7Y4TGfgJPFbDT4/eLs4PeFIRVry8BNBtb5TWtnkqcQYV2xUKna6uhza DZdqIoIfVbq5WkuNGlDrwTteabdSrj+2VuchFA9fdICIzCIm2SuYo1G7WtRWXg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bRjg05CRQz191H; Wed, 25 Jun 2025 00:41:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 55P0fGn0095922; Wed, 25 Jun 2025 00:41:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55P0fGj0095919; Wed, 25 Jun 2025 00:41:16 GMT (envelope-from git) Date: Wed, 25 Jun 2025 00:41:16 GMT Message-Id: <202506250041.55P0fGj0095919@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 533f1a4d6b6e - stable/14 - audit: move the wait from the queue length from the commit to alloc 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 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 533f1a4d6b6ef0ba575d99b16a45b96fb5e91e59 Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=533f1a4d6b6ef0ba575d99b16a45b96fb5e91e59 commit 533f1a4d6b6ef0ba575d99b16a45b96fb5e91e59 Author: Konstantin Belousov AuthorDate: 2025-06-16 16:01:12 +0000 Commit: Konstantin Belousov CommitDate: 2025-06-24 01:15:06 +0000 audit: move the wait from the queue length from the commit to alloc PR: 287566 (cherry picked from commit 0452f5f7b37af81dba3953c7127385fe6f307790) --- sys/security/audit/audit.c | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/sys/security/audit/audit.c b/sys/security/audit/audit.c index 6f935ede5371..21d950ede416 100644 --- a/sys/security/audit/audit.c +++ b/sys/security/audit/audit.c @@ -412,15 +412,22 @@ currecord(void) return (curthread->td_ar); } -/* - * XXXAUDIT: Shouldn't there be logic here to sleep waiting on available - * pre_q space, suspending the system call until there is room? - */ struct kaudit_record * audit_new(int event, struct thread *td) { struct kaudit_record *ar; + mtx_lock(&audit_mtx); + audit_pre_q_len++; + + /* + * Constrain the number of committed audit records based on + * the configurable parameter. + */ + while (audit_q_len >= audit_qctrl.aq_hiwater) + cv_wait(&audit_watermark_cv, &audit_mtx); + mtx_unlock(&audit_mtx); + /* * Note: the number of outstanding uncommitted audit records is * limited to the number of concurrent threads servicing system calls @@ -428,11 +435,6 @@ audit_new(int event, struct thread *td) */ ar = uma_zalloc_arg(audit_record_zone, td, M_WAITOK); ar->k_ar.ar_event = event; - - mtx_lock(&audit_mtx); - audit_pre_q_len++; - mtx_unlock(&audit_mtx); - return (ar); } @@ -566,13 +568,6 @@ audit_commit(struct kaudit_record *ar, int error, int retval) return; } - /* - * Constrain the number of committed audit records based on the - * configurable parameter. - */ - while (audit_q_len >= audit_qctrl.aq_hiwater) - cv_wait(&audit_watermark_cv, &audit_mtx); - TAILQ_INSERT_TAIL(&audit_q, ar, k_q); audit_q_len++; audit_pre_q_len--;