don't return directly to copyin and friends when we hit certain types of faults

this fixes the unkillable syscall in stress2
This commit is contained in:
Kip Macy 2006-12-16 02:40:19 +00:00
parent 1364a812e7
commit 5bd2c4e059
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=165266

View File

@ -239,7 +239,6 @@ SYSCTL_INT(_debug, OID_AUTO, debugger_on_signal, CTLFLAG_RW,
&debugger_on_signal, 0, "");
#endif
void
trap_init(void)
{
@ -320,6 +319,21 @@ trap(struct trapframe *tf, int64_t type, uint64_t data)
case T_MEM_ADDRESS_NOT_ALIGNED:
printf("bad trap trapno=%ld data=0x%lx pc=0x%lx\n",
trapno, data, tf->tf_tpc);
if (tf->tf_tpc >= (u_long)copy_nofault_begin &&
tf->tf_tpc <= (u_long)copy_nofault_end) {
tf->tf_tpc = (u_long)copy_fault;
tf->tf_tnpc = tf->tf_tpc + 4;
sig = 0;
break;
}
if (tf->tf_tpc >= (u_long)fs_nofault_begin &&
tf->tf_tpc <= (u_long)fs_nofault_end) {
tf->tf_tpc = (u_long)fs_fault;
tf->tf_tnpc = tf->tf_tpc + 4;
sig = 0;
break;
}
addr = data;
sig = trap_sig[trapno];
break;
@ -343,8 +357,8 @@ trap(struct trapframe *tf, int64_t type, uint64_t data)
kdb_enter("trapsig");
#ifdef VERBOSE
if (sig == 4 || sig == 10 || sig == 11)
printf("trap: %ld:%s: 0x%lx at 0x%lx on cpu=%d sig=%d\n", trapno,
trap_msg[trapno], data, tf->tf_tpc, curcpu, sig);
printf("trap: %ld:%s: 0x%lx at 0x%lx on cpu=%d sig=%d proc=%s\n",
trapno, trap_msg[trapno], data, tf->tf_tpc, curcpu, sig, curthread->td_proc->p_comm);
#endif
/* XXX I've renumbered the traps to largely reflect what the hardware uses
* so this will need to be re-visited