Skip to content
Unverified Commit 9657e9b7 authored by Björn Töpel's avatar Björn Töpel Committed by Palmer Dabbelt
Browse files

riscv: Discard vector state on syscalls

The RISC-V vector specification states:
  Executing a system call causes all caller-saved vector registers
  (v0-v31, vl, vtype) and vstart to become unspecified.

The vector registers are set to all 1s, vill is set (invalid), and the
vector status is set to Dirty.

That way we can prevent userspace from accidentally relying on the
stated save.

Rémi pointed out [1] that writing to the registers might be
superfluous, and setting vill is sufficient.

Link: https://lore.kernel.org/linux-riscv/12784326.9UPPK3MAeB@basile.remlab.net/

 # [1]
Suggested-by: default avatarDarius Rad <darius@bluespec.com>
Suggested-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
Suggested-by: default avatarRémi Denis-Courmont <remi@remlab.net>
Signed-off-by: default avatarBjörn Töpel <bjorn@rivosinc.com>
Link: https://lore.kernel.org/r/20230629142228.1125715-1-bjorn@kernel.org


Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
parent 85fadc0d
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment