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] [day] [month] [year] [list]
Message-ID: <970a2116-58d2-466f-8a3e-f1b9e99ccf9b@ghiti.fr>
Date: Thu, 17 Jul 2025 09:38:12 +0200
From: Alexandre Ghiti <alex@...ti.fr>
To: Pu Lehui <pulehui@...weicloud.com>, linux-riscv@...ts.infradead.org,
 linux-kernel@...r.kernel.org
Cc: Palmer Dabbelt <palmer@...belt.com>, Pu Lehui <pulehui@...wei.com>
Subject: Re: [PATCH -next] riscv: Enable ARCH_HAVE_NMI_SAFE_CMPXCHG

Hi Pu,

On 7/11/25 11:04, Pu Lehui wrote:
> From: Pu Lehui <pulehui@...wei.com>
>
> The implement of cmpxchg() in riscv is based on atomic primitives and
> has NMI-safe features, so it can be used safely in the in_nmi context.
> ftrace's ringbuffer relies on NMI-safe cmpxchg() in the NMI context.
> Currently, in_nmi() is true when riscv kprobe is in trap-based mode, so
> this config needs to be selected, otherwise kprobetrace will not be
> available.
>
> Signed-off-by: Pu Lehui <pulehui@...wei.com>
> ---
>   arch/riscv/Kconfig | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> index 36061f4732b7..0e2dfa98338a 100644
> --- a/arch/riscv/Kconfig
> +++ b/arch/riscv/Kconfig
> @@ -23,6 +23,7 @@ config RISCV
>   	select ARCH_ENABLE_MEMORY_HOTREMOVE if MEMORY_HOTPLUG
>   	select ARCH_ENABLE_SPLIT_PMD_PTLOCK if PGTABLE_LEVELS > 2
>   	select ARCH_ENABLE_THP_MIGRATION if TRANSPARENT_HUGEPAGE
> +	select ARCH_HAVE_NMI_SAFE_CMPXCHG
>   	select ARCH_HAS_BINFMT_FLAT
>   	select ARCH_HAS_CRC32 if RISCV_ISA_ZBC
>   	select ARCH_HAS_CRC64 if 64BIT && RISCV_ISA_ZBC


Given the definition of ARCH_HAVE_NMI_SAFE_CMPXCHG in commit 
df013ffb8119 ("Add Kconfig option ARCH_HAVE_NMI_SAFE_CMPXCHG"), we can 
indeed enable this config, so:

Reviewed-by: Alexandre Ghiti <alexghiti@...osinc.com>

And I followed your instructions in your answer, it works as you 
presented so:

Tested-by: Alexandre Ghiti <alexghiti@...osinc.com>

I'll send this as part of my 6.17 PR.

Thanks,

Alex


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ