From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796221581; b=YrJm4ABQxVo0qKCUPWFsU0OR7PWvJ0rRkTMoisCfhVzQOI59uOTnKFAOKUFlgNZ59+F7 eEqHWo94q9LQ/+Sm3Bz4+c24YIWbF9fARb60jDG+s9LhmvfpwRA6vGtpaLhPEusMvQCZ2 eFlwCbar5yxzUkq70XOJ36Bd8AlXsivvXp3S013bfkq0qdB201xRrXv1JoWMVu3vBLb/V 8HPq5RsLTJxfowwrcHo+1SdRbf0FJTDV4+or2tnBgOEPWzlWR9k2fd9mhk+bUTtTXwopP v0e0ABE1QtKp90RXoMQRicHpzbQrQzQLDs+tEPFa8wORfhd/mKuB3b/ly8/9tAilfcQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796221581; h=Received:DKIM-Signature:Subject:To:Cc:From:Date:Message-ID: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=le9G54xhLBKzE/SVapgP8LDf+zXK4g64NIrOMNFHksE=; b=1t4k1lN0v/9eSg3gIfvWdjoxhsPigDKOfMEpTF5OSw9S2RoCGyrBldulrzlZ0bMS1Sn5 oh7nm5uLJvY2Om6pY3X6n/7haX1RjZosS2Mqo3mzauztRnsy7iI9EEeG0EVRUWD9HYpAp IGAq3ZQEFM/iQiJ+plYawdhWxSBjb7DkyE9vYUs50ChIR1B702NubK4kov4npec/9dxb6 rm6HRxiEtspT2lx7bxfMKYUpCkDx7molqf1jrSIDefA7q/FiOiTxxyVOHIRF2pH0b3dcc Yg9qXO8n4HYmtJ4+TkENxCG3qYtiOYu0b1QOAcxnk4iZfwc2sXpI6qfaBN7CR96AOzg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=U1Wfmb0e; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1DBF6606A322 for ; Wed, 2 Dec 2026 14:26:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=U1Wfmb0e Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1788E1F0089A; Wed, 2 Dec 2026 14:26:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796221580; bh=le9G54xhLBKzE/SVapgP8LDf+zXK4g64NIrOMNFHksE=; h=Subject:To:Cc:From:Date; b=U1Wfmb0eciDF29Yq447EQ+G0U+XHJHgbr/WsGYQTyzIGnsnpOkW5HqAli3UvZJEcQ IO79UfvlU9NPlZzxsi3VCnLvl9RDpZjFcDaP1KrPEiyNzWmx8fvuBbZqqwXL6ey/n+ XXrEHdUqMjw5/YvrgBfp0ImqA2E0Er3bOo9OHM38= Subject: FAILED: patch "[PATCH] tracing/user_events: Don't free an event that a dynamic event" failed to apply to 6.1-stable tree To: devnexen@gmail.com,rostedt@goodmis.org Cc: From: Date: Wed, 02 Dec 2026 14:56:38 +0100 Message-ID: <2026120238-surcharge-headed-0d29@gregkh> X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 6.1-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y git checkout FETCH_HEAD git cherry-pick -x 0fbdc293697a5d72dc985e533eef5155a1b264cc # git commit -s git send-email --to '' --in-reply-to '2026120238-surcharge-headed-0d29@gregkh' --subject-prefix 'PATCH 6.1.y' 'HEAD^..' Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 0fbdc293697a5d72dc985e533eef5155a1b264cc Mon Sep 17 00:00:00 2001 From: David Carlier Date: Sat, 31 Oct 2026 21:24:35 +0000 Subject: [PATCH] tracing/user_events: Don't free an event that a dynamic event still references An eprobe takes a reference on the call of the event it attaches to, and kprobe, uprobe, fprobe and synth events all refuse to go away while trace_event_dyn_busy() says such a reference exists. user_events never checks it, so a user event can be freed under an eprobe: echo 'u:test u32 a' >> dynamic_events echo 'e:ep user_events/test a=$a' >> dynamic_events echo '-:user_events/test u32 a' >> dynamic_events echo '-:eprobes/ep' >> dynamic_events The last write drops the reference on the freed call. If the last fd of a non-persistent event closes while such a reference is held, the delayed destroy now fails. Mark the event persistent then, so it can still be deleted once the reference is gone instead of being leaked. Return -EBUSY from destroy_user_event() in that case. Fixes: 7f5a08c79df3 ("user_events: Add minimal support for trace_event into ftrace") Cc: stable@vger.kernel.org Link: https://patch.msgid.link/20261031212453.16116-1-devnexen@gmail.com Signed-off-by: David Carlier Signed-off-by: Steven Rostedt diff --git a/kernel/trace/trace_events_user.c b/kernel/trace/trace_events_user.c index f658c3a77aa7..ea6a20a30cf5 100644 --- a/kernel/trace/trace_events_user.c +++ b/kernel/trace/trace_events_user.c @@ -256,6 +256,11 @@ static void delayed_destroy_user_event(struct work_struct *work) * attempt to delete it later. */ pr_warn("user_events: Unable to delete event\n"); + /* + * Keep it as persistent so it can be still deleted + * since nobody own this event + */ + user->reg_flags |= USER_EVENT_REG_PERSIST; refcount_set(&user->refcnt, 1); } out: @@ -1506,6 +1511,10 @@ static int destroy_user_event(struct user_event *user) lockdep_assert_held(&event_mutex); + /* If there is a reference to a dynamic event */ + if (trace_event_dyn_busy(&user->call)) + return -EBUSY; + /* * Detach the fields before removing the call. Removing the event * frees the field list memory (trace_destroy_fields() is run on