From: Steven Rostedt <rostedt@goodmis.org>
To: Jeff Barnes <jeffbarnes@linux.microsoft.com>
Cc: Beau Belgrave <beaub@linux.microsoft.com>,
"linux-trace-kernel@vger.kernel.org"
<linux-trace-kernel@vger.kernel.org>,
"mhiramat@kernel.org" <mhiramat@kernel.org>,
"mathieu.desnoyers@efficios.com" <mathieu.desnoyers@efficios.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
"kees@kernel.org" <kees@kernel.org>
Subject: Re: [PATCH] tracing/user_events: Fail fork when event state duplication fails
Date: Tue, 6 Oct 2026 08:38:25 -0400 [thread overview]
Message-ID: <20261006083825.2bbeaef2@fedora> (raw)
In-Reply-To: <B502490D-E683-4401-A06F-067B47CBC2E6@getmailspring.com>
On Tue, 6 Oct 2026 08:01:14 -0400
Jeff Barnes <jeffbarnes@linux.microsoft.com> wrote:
> Yes, that was intentional. My concern with allowing fork() to succeed
> after removing the child's user_events state is that the allocation
> failure then becomes a silent loss of inherited tracing state.
>
> The enable word is the userspace-visible indication that an event is
> enabled. If the child loses its inherited enablers, later enable and
> disable changes will no longer be reflected in that child. Removing the
> state fixes the stale-value inconsistency, but userspace has no
> indication from fork() that the child is no longer following the
> inherited tracing state.
>
> I also think there is a potential security implication here. If
> user_events are being used for tracing or auditing, an allocation
> failure could result in a successfully created child silently no longer
> following subsequent enablement changes. I don't want to characterize
> that as a security vulnerability without a demonstrated security
> boundary, but silently losing that state seems undesirable for auditing
> in particular.
>
> That is why I favored returning -ENOMEM: either the child is created
> with the inherited user_events state intact, or the failure is visible
> to userspace and the fork is unwound.
>
> I agree that uprobes provides a useful comparison. If you think
> user_events should likewise be best-effort across fork, then removing
> the state on duplication failure would address the inconsistency without
> introducing the new fork() failure path.
Question, to use user events the application needs to be involved,
correct? That is, there's code in the application specific for
user_events, as supposed to uprobes that can attach to any application.
Thus, it makes sense for uprobes to only warn on failure. Why should a
task fail to fork if something attaches a uprobe on it and it causes
issues.
Now if user_events is driven by the application that has them, then
yes, it makes sense for fork() to fail if the user_event it created
fails processing inside the fork(). If the user application is
expecting something, then if it fails it should know about it.
But this is only if user_events is driven by the application doing the
fork().
-- Steve
next prev parent reply other threads:[~2026-10-06 12:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-02 22:26 Jeff Barnes
2026-10-04 8:00 ` Steven Rostedt
2026-10-05 21:56 ` Beau Belgrave
2026-10-06 12:01 ` Jeff Barnes
2026-10-06 12:38 ` Steven Rostedt [this message]
2026-10-06 13:42 ` Jeff Barnes
2026-10-06 14:14 ` Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261006083825.2bbeaef2@fedora \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=beaub@linux.microsoft.com \
--cc=jeffbarnes@linux.microsoft.com \
--cc=kees@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®