lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4BzYbZ3f9E8mSwY+oppSwU-Luh=5=GBjLKetVA2TOFT+dWQ@mail.gmail.com>
Date: Thu, 15 May 2025 10:22:51 -0700
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Jiri Olsa <jolsa@...nel.org>
Cc: Oleg Nesterov <oleg@...hat.com>, Peter Zijlstra <peterz@...radead.org>, 
	Andrii Nakryiko <andrii@...nel.org>, bpf@...r.kernel.org, linux-kernel@...r.kernel.org, 
	linux-trace-kernel@...r.kernel.org, x86@...nel.org, 
	Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>, 
	John Fastabend <john.fastabend@...il.com>, Hao Luo <haoluo@...gle.com>, 
	Steven Rostedt <rostedt@...dmis.org>, Masami Hiramatsu <mhiramat@...nel.org>, 
	Alan Maguire <alan.maguire@...cle.com>, David Laight <David.Laight@...lab.com>, 
	Thomas Weißschuh <thomas@...ch.de>, 
	Ingo Molnar <mingo@...nel.org>
Subject: Re: [PATCHv2 perf/core 08/22] uprobes/x86: Add mapping for optimized
 uprobe trampolines

On Thu, May 15, 2025 at 5:13 AM Jiri Olsa <jolsa@...nel.org> wrote:
>
> Adding support to add special mapping for user space trampoline 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@...nel.org>
> ---
>  arch/x86/kernel/uprobes.c | 115 ++++++++++++++++++++++++++++++++++++++
>  include/linux/uprobes.h   |   6 ++
>  kernel/events/uprobes.c   |  10 ++++
>  kernel/fork.c             |   1 +
>  4 files changed, 132 insertions(+)
>

[...]

> +static unsigned long find_nearest_page(unsigned long vaddr)
> +{
> +       struct vm_unmapped_area_info info = {
> +               .length     = PAGE_SIZE,
> +               .align_mask = ~PAGE_MASK,
> +               .flags      = VM_UNMAPPED_AREA_TOPDOWN,
> +               .low_limit  = 0,

would this, technically, allow to allocate memory at NULL (0x0000)
address? should this start at PAGE_SIZE?

> +               .high_limit = ULONG_MAX,
> +       };
> +       unsigned long limit, call_end = vaddr + 5;
> +
> +       if (!check_add_overflow(call_end, INT_MIN, &limit))
> +               info.low_limit = limit;
> +       if (!check_add_overflow(call_end, INT_MAX, &limit))
> +               info.high_limit = limit;
> +       return vm_unmapped_area(&info);
> +}

[...]

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ