[PATCH v2] riscv: Discard vector state on syscalls
Rémi Denis-Courmont
remi at remlab.net
Tue Jun 27 08:06:33 PDT 2023
[Resend with different MTA]
Le 26 juin 2023 19:45:20 GMT+02:00, "Björn Töpel" <bjorn at kernel.org> a écrit :
>Björn Töpel <bjorn at kernel.org> writes:
>
>> From: Björn Töpel <bjorn at rivosinc.com>
>>
>> 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.
>
>A bit of a corner case, but this will make sigreturn syscalls discard
>the vector state as well.
>
>Is that an issue? E.g. a user cannot build userspace context switching
>application. Does arm64 SVE handle sigreturn in a special way?
Isn't sigreturn() supposed to return the status from the arch-dependent
machine state within the siginfo structure, rather than whatever was saved on
sigreturn() syscall entry? That being the case, I think throwing the vector
register bank away on *entry* of sigreturn() is fine as with any other syscall,
but the state must *not* be cleared on syscall exit.
An example usecase would be emulating RVV extensions (on a CPU supporting
baseline RVV 1.0) with a SIGILL handler.
--
Rémi
More information about the linux-riscv
mailing list