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:
parent
b78fdbef61
commit
d0165cba28
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user