Thread (5 messages) 5 messages, 2 authors, 2024-12-10

Re: [PATCH] fork: avoid inappropriate uprobe access to invalid mm

From: Oleg Nesterov <oleg@redhat.com>
Date: 2024-12-10 16:54:14
Also in: linux-mm, linux-perf-users, lkml

I must have missed something, but...

On 12/10, Lorenzo Stoakes wrote:
quoted hunk ↗ jump to hunk
@@ -1746,9 +1741,11 @@ static struct mm_struct *dup_mm(struct task_struct *tsk,
 	if (!mm_init(mm, tsk, mm->user_ns))
 		goto fail_nomem;

+	uprobe_start_dup_mmap();
 	err = dup_mmap(mm, oldmm);
 	if (err)
-		goto free_pt;
+		goto free_pt_end_uprobe;
+	uprobe_end_dup_mmap();

 	mm->hiwater_rss = get_mm_rss(mm);
 	mm->hiwater_vm = mm->total_vm;
@@ -1758,6 +1755,8 @@ static struct mm_struct *dup_mm(struct task_struct *tsk,

 	return mm;

+free_pt_end_uprobe:
+	uprobe_end_dup_mmap();
if dup_mmap() fails and "mm" is incomplete, then with this version dup_mmap_sem
is dropped before __mmput/exit_mmap/etc. How can this help?

Oleg.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help