Fix some problems for cpu_switch_load_gs. when fault address is at

cpu_switch_load_gs, cpu is in context switch, so don't enable interrupt.
because it is in context switch, it is expected sched_lock was held,
so don't PROC_LOCK(p) and psignal, it is LOR, probably we can
set a P_XSIGBUS like flag in p_sflags, and set TDF_ASTPENDING in
td_flags, in ast(), post a SIGBUS to process if P_XSIGBUS was set.
This commit is contained in:
davidxu 2003-04-22 07:45:47 +00:00
parent b78fdbef61
commit d0165cba28
2 changed files with 14 additions and 2 deletions

View File

@ -224,7 +224,8 @@ trap(frame)
* and we shouldn't enable interrupts while holding a
* spin lock.
*/
if (type != T_PAGEFLT && PCPU_GET(spinlocks) == NULL)
if (type != T_PAGEFLT && PCPU_GET(spinlocks) == NULL &&
frame.tf_eip != (int)cpu_switch_load_gs)
enable_intr();
}
}
@ -483,9 +484,14 @@ trap(frame)
*/
if (frame.tf_eip == (int)cpu_switch_load_gs) {
PCPU_GET(curpcb)->pcb_gs = 0;
printf(
"Process %d has bad %%gs, reset to zero\n",
p->p_pid);
#if 0
PROC_LOCK(p);
psignal(p, SIGBUS);
PROC_UNLOCK(p);
#endif
goto out;
}

View File

@ -224,7 +224,8 @@ trap(frame)
* and we shouldn't enable interrupts while holding a
* spin lock.
*/
if (type != T_PAGEFLT && PCPU_GET(spinlocks) == NULL)
if (type != T_PAGEFLT && PCPU_GET(spinlocks) == NULL &&
frame.tf_eip != (int)cpu_switch_load_gs)
enable_intr();
}
}
@ -483,9 +484,14 @@ trap(frame)
*/
if (frame.tf_eip == (int)cpu_switch_load_gs) {
PCPU_GET(curpcb)->pcb_gs = 0;
printf(
"Process %d has bad %%gs, reset to zero\n",
p->p_pid);
#if 0
PROC_LOCK(p);
psignal(p, SIGBUS);
PROC_UNLOCK(p);
#endif
goto out;
}