register. We would set the sc_ps member of struct sigcontext to SSR1
when entering a signal handler, and compare it to PSL_USER in sigreturn(2)
to make sure that the user code didn't set any bits it shouldn't set.
If non-MSR bits are set that comparison would fail and sigreturn(2) would
fail. Fix this by initializing sc_ps to PSL_USER instead of taking its
value from SSR1. On OpenBSD we always run processes with the same MSR
value.
ok deraadt@
-/* $OpenBSD: machdep.c,v 1.67 2021/01/09 13:14:02 kettenis Exp $ */
+/* $OpenBSD: machdep.c,v 1.68 2021/04/15 07:28:37 kettenis Exp $ */
/*
* Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org>
frame.sf_sc.sc_xer = tf->xer;
frame.sf_sc.sc_ctr = tf->ctr;
frame.sf_sc.sc_pc = tf->srr0;
- frame.sf_sc.sc_ps = tf->srr1;
+ frame.sf_sc.sc_ps = PSL_USER;
frame.sf_sc.sc_vrsave = tf->vrsave;
/* Copy the saved FPU state into the frame if necessary. */