Re: [PATCH perf/core 08/22] uprobes/x86: Add mapping for optimized uprobe trampolines

Andrii Nakryiko
2025-04-22T23:51:34Z

On Mon, Apr 21, 2025 at 2:46 PM Jiri Olsa <jolsa@kernel.org> wrote:
>
> Adding support to add special mapping for for user space trampoline

for for

> with following functions:
>
> uprobe_trampoline_get - find or add uprobe_trampoline
> uprobe_trampoline_put - remove or destroy uprobe_trampoline
>
> The user space trampoline is exported as arch specific user space special
> mapping through tramp_mapping, which is initialized in following changes
> with new uprobe syscall.
>
> The uprobe trampoline needs to be callable/reachable from the probed address,
> so while searching for available address we use is_reachable_by_call function
> to decide if the uprobe trampoline is callable from the probe address.
>
> All uprobe_trampoline objects are stored in uprobes_state object and are
> cleaned up when the process mm_struct goes down. Adding new arch hooks
> for that, because this change is x86_64 specific.
>
> Locking is provided by callers in following changes.
>
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> ---
> arch/x86/kernel/uprobes.c | 131 ++++++++++++++++++++++++++++++++++++++
> include/linux/uprobes.h | 6 ++
> kernel/events/uprobes.c | 10 +++
> kernel/fork.c | 1 +
> 4 files changed, 148 insertions(+)
>

Acked-by: Andrii Nakryiko <andrii@kernel.org> …