1.0.10.53: fix undefined-alien errors on darwin
authorCyrus Harmon <ch-sbcl@bobobeach.com>
Sun, 21 Oct 2007 23:19:12 +0000 (23:19 +0000)
committerCyrus Harmon <ch-sbcl@bobobeach.com>
Sun, 21 Oct 2007 23:19:12 +0000 (23:19 +0000)
 * the new mach exception handling stuff was checking to see if there
   were two faults on the page by checking the region's protection
   status and bailing out assuming that there were two faults on the
   same page. The problem was that it was following this code path for
   undefined-alien errors (and presumably control-stack-exhausted)
   thereby just resignalling an EXC_BAD_ACCESS, ad infinitum. Moved
   the checks for the page address being undefined_alien_address, or
   the control stack guard pages up before checking the page
   protection.

src/runtime/x86-darwin-os.c
version.lisp-expr

index 97d3999..4983871 100644 (file)
@@ -434,6 +434,25 @@ catch_exception_raise(mach_port_t exception_port,
             ret = KERN_INVALID_RIGHT;
             break;
         }
+        addr = (void*)code_vector[1];
+        /* Undefined alien */
+        if (os_trunc_to_page(addr) == undefined_alien_address) {
+            handler = undefined_alien_handler;
+            break;
+        }
+        /* At stack guard */
+        if (os_trunc_to_page(addr) == CONTROL_STACK_GUARD_PAGE(th)) {
+            protect_control_stack_guard_page_thread(0, th);
+            protect_control_stack_return_guard_page_thread(1, th);
+            handler = control_stack_exhausted_handler;
+            break;
+        }
+        /* Return from stack guard */
+        if (os_trunc_to_page(addr) == CONTROL_STACK_RETURN_GUARD_PAGE(th)) {
+            protect_control_stack_guard_page_thread(1, th);
+            protect_control_stack_return_guard_page_thread(0, th);
+            break;
+        }
         /* Get vm_region info */
         region_addr = (vm_address_t)code_vector[1];
         info_count = VM_REGION_BASIC_INFO_COUNT;
@@ -455,25 +474,6 @@ catch_exception_raise(mach_port_t exception_port,
             ret = KERN_SUCCESS;
             break;
         }
-        addr = (void*)code_vector[1];
-        /* At stack guard */
-        if (os_trunc_to_page(addr) == CONTROL_STACK_GUARD_PAGE(th)) {
-            protect_control_stack_guard_page_thread(0, th);
-            protect_control_stack_return_guard_page_thread(1, th);
-            handler = control_stack_exhausted_handler;
-            break;
-        }
-        /* Return from stack guard */
-        if (os_trunc_to_page(addr) == CONTROL_STACK_RETURN_GUARD_PAGE(th)) {
-            protect_control_stack_guard_page_thread(1, th);
-            protect_control_stack_return_guard_page_thread(0, th);
-            break;
-        }
-        /* Undefined alien */
-        if (os_trunc_to_page(addr) == undefined_alien_address) {
-            handler = undefined_alien_handler;
-            break;
-        }
         /* Regular memory fault */
         handler = memory_fault_handler;
         break;
index c3ab378..f39bf80 100644 (file)
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"1.0.10.52"
+"1.0.10.53"