Re: [RFC PATCH 0/8] uprobe/x86: Add support to optimize prologue

From: Google
Date: Mon Dec 08 2025 - 01:46:39 EST


On Mon, 24 Nov 2025 19:12:42 +0100
Oleg Nesterov <oleg@xxxxxxxxxx> wrote:

> On 11/17, Jiri Olsa wrote:
> >
> > This patchset adds support to optimize uprobe on top of instruction
> > that could be emulated and also adds support to emulate particular
> > versions of mov and sub instructions to cover some of the user space
> > functions prologues, like:
> >
> > pushq %rbp
> > movq %rsp,%rbp
> > subq $0xb0,%rsp
>
> ...
>
> > There's an additional issue that single instruction replacement does
> > not have and it's the possibility of the user space code to jump in the
> > middle of those 5 bytes. I think it's unlikely to happen at the function
> > prologue, but uprobe could be placed anywhere. I'm not sure how to
> > mitigate this other than having some enable/disable switch or config
> > option, which is unfortunate.
>
> plus this breaks single-stepping... Although perhaps we don't really care.

Yeah, and I think we can stop optimization if post_handler is set.

Thanks,

--
Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx>