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: <mhng-af57c321-9a96-4098-9eff-5feeccdeb199@palmer-ri-x1c9>
Date: Mon, 31 Mar 2025 11:54:45 -0700 (PDT)
From: Palmer Dabbelt <palmer@...belt.com>
To: Charlie Jenkins <charlie@...osinc.com>
CC: Paul Walmsley <paul.walmsley@...ive.com>, aou@...s.berkeley.edu,
  Alexandre Ghiti <alex@...ti.fr>, klarasmodin@...il.com, linux-riscv@...ts.infradead.org,
  linux-kernel@...r.kernel.org, Charlie Jenkins <charlie@...osinc.com>
Subject:     Re: [PATCH FOR-NEXT] riscv: Add norvc after .option arch in runtime const

On Mon, 31 Mar 2025 11:45:24 PDT (-0700), Charlie Jenkins wrote:
> .option arch clobbers .option norvc. Prevent gas from emitting
> compressed instructions in the runtime const alternative blocks by
> setting .option norvc after .option arch. This issue starts appearing on
> gcc 15, which adds zca to the march.

There's some clunkiness around ".option arch" and ".option rvc".  So 
this might be an assembler bug, but IMO it's sane to just work around it 
in Linux -- at a bare minimum it'll manifest for users, as binutils 
already released (and GCC 15 is just enabling the Kconfig that triggers 
the bug).

> Reported by: Klara Modin <klarasmodin@...il.com>

There shouldn't be a newline here, I'll just drop it.

> Signed-off-by: Charlie Jenkins <charlie@...osinc.com>
> Fixes: a44fb5722199 ("riscv: Add runtime constant support")
> Closes: https://lore.kernel.org/all/cc8f3525-20b7-445b-877b-2add28a160a2@gmail.com/
> ---
>  arch/riscv/include/asm/runtime-const.h | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/arch/riscv/include/asm/runtime-const.h b/arch/riscv/include/asm/runtime-const.h
> index c07d049fdd5d2999c57d8a90e7363829c5462368..451fd76b881152919f22de8f5c56b51171acbf3c 100644
> --- a/arch/riscv/include/asm/runtime-const.h
> +++ b/arch/riscv/include/asm/runtime-const.h
> @@ -56,6 +56,7 @@
>  #define RISCV_RUNTIME_CONST_64_ZBA				\
>  	".option push\n\t"					\
>  	".option arch,+zba\n\t"					\
> +	".option norvc\n\t"					\
>  	"slli	%[__tmp],%[__tmp],32\n\t"			\
>  	"add.uw %[__ret],%[__ret],%[__tmp]\n\t"			\
>  	"nop\n\t"						\
> @@ -65,6 +66,7 @@
>  #define RISCV_RUNTIME_CONST_64_ZBKB				\
>  	".option push\n\t"					\
>  	".option arch,+zbkb\n\t"				\
> +	".option norvc\n\t"					\
>  	"pack	%[__ret],%[__ret],%[__tmp]\n\t"			\
>  	"nop\n\t"						\
>  	"nop\n\t"						\
>
> ---
> base-commit: b2117b630c48be69d2782ed79fefe35dcd192ce6
> change-id: 20250331-fix_runtime_const_norvc-407af1f24541

Thanks!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ