From: Cyrus Harmon Date: Sun, 21 Oct 2007 23:19:12 +0000 (+0000) Subject: 1.0.10.53: fix undefined-alien errors on darwin X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=9772cd388bb89a311aa1d205359b421d9d12a3ff;p=sbcl.git 1.0.10.53: fix undefined-alien errors on darwin * 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. --- diff --git a/src/runtime/x86-darwin-os.c b/src/runtime/x86-darwin-os.c index 97d3999..4983871 100644 --- a/src/runtime/x86-darwin-os.c +++ b/src/runtime/x86-darwin-os.c @@ -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; diff --git a/version.lisp-expr b/version.lisp-expr index c3ab378..f39bf80 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -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"