On Tue, May 26, 2026 at 09:46:40PM +0000, [email protected] wrote:
> > diff --git a/arch/x86/kernel/uprobes.c b/arch/x86/kernel/uprobes.c
> > index 733655bc610e..c8af41ed681a 100644
> > --- a/arch/x86/kernel/uprobes.c
> > +++ b/arch/x86/kernel/uprobes.c
> > @@ -697,7 +697,7 @@ static struct vm_area_struct 
> > *get_uprobe_trampoline(struct mm_struct *mm, unsign
> >             return ERR_PTR(vaddr);
> >
> >     return _install_special_mapping(mm, vaddr, PAGE_SIZE,
> > -                           
> > VM_READ|VM_EXEC|VM_MAYEXEC|VM_MAYREAD|VM_DONTCOPY|VM_IO,
> > +                           VM_READ|VM_EXEC|VM_MAYEXEC|VM_MAYREAD|VM_IO,
> >                             &tramp_mapping);
> >  }
> 
> When a process with optimized uprobes is forked, the child inherits the
> optimized code and trampoline. This means sys_uprobe invocations in the
> child will go into the uprobe trampoline, and the syscall will keep
> returning -EPROTO since no handler is registered.
> 
> Is there a way to restore the original memory pages for clones?
> 
> This behavior seems suboptimal from a performance perspective. For
> standard int3-based uprobes, breakpoints are removed via
> UPROBE_HANDLER_REMOVE. Could something similar be implemented for
> optimized uprobes, perhaps with proper filtering in uprobe_multi?
> 
> Reference: 
> https://lore.kernel.org/bpf/caef4bzyo-8paxfjt9mhoun9ux1o2yvxjadc0tgssacvu_r8...@mail.gmail.com/

and I replied in that thread that we can address that later:
  https://lore.kernel.org/bpf/ahNzlAfUnymDDGOR@krava/

jirka

Reply via email to