[PATCH] riscv: fpu: refine FPU save flow
Vivian Wang
wangruikang at iscas.ac.cn
Mon Feb 9 00:34:30 PST 2026
On 2/5/26 13:53, Hui Min Mina Chou wrote:
> From: Charles Ci-Jyun Wu <dminus at andestech.com>
>
> When Kernel first time run to arch_dup_task_struct(),
> it will check if sstatus.FS is dirty. If it is dirty,
> then it will do FPU save flow. But this field is
> floating currently. Meanwhile if the combination between
> platform(HW) and Kernel(SW) about FPU configuration
> is mismatch. eq: The platform is without FPU and Kernel
> is with FPU. Then Kernel may trigger illegal instruction
> here.
This doesn't really make sense. fstate_save checks for ((regs->status &
SR_FS) == SR_FS_DIRTY). Do you mean that a platform can be !has_fpu(),
yet come up with a task_pt_regs(...)->status that's SR_FS?
Do you have some reproduction steps on how this bug can be triggered?
QEMU should support disabling F/D.
If by "floating" you mean task_pt_regs(src)->status is uninitialized
somehow, that's the bug that needs to be fixed. Adding a band-aid here
just confuses everyone without addressing the problem.
Vivian "dramforever" Wang
More information about the linux-riscv
mailing list