[PATCH RFC v3 38/90] uprobes: cope with a new task that has no mm

From: Josef Bacik

Date: Thu Nov 05 2026 - 10:21:48 EST


If the parent has pending return probes and the child does not share its
mm, uprobe_copy_process() copies the probes to the child and queues work
that sets up a probe area in the mm of the child.

A task that is created without an mm does not share the mm of its parent,
so it would take that path. It has no use for any of this. Return early
for such a task.

Signed-off-by: Josef Bacik <josef@xxxxxxxxxxxxxx>
---
kernel/events/uprobes.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index caf444762a27..af378f228d5c 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -2185,6 +2185,10 @@ void uprobe_copy_process(struct task_struct *t, u64 flags)

t->utask = NULL;

+ /* Nothing of the parent's mm matters to a task that has none. */
+ if (!t->mm)
+ return;
+
if (!utask || !utask->return_instances)
return;


--
2.55.0