From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 390A9402BB8; Wed, 20 May 2026 18:49:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779302943; cv=none; b=H1e53PS6L6+HMhg8oz/aNQ7JF3cq3XuQZgvbBucjCW0XM+n/5pzXbKRp7A6DVLFilZKfOVvdowgz77W7fPZw7GJPwV8Dizo2YENAsV3a2+Tgo+Q7x/JgEmd0ve5mkpK40c+iy3ZGsp60/6IOU2GBgQxqcKRKSemweMVd2Ad8fcg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779302943; c=relaxed/simple; bh=Hbb+H6x9SAL0c7k5J7me8gGYyshBaXJ3mTOzIXvHJ+4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Jt3zzUfGtiuX3HKAUCrXnmcSBT/aljixNE/06qs2MI599z+9AXJNX/5hOsAlHQ0Zou42wX4kWK0b1kFDgBkufm+9bYfKw1pYcwgpwcCdBp4LejIHCs/Y/KaTwxYYCsBohGxTOzAIIS+H6Uqq1IOSjjZ3ISbZROXtxB3vmUpkHd8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=WObVjajc; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="WObVjajc" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 376A91F00893; Wed, 20 May 2026 18:49:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1779302940; bh=DORn1k9LEMnKnHrOr7Kd8prcI1bUyLKnzeY/5VltADs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=WObVjajcQ0YuyU0IWbKajmuSRpNadPb/4b7gHGZK4WlBdqOVq0NjKlVOOgl2M+5l7 ZC8D+bCY+qo2daQ6Z3pX0icwPAQtGDbdg4BruUaOZl4XTd/9hhtuc3HNPhCCP9Qdh6 undcnFu9ZwohwHNP7rn62fBSssNY+qPH33AerH+E= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Ricardo Robaina , Sergio Correia , Paul Moore Subject: [PATCH 6.6 458/508] audit: enforce AUDIT_LOCKED for AUDIT_TRIM and AUDIT_MAKE_EQUIV Date: Wed, 20 May 2026 18:24:41 +0200 Message-ID: <20260520162108.517614518@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260520162058.573354582@linuxfoundation.org> References: <20260520162058.573354582@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sergio Correia commit f9e1c1324b4d98d591a6f7568fdebf5cf456dfc2 upstream. AUDIT_ADD_RULE and AUDIT_DEL_RULE correctly check for AUDIT_LOCKED and return -EPERM, but AUDIT_TRIM and AUDIT_MAKE_EQUIV do not. This allows a process with CAP_AUDIT_CONTROL to modify directory tree watches and equivalence mappings even when the audit configuration has been locked, undermining the purpose of the lock. Add AUDIT_LOCKED checks to both commands. Cc: stable@vger.kernel.org Reviewed-by: Ricardo Robaina Assisted-by: Claude:claude-opus-4-6 Signed-off-by: Sergio Correia Signed-off-by: Paul Moore Signed-off-by: Greg Kroah-Hartman --- kernel/audit.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/kernel/audit.c +++ b/kernel/audit.c @@ -1427,6 +1427,8 @@ static int audit_receive_msg(struct sk_b err = audit_list_rules_send(skb, seq); break; case AUDIT_TRIM: + if (audit_enabled == AUDIT_LOCKED) + return -EPERM; audit_trim_trees(); audit_log_common_recv_msg(audit_context(), &ab, AUDIT_CONFIG_CHANGE); @@ -1439,6 +1441,8 @@ static int audit_receive_msg(struct sk_b size_t msglen = data_len; char *old, *new; + if (audit_enabled == AUDIT_LOCKED) + return -EPERM; err = -EINVAL; if (msglen < 2 * sizeof(u32)) break;