Author: andrew Date: Wed Oct 30 14:05:50 2019 New Revision: 354179 URL: https://svnweb.freebsd.org/changeset/base/354179
Log: Allow exceptions to be masked when in userspace We may want to mask exceptions when in userspace. This was previously impossible as threads are created with all exceptions unmasked and signals expected userspace to mask any. Fix these by copying the mask state on thread creation and allow exceptions to be masked on signal return, as long as they don't change. Sponsored by: DARPA, AFRL Modified: head/sys/arm64/arm64/machdep.c head/sys/arm64/arm64/vm_machdep.c head/sys/arm64/include/armreg.h Modified: head/sys/arm64/arm64/machdep.c ============================================================================== --- head/sys/arm64/arm64/machdep.c Wed Oct 30 13:45:40 2019 (r354178) +++ head/sys/arm64/arm64/machdep.c Wed Oct 30 14:05:50 2019 (r354179) @@ -441,7 +441,8 @@ set_mcontext(struct thread *td, mcontext_t *mcp) spsr = mcp->mc_gpregs.gp_spsr; if ((spsr & PSR_M_MASK) != PSR_M_EL0t || - (spsr & (PSR_AARCH32 | PSR_F | PSR_I | PSR_A | PSR_D)) != 0) + (spsr & PSR_AARCH32) != 0 || + (spsr & PSR_DAIF) != (td->td_frame->tf_spsr & PSR_DAIF)) return (EINVAL); memcpy(tf->tf_x, mcp->mc_gpregs.gp_x, sizeof(tf->tf_x)); Modified: head/sys/arm64/arm64/vm_machdep.c ============================================================================== --- head/sys/arm64/arm64/vm_machdep.c Wed Oct 30 13:45:40 2019 (r354178) +++ head/sys/arm64/arm64/vm_machdep.c Wed Oct 30 14:05:50 2019 (r354179) @@ -98,7 +98,7 @@ cpu_fork(struct thread *td1, struct proc *p2, struct t bcopy(td1->td_frame, tf, sizeof(*tf)); tf->tf_x[0] = 0; tf->tf_x[1] = 0; - tf->tf_spsr = td1->td_frame->tf_spsr & PSR_M_32; + tf->tf_spsr = td1->td_frame->tf_spsr & (PSR_M_32 | PSR_DAIF); td2->td_frame = tf; Modified: head/sys/arm64/include/armreg.h ============================================================================== --- head/sys/arm64/include/armreg.h Wed Oct 30 13:45:40 2019 (r354178) +++ head/sys/arm64/include/armreg.h Wed Oct 30 14:05:50 2019 (r354179) @@ -608,6 +608,7 @@ #define PSR_I 0x00000080 #define PSR_A 0x00000100 #define PSR_D 0x00000200 +#define PSR_DAIF (PSR_D | PSR_A | PSR_I | PSR_F) #define PSR_IL 0x00100000 #define PSR_SS 0x00200000 #define PSR_V 0x10000000 _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"