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 95F8E33344A; Fri, 7 Aug 2026 15:21:13 +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=1786116074; cv=none; b=dNE5ZlBVnKyZnpSVx2WELnr7LbNdEa18YklaNIcQX6Ashx2erbbl4vdAzK8UeVj0UMZAk2n+FboqwsnCtm2MnB2kfJnwJY0iNKnbtHNx9JjzAZ5qdXm45H+UJQHDKKYRtiMmbGBsNXQ4UEZnAVRPfifrGl87t65qzuLr9txNCEo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786116074; c=relaxed/simple; bh=0MQyTMj4Ii+dQJvAWAf8gR6X+ZFpoYyvkOWLCzw+ZRs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BTKpc/c/c8NCh0/dU7NqjCRJggDfc7qhR52nI1hFAhERgVBmfiomoESytM4JrEMhBL0pNgxxAIuYnEGSiVyuhOwX5PA3eGwDaUXRRWOmS/SUkyoCFkXyr+fK60Q/GS0vAndeB4xp7UiHBiN1o5ueUimIGweEEXW2JSA7l0s9E70= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=lR58hOcO; 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="lR58hOcO" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E8FAD1F000E9; Fri, 7 Aug 2026 15:21:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1786116073; bh=NQ00TNwnvtNEuaq+9c1m8wOxL6TvD9LybSoBAl/7e7o=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=lR58hOcObXN884k7OGPPzQVI29D24sgmtN530o+Dw6/UimpFgMHDj40jRmoMSYMry jxJp+HbjttnwkoFvoOWC05m6e8+xt416LvWBOMDhFAENCCgJbY5spdv0K1yvH3z99n 3gJu3nC/u5P8dLSQW0Rkn/RIMgXKk0QuhTTidEdo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Vega , Luxiao Xu , Ren Wei , Paul Moore Subject: [PATCH 6.6 102/261] audit: fix potential use-after-free in audit_del_rule() Date: Fri, 7 Aug 2026 16:37:39 +0200 Message-ID: <20260807143417.579352107@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260807143415.358597922@linuxfoundation.org> References: <20260807143415.358597922@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: Luxiao Xu commit 246df90b5f1a8a6e6abbd2f058b029558720adec upstream. `audit_del_rule()` destroys `e->rule.exe` via `audit_remove_mark_rule()` before unlinking the rule from RCU-visible filter lists and waiting for a grace period. Concurrent readers in `audit_filter()` and `audit_filter_rules()` still dereference `e->rule.exe`, while the fsnotify mark can be freed on an independent lifetime path. This creates a use-after-free window during rule deletion. Fix this by unlinking the rule from the RCU-visible lists and invoking `synchronize_rcu()` before calling `audit_remove_mark_rule()` (and other rule removal helpers). This ensures that all existing RCU readers have exited the critical section before any underlying resources are destroyed. Cc: stable@vger.kernel.org Fixes: 34d99af52ad4 ("audit: implement audit by executable") Reported-by: Vega Assisted-by: Codex:gpt-5.4 Signed-off-by: Luxiao Xu Signed-off-by: Ren Wei Signed-off-by: Paul Moore Signed-off-by: Greg Kroah-Hartman --- kernel/auditfilter.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/kernel/auditfilter.c +++ b/kernel/auditfilter.c @@ -1047,6 +1047,10 @@ int audit_del_rule(struct audit_entry *e goto out; } + list_del_rcu(&e->list); + list_del(&e->rule.list); + synchronize_rcu(); + if (e->rule.watch) audit_remove_watch_rule(&e->rule); @@ -1064,8 +1068,6 @@ int audit_del_rule(struct audit_entry *e audit_signals--; #endif - list_del_rcu(&e->list); - list_del(&e->rule.list); call_rcu(&e->rcu, audit_free_rule_rcu); out: