From: sashiko-bot@kernel.org
To: "Jiri Olsa" <jolsa@kernel.org>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCHv5 01/13] uprobes/x86: Use proper mm_struct in __in_uprobe_trampoline
Date: Wed, 01 Jul 2026 11:32:30 +0000 [thread overview]
Message-ID: <20260701113230.F258E1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260701111337.53943-2-jolsa@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Missing vma_start_write() before modifying page tables under mmap_write_lock() in uprobe modification paths.
--
commit e98c98f0853de23f35b1d0253c941b8b823e5967
Author: Jiri Olsa <jolsa@kernel.org>
uprobes/x86: Use proper mm_struct in __in_uprobe_trampoline
This commit updates the unregister path to pass the correct mm_struct to
__in_uprobe_trampoline instead of relying on current->mm. It adds the
mm_struct argument and updates related callers to provide the proper
pointer in the tracer context.
> diff --git a/arch/x86/kernel/uprobes.c b/arch/x86/kernel/uprobes.c
> index 7be8e361ca55b..c5bb040488b35 100644
> --- a/arch/x86/kernel/uprobes.c
> +++ b/arch/x86/kernel/uprobes.c
[ ... ]
[Severity: High]
This isn't a bug introduced by this patch, but there is a pre-existing
issue in the uprobes subsystem regarding the per-VMA locks.
Does the uprobe registration and optimization path race with concurrent
per-VMA lock readers?
In arch_uprobe_optimize(), the code takes the mmap_write_lock but doesn't
call vma_start_write() on the target VMA:
arch/x86/kernel/uprobes.c:arch_uprobe_optimize() {
...
mmap_write_lock(mm);
...
if (__arch_uprobe_optimize(auprobe, mm, vaddr))
...
}
A similar sequence happens in register_for_each_vma():
kernel/events/uprobes.c:register_for_each_vma() {
...
mmap_write_lock(mm);
if (check_stable_address_space(mm))
goto unlock;
vma = find_vma(mm, info->vaddr);
...
err = install_breakpoint(uprobe, vma, info->vaddr);
...
}
Both of these paths eventually call down to __uprobe_write(), which
modifies the page tables directly:
kernel/events/uprobes.c:__uprobe_write() {
...
fw->pte = ptep_clear_flush(vma, vaddr, fw->ptep);
...
}
Since mmap_write_lock() alone does not drain existing per-VMA read lock
holders (its sequence counter only prevents new acquisitions), could this
cause a race where concurrent paths executing under the per-VMA lock
(like page faults or MADV_DONTNEED) read stale page table state while
__uprobe_write() clears and flushes the PTEs?
Should these paths call vma_start_write() to safely drain the per-VMA
readers before making page table modifications?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260701111337.53943-2-jolsa@kernel.org?part=1
next prev parent reply other threads:[~2026-07-01 11:32 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-01 11:13 [PATCHv5 00/13] uprobes/x86: Fix red zone issue for optimized uprobes Jiri Olsa
2026-07-01 11:13 ` [PATCHv5 01/13] uprobes/x86: Use proper mm_struct in __in_uprobe_trampoline Jiri Olsa
2026-07-01 11:32 ` sashiko-bot [this message]
2026-07-01 11:13 ` [PATCHv5 02/13] uprobes/x86: Remove struct uprobe_trampoline object Jiri Olsa
2026-07-01 11:57 ` bot+bpf-ci
2026-07-01 11:13 ` [PATCHv5 03/13] uprobes/x86: Do not leak trampoline vma mapping on optimization failure Jiri Olsa
2026-07-01 11:13 ` [PATCHv5 04/13] uprobes/x86: Allow to copy uprobe trampolines on fork Jiri Olsa
2026-07-01 11:13 ` [PATCHv5 05/13] uprobes/x86: Move optimized uprobe from nop5 to nop10 Jiri Olsa
2026-07-01 11:57 ` bot+bpf-ci
2026-07-01 11:13 ` [PATCHv5 06/13] libbpf: Change has_nop_combo to work on top of nop10 Jiri Olsa
2026-07-01 11:34 ` sashiko-bot
2026-07-01 11:13 ` [PATCHv5 07/13] libbpf: Detect uprobe syscall with new error Jiri Olsa
2026-07-01 11:30 ` sashiko-bot
2026-07-01 11:13 ` [PATCHv5 08/13] selftests/bpf: Emit nop,nop10 instructions combo for x86_64 arch Jiri Olsa
2026-07-01 11:26 ` sashiko-bot
2026-07-01 11:13 ` [PATCHv5 09/13] selftests/bpf: Change uprobe syscall tests to use nop10 Jiri Olsa
2026-07-01 11:33 ` sashiko-bot
2026-07-01 11:13 ` [PATCHv5 10/13] selftests/bpf: Change uprobe/usdt trigger bench code " Jiri Olsa
2026-07-01 11:13 ` [PATCHv5 11/13] selftests/bpf: Add reattach tests for uprobe syscall Jiri Olsa
2026-07-01 11:13 ` [PATCHv5 12/13] selftests/bpf: Add tests for uprobe nop10 red zone clobbering Jiri Olsa
2026-07-01 11:57 ` bot+bpf-ci
2026-07-01 11:13 ` [PATCHv5 13/13] selftests/bpf: Add tests for forked/cloned optimized uprobes Jiri Olsa
2026-07-01 11:57 ` bot+bpf-ci
2026-07-01 23:13 ` [PATCHv5 00/13] uprobes/x86: Fix red zone issue for " Andrii Nakryiko
2026-07-02 11:20 ` Jiri Olsa
2026-07-02 16:20 ` Andrii Nakryiko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260701113230.F258E1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=jolsa@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox