Re: [PATCH bpf 1/2] uprobes/x86: Fix red zone clobbering in nop5 optimization
flat view
From: Oleg Nesterov <oleg@redhat.com>
Date: 2026-05-11 17:25:06
Also in:
bpf
On 05/11, Andrii Nakryiko wrote:
On Mon, May 11, 2026 at 7:45 AM Oleg Nesterov [off-list ref] wrote:quoted
On 05/08, Andrii Nakryiko wrote:quoted
+static bool resolve_uprobe_addr(unsigned long ip, unsigned long *probe_addr) { - struct vm_area_struct *vma = vma_lookup(current->mm, ip); + struct uprobes_state *state = ¤t->mm->uprobes_state;it seems that there is a problem, with or without this change... Lets forget about this patch for the moment, I am still trying to understand it. What if register_for_each_vma() calls install_breakpoint(vma) and vma->mm != current->mm ? In this case install_breakpoint() path will call __is_optimized() and then __in_uprobe_trampoline() which does vma_lookup(current->mm). This looks obviously wrong ? And unless I am totally confused, this patch "inherits" the problem... No?Yes, sashiko called this out as well. I'm going to pass mm explicitly into is_optimized and all the way to resolve_uprobe_addr(), easy fix.
Aah... found it: https://sashiko.dev/#/patchset/20260509003146.976844-1-andrii%40kernel.org And note that sashiko is more clever than me; I didn't realize that _unregister() has more problems with current->mm :/
But we should have a stand-alone easily backportable fix for this even without my changes, yes. I can add it as pre-patch or send separately.
Agreed. This deserves another/simple fix. If nothing else, for documentation. Oleg.