Subject: FPU and signal delivery
To: Emmanuel Dreyfus <manu@netbsd.org>
From: Stephen Ma <stephenm@employees.org>
List: port-mips
Date: 04/12/2002 07:58:41
>>>>> "Emmanuel" == Emmanuel Dreyfus <manu@netbsd.org> writes:

Emmanuel> Hi!  One more question on signal delivery: we use a
Emmanuel> sc_fpused field in struct sigcontext to remeber if we must
Emmanuel> call savefpregs/loadfpregs. Why is this needed? We also save
Emmanuel> these registers in struct sigcontext.

As far as I can tell, it's used to avoid saving/loading the FP
registers when unnecessary - if that's not a major concern, you should
be able to unconditionally copy the fpregs from the process struct to
the sigcontext and back again.

Emmanuel> In the Linux version of sigreturn, I saved an restored SR,
Emmanuel> CAUSE and BADVADDR (because those fields exists in the
Emmanuel> sigcontext structure). We do not handle them in NetBSD,
Emmanuel> hence I now suspect this introduce security holes: is it
Emmanuel> safe to let the process modifying the saved SR?

The CAUSE and BADVADDR registers are not restored on return to
user-mode, so saving those registers is mostly harmless. SR should not
be modifiable from user-mode code, since that's the register that
controls whether the system is in user-mode or kernel mode.

- S