From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4164C352C2C for ; Wed, 15 Apr 2026 03:45:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776224761; cv=none; b=XQm8BY7BVEVENkn3FMtc6Asf9rP/+vZ2FLZmAgRnzFHTSzq5TY2Rez0iNuZXmj13R+NTA/V6LjsJqNpeKf9B1bGrL77uf33UMfil8W2s6zyd0KPJMLyAWUDT6F+seaEyWSOEY+/j3+ss6iDZmCbP5kVtNmN9zcRz/8GFKGMf6po= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776224761; c=relaxed/simple; bh=2XbherQRlEW3rLNknXC2NBiveH7IIYy6VAb0U6TKwKM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=cPrmkIbwW7jMmFvwGw9oXAsLA1i1xre4kbLt0WclVoDCtlx+OogfNAQzTRwJg1vteSKv5oSHzDfJytxK1F1UL5HdHN2K51HxMTaficoBiy0peMPKChBwpfUUpEaJwlcnmfts0hCbBC/xKVymBuBGhrj8o3pGKbgRKU9DJErLxT4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Z5MBFzeS; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Z5MBFzeS" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1776224750; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tnSLUaiLFcStekKu1oCt68z+17WoYAop+X3c0GErV80=; b=Z5MBFzeS2Rm6F2AHde200wePlnxZVLBVdkksbX5Fd3PxTgab08ASYL1YJBAUvcpZ74+MqL s/5fSMXhmr2JK17q1Z95087AE/iCzsEZbnxTnvVRDrTUBA37yIoi6Bf/N44g3tsfJ8JUb1 vttoS53s+7Z28sGN3eyRQBzZ+dRBBgo= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-250-v43AjH_lPsOHAovF3l18qA-1; Tue, 14 Apr 2026 23:45:47 -0400 X-MC-Unique: v43AjH_lPsOHAovF3l18qA-1 X-Mimecast-MFC-AGG-ID: v43AjH_lPsOHAovF3l18qA_1776224746 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 090C4195609E; Wed, 15 Apr 2026 03:45:46 +0000 (UTC) Received: from x2.localnet (unknown [10.22.80.38]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 0DD6419560B1; Wed, 15 Apr 2026 03:45:44 +0000 (UTC) From: Steve Grubb To: Ricardo Robaina , Paul Moore Cc: audit@vger.kernel.org, linux-kernel@vger.kernel.org, eparis@redhat.com Subject: Re: [PATCH] audit: add backlog high water mark metric Date: Tue, 14 Apr 2026 23:45:00 -0400 Message-ID: <2213475.9o76ZdvQCi@x2> Organization: Red Hat In-Reply-To: References: <20260323150700.614139-1-rrobaina@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Hello Paul, On Friday, April 10, 2026 5:34:08=E2=80=AFPM Eastern Daylight Time Paul Moo= re wrote: > On Mon, Mar 23, 2026 at 11:07=E2=80=AFAM Ricardo Robaina =20 wrote: > > Currently, determining the optimal `audit_backlog_limit` relies on > > instantaneous polling of the queue size. This misses transient > > micro-bursts, making it difficult for system administrators to know > > if their queue is adequately sized or if they are at risk of > > dropping events. > >=20 > > This patch introduces `backlog_max_depth`, a high-water mark metric > > that tracks the maximum number of buffers in the audit queue since > > the system was booted or the metric was last reset. To minimize > > performance overhead in the fast-path, the metric is updated using > > a lockless cmpxchg loop in `__audit_log_end()`. > >=20 > > Userspace can read-and-clear this metric by sending an `AUDIT_SET` > > message with the `AUDIT_STATUS_BACKLOG_MAX_DEPTH` mask. To support > > periodic telemetry polling (e.g., statsd, Prometheus), the reset > > operation atomically returns the snapshot of the high-water mark > > right before zeroing it, ensuring no peaks are lost between polls. > >=20 > > Link: https://github.com/linux-audit/audit-kernel/issues/63 > > Suggested-by: Steve Grubb > > Signed-off-by: Ricardo Robaina > > --- > >=20 > > include/linux/audit.h | 3 ++- > > include/uapi/linux/audit.h | 2 ++ > > kernel/audit.c | 32 ++++++++++++++++++++++++++++++++ > > 3 files changed, 36 insertions(+), 1 deletion(-) >=20 > I sat on this for a bit because I wanted to think on it for a while. > While I agree audit could benefit from better statistics around > queue/backlog status, I'm not sure a single "max" value alone is worth > a bit in the audit_status bitmask. My concern is that the max queue > length only provides a single snapshot of what the queue looked like, > it doesn't give any indication of the average queue length over a span > of time. Some audit users are willing to live with occasional drops, > and the max size doesn't help them arrive at a good balance. >=20 > As for the users who can't tolerate any audit record drops? They > shouldn't be running with a backlog limit anyway so the maximum queue > value will be of limit use. The existing audit_lost counter tells administrators they have already=20 failed; the proposed backlog_max_depth tells them they are at risk of=20 failing. These are different signals serving different operational needs. T= he=20 dominant real-world deployment =E2=80=94 compliance-driven systems that mus= t use a=20 finite backlog limit for memory safety but cannot tolerate dropped events = =E2=80=94=20 has no existing mechanism to verify their limit is correctly sized between= =20 polling intervals. Instantaneous backlog polling is blind to sub-second=20 bursts. Only a high-water mark, atomically reset at each poll, closes this= =20 gap. The average queue length would not answer the question 'did I ever com= e=20 close to the limit?' =E2=80=94 only the maximum can. On the bitmask concern: the last addition was=20 AUDIT_STATUS_BACKLOG_WAIT_TIME_ACTUAL, six years ago. If you don't think this closes the gap on what people need, the patch could= =20 be amended to include backlog_lost_since_reset (drops since last poll)=20 alongside the max so that you get two metrics for the price of one bit. But= =20 this is absolutely needed because people are flying blind without it. =2DSteve