linux/arch/riscv/kernel/vdso
Nathan Chancellor eb13a1ff27 random: vDSO: avoid call to memset() when zeroing reserved parameter
After a recent change in LLVM [1], builds with the random vDSO
implementation, such as PowerPC and RISC-V, fail when checking the vDSO:

  arch/powerpc/kernel/vdso/vdso32.so.dbg: dynamic relocations are not supported
  arch/riscv/kernel/vdso/vdso.so.dbg: dynamic relocations are not supported

memset() is now generated when zeroing params->reserved for some builds
because LLVM has an optimization (now run in more instances) that can
recognize at compile time when it is assigning a static value to a
contiguous area of memory and turn that into a call to memset(). Both
clang and GCC assume memset() is always available [2].

Clang has an internal fiddly hook, -max-store-memset, which we can set
to a high number, to disable generating out of line memset calls [3].
Similarly, GCC has -finline-stringops=memset to do the same [4], should
this issue ever hit future version of GCC. While these options wouldn't
make sense for normal kernel code, it is fine for the extremely limited
and intentionally compact vDSO code.

Link: 90cebef141 [1]
Link: https://gcc.gnu.org/onlinedocs/gcc-16.2.0/gcc/Standards.html#index-ffreestanding [2]
Link: b28eeb28be [3]
Link: https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#index-finline-stringops [4]
Closes: https://github.com/ClangBuiltLinux/linux/issues/2183
Cc: stable@vger.kernel.org # v6.12+
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2026-10-02 12:12:13 +02:00
..
.gitignore RISC-V: Fix the VDSO symbol generaton for binutils-2.35+ 2020-11-06 00:03:48 -08:00
flush_icache.S arch/riscv: compile vdso with landing pad and shadow stack note 2026-01-29 02:38:40 -07:00
gen_vdso_offsets.sh arch/riscv: add dual vdso creation logic and select vdso based on hw 2026-01-29 02:38:40 -07:00
getcpu.S arch/riscv: compile vdso with landing pad and shadow stack note 2026-01-29 02:38:40 -07:00
getrandom.c RISC-V: vDSO: Wire up getrandom() vDSO implementation 2025-06-05 14:03:09 -07:00
hwprobe.c Revert "riscv: hwprobe: Fix stale vDSO data for late-initialized keys at boot" 2026-08-07 19:24:30 -06:00
Makefile random: vDSO: avoid call to memset() when zeroing reserved parameter 2026-10-02 12:12:13 +02:00
note.S riscv: Add build salt to the vDSO 2026-06-25 12:05:05 -06:00
rt_sigreturn.S arch/riscv: vdso: remove CFI landing pad from rt_sigreturn 2026-07-14 19:34:38 -06:00
sys_hwprobe.S arch/riscv: compile vdso with landing pad and shadow stack note 2026-01-29 02:38:40 -07:00
vdso.lds.S riscv: vdso: Add symbols for the alternative section boundaries 2026-08-07 19:24:33 -06:00
vdso.S riscv: compat: vdso: Add COMPAT_VDSO base code implementation 2022-04-26 13:36:53 -07:00
vgetrandom-chacha.S arch/riscv: compile vdso with landing pad and shadow stack note 2026-01-29 02:38:40 -07:00
vgettimeofday.c arch: vdso: consolidate gettime prototypes 2023-11-23 11:32:32 +01:00