linux/arch/riscv/kernel/vdso
Deepak Gupta ccad8c1336 arch/riscv: add dual vdso creation logic and select vdso based on hw
Shadow stack instructions are taken from the Zimop ISA extension,
which is mandated on RVA23. Any userspace with shadow stack
instructions in it will fault on hardware that doesn't have support
for Zimop.  Thus, a shadow stack-enabled userspace can't be run on
hardware that doesn't support Zimop.

It's not known how Linux userspace providers will respond to this kind
of binary fragmentation.  In order to keep kernel portable across
different hardware, 'arch/riscv/kernel/vdso_cfi' is created which has
Makefile logic to compile 'arch/riscv/kernel/vdso' sources with CFI
flags, and 'arch/riscv/kernel/vdso.c' is modified to select the
appropriate vdso depending on whether the underlying CPU implements
the Zimop extension. Since the offset of vdso symbols will change due
to having two different vdso binaries, there is added logic to include
a new generated vdso offset header and dynamically select the offset
(like for rt_sigreturn).

Signed-off-by: Deepak Gupta <debug@rivosinc.com>
Acked-by: Charles Mirabile <cmirabil@redhat.com>
Tested-by: Andreas Korb <andreas.korb@aisec.fraunhofer.de> # QEMU, custom CVA6
Tested-by: Valentin Haudiquet <valentin.haudiquet@canonical.com>
Link: https://patch.msgid.link/20251112-v5_user_cfi_series-v23-24-b55691eacf4f@rivosinc.com
[pjw@kernel.org: cleaned up patch description]
Signed-off-by: Paul Walmsley <pjw@kernel.org>
2026-01-29 02:38:40 -07: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 riscv: hwprobe: Fix stale vDSO data for late-initialized keys at boot 2025-10-17 22:23:11 -06:00
Makefile arch/riscv: add dual vdso creation logic and select vdso based on hw 2026-01-29 02:38:40 -07:00
note.S arch/riscv: compile vdso with landing pad and shadow stack note 2026-01-29 02:38:40 -07:00
rt_sigreturn.S arch/riscv: compile vdso with landing pad and shadow stack note 2026-01-29 02:38:40 -07: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: Exclude .rodata from the PT_DYNAMIC segment 2025-06-10 13:06:48 -07: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