axeld + bonefish:

Certain interrupts don't disable interrupts. We were calling 
x86_{push,pop}_iframe() without specifically disabling them, thus causing 
a race condition with could cause the iframe stack to be invalid. This 
could cause all kinds of problems.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21784 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2007-08-02 02:48:11 +00:00
parent e786c1d6a9
commit 6b7bedcbee
+7 -1
View File
@@ -355,10 +355,13 @@ i386_handle_trap(struct iframe frame)
{
struct thread *thread = thread_get_current_thread();
int ret = B_HANDLED_INTERRUPT;
cpu_status state;
// all exceptions besides 3 (breakpoint), and 99 (syscall) enter this
// function with interrupts disabled
state = disable_interrupts();
if (thread)
x86_push_iframe(&thread->arch_info.iframes, &frame);
else
@@ -369,6 +372,8 @@ i386_handle_trap(struct iframe frame)
thread_at_kernel_entry();
}
restore_interrupts(state);
// if(frame.vector != 0x20)
// dprintf("i386_handle_trap: vector 0x%x, ip 0x%x, cpu %d\n", frame.vector, frame.eip, smp_get_current_cpu());
@@ -457,7 +462,6 @@ i386_handle_trap(struct iframe frame)
if (kernelDebugger) {
// if this thread has a fault handler, we're allowed to be here
struct thread *thread = thread_get_current_thread();
if (thread && thread->fault_handler != NULL) {
frame.eip = thread->fault_handler;
break;
@@ -589,6 +593,8 @@ i386_handle_trap(struct iframe frame)
// dprintf("0x%x cpu %d!\n", thread_get_current_thread_id(), smp_get_current_cpu());
disable_interrupts();
if (thread)
x86_pop_iframe(&thread->arch_info.iframes);
else