Index: sys/kern/kern_sig.c =================================================================== --- sys/kern/kern_sig.c +++ sys/kern/kern_sig.c @@ -65,6 +65,7 @@ #include #include #include +#include #include #include #include @@ -1320,6 +1321,14 @@ error = 0; } } + + /* + * If PTRACE_SCE or PTRACE_SCX were set after + * userspace entered the syscall, return spurious + * EINTR. + */ + if (error == 0 && (p->p_ptevents & PTRACE_SYSCALL) != 0) + error = EINTR; } new_block = saved_mask; @@ -1532,6 +1541,14 @@ has_sig += postsig(sig); } mtx_unlock(&p->p_sigacts->ps_mtx); + + /* + * If PTRACE_SCE or PTRACE_SCX were set after + * userspace entered the syscall, return spurious + * EINTR. + */ + if ((p->p_ptevents & PTRACE_SYSCALL) != 0) + has_sig += 1; } PROC_UNLOCK(p); td->td_errno = EINTR;