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: <CAJF2gTTRv4a-sEgjAvMm8VatFpnYoTVNM1+3XVsmnh=i8TuPPw@mail.gmail.com>
Date: Fri, 18 Apr 2025 17:57:43 +0800
From: Guo Ren <guoren@...nel.org>
To: Björn Töpel <bjorn@...nel.org>
Cc: Paul Walmsley <paul.walmsley@...ive.com>, Palmer Dabbelt <palmer@...belt.com>, 
	Alexandre Ghiti <alex@...ti.fr>, linux-riscv@...ts.infradead.org, 
	Björn Töpel <bjorn@...osinc.com>, 
	Masami Hiramatsu <mhiramat@...nel.org>, Oleg Nesterov <oleg@...hat.com>, 
	Peter Zijlstra <peterz@...radead.org>, linux-kernel@...r.kernel.org, 
	linux-trace-kernel@...r.kernel.org
Subject: Re: [PATCH fixes] riscv: uprobes: Add missing fence.i after building
 the XOL buffer

On Thu, Apr 17, 2025 at 3:50 PM Björn Töpel <bjorn@...nel.org> wrote:
>
> From: Björn Töpel <bjorn@...osinc.com>
>
> The XOL (execute out-of-line) buffer is used to single-step the
> replaced instruction(s) for uprobes. The RISC-V port was missing a
> proper fence.i (i$ flushing) after constructing the XOL buffer, which
> can result in incorrect execution of stale/broken instructions.
>
> This was found running the BPF selftests "test_progs:
> uprobe_autoattach, attach_probe" on the Spacemit K1/X60, where the
> uprobes tests randomly blew up.
Good catch, Thx!

Reviewed-by: Guo Ren <guoren@...nel.org>


>
> Fixes: 74784081aac8 ("riscv: Add uprobes supported")
> Signed-off-by: Björn Töpel <bjorn@...osinc.com>
> ---
>  arch/riscv/kernel/probes/uprobes.c | 9 +--------
>  1 file changed, 1 insertion(+), 8 deletions(-)
>
> diff --git a/arch/riscv/kernel/probes/uprobes.c b/arch/riscv/kernel/probes/uprobes.c
> index 4b3dc8beaf77..4faef92dd771 100644
> --- a/arch/riscv/kernel/probes/uprobes.c
> +++ b/arch/riscv/kernel/probes/uprobes.c
> @@ -176,13 +176,6 @@ void arch_uprobe_copy_ixol(struct page *page, unsigned long vaddr,
>                 *(uprobe_opcode_t *)dst = __BUG_INSN_32;
>         }
>
> +       flush_icache_range((unsigned long)dst, (unsigned long)dst + len);
>         kunmap_atomic(kaddr);
> -
> -       /*
> -        * We probably need flush_icache_user_page() but it needs vma.
> -        * This should work on most of architectures by default. If
> -        * architecture needs to do something different it can define
> -        * its own version of the function.
> -        */
> -       flush_dcache_page(page);
>  }
>
> base-commit: 1a1d569a75f3ab2923cb62daf356d102e4df2b86
> --
> 2.45.2
>


-- 
Best Regards
 Guo Ren

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ