From: Oleg Nesterov <oleg@redhat.com>
To: Keke Ming <ming.jvle@gmail.com>
Cc: Andrii Nakryiko <andrii@kernel.org>, Jiri Olsa <jolsa@kernel.org>,
Masami Hiramatsu <mhiramat@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
linux-perf-users@vger.kernel.org
Subject: Re: [PATCH] uprobes: Free utask on dup_return_instance() failure
Date: Mon, 24 Aug 2026 17:57:17 +0200 [thread overview]
Message-ID: <aoxp3Rcbp3fUuqS8@redhat.com> (raw)
In-Reply-To: <CABbwK50istUW_xnFsjCA+MMgFCuBbY-Zs3QmJU=Fg7heqKdF6A@mail.gmail.com>
On 08/24, Keke Ming wrote:
>
> On 08/24, Oleg Nesterov wrote:
>
> > Hmm. It is not that I think "it is not enough", I think this is pointless
> > whatever we do.
>
> Well, I didn't mean to insist on the cleanup, I also think it may
> be redundant. If the child is bound to exit, manually calling
> uprobe_free_utask(t) in dup_utask() is pointless, as the normal
> exit path will handle it.
Yes, but the same is true if the child is not bound to exit... IOW,
I still can't understand your motivation for this patch...
> > But this is only the first step to cleanup
> > this logic. I'll try to write another email tomorrow.
>
> Of course, I'm all ears.
You have already mentioned "Option B" below ;) that is what I meant.
> Here is my current understanding. One thing I am not sure about
> is the signal semantics. If the copied uprobe state is incomplete,
> the child should not return to user mode with that state.
Perhaps... But consider
func_which_can_be_ret_probed(void)
{
if (!fork) {
printf("CHILD\n");
exit(0);
}
}
> Option A:
...
> ...
> kill_child:
> // I was thinking about SIGKILL here because it cannot be ignored
> // Of course, you can correct me
> send_sig(SIGKILL, t, 1);
force_exit_sig(SIGILL) can't be ignored too. But I am fine either way.
So yes, perhaps this makes sense. Although IMO this all is not that
important; GFP_KERNEL shouldn't fail "in practice" and at least
uprobe_copy_process() warns in this case...
> Option B:
>
> > Note that uprobe_copy_process() warns but returns "void", too late
> > to abort copy_process().
>
> Looking at copy_process(), uprobe_copy_process() is currently called
> after the "No more failure paths" point and after the child has already
> been made visible through the task list and pid links.
>
> Would the longer term fix be to move the uprobe state copy earlier,
> before the "No more failure paths" point, and then add the needed
> bad_fork cleanup for p->utask?
Agreed, pronably better than Option A. But in therory dup_xol_work()
can still fail after fork().
Oleg.
next prev parent reply other threads:[~2026-08-24 15:57 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-22 5:46 [PATCH] uprobes: Free utask on dup_return_instance() failure Keke Ming
2026-08-22 6:00 ` sashiko-bot
2026-08-23 12:02 ` Masami Hiramatsu
2026-08-23 13:00 ` Keke Ming
2026-08-22 15:09 ` [PATCH v2] " Keke Ming
2026-08-22 15:16 ` sashiko-bot
2026-08-23 15:38 ` [PATCH] " Oleg Nesterov
2026-08-23 16:26 ` Keke Ming
2026-08-23 19:41 ` Oleg Nesterov
2026-08-24 11:22 ` Keke Ming
2026-08-24 15:57 ` Oleg Nesterov [this message]
2026-08-24 19:54 ` Andrii Nakryiko
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=aoxp3Rcbp3fUuqS8@redhat.com \
--to=oleg@redhat.com \
--cc=andrii@kernel.org \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=ming.jvle@gmail.com \
--cc=peterz@infradead.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