Improve set_mcontext:
o Don't copy psr verbatim from the user supplied context. Only allow userland to change the processor settings that are part of the user mask.
This commit is contained in:
parent
86f4f6f7b8
commit
0fa2b83829
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=115652
@ -1023,9 +1023,14 @@ int
|
||||
set_mcontext(struct thread *td, const mcontext_t *mc)
|
||||
{
|
||||
struct trapframe *tf;
|
||||
uint64_t psr;
|
||||
|
||||
tf = td->td_frame;
|
||||
/* Only copy the user mask from the new context. */
|
||||
psr = tf->tf_special.psr & ~0x1f;
|
||||
psr |= mc->mc_special.psr & 0x1f;
|
||||
tf->tf_special = mc->mc_special;
|
||||
tf->tf_special.psr = psr;
|
||||
restore_callee_saved(&mc->mc_preserved);
|
||||
restore_callee_saved_fp(&mc->mc_preserved_fp);
|
||||
return (0);
|
||||
|
Loading…
Reference in New Issue
Block a user