From: Nikodemus Siivola Date: Sun, 17 May 2009 18:01:01 +0000 (+0000) Subject: 1.0.28.56: more robust stack frame pointer checking in SB-SPROF X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=81b3f0da68f21a154288ae5428093f8bfb5a5efb;p=sbcl.git 1.0.28.56: more robust stack frame pointer checking in SB-SPROF Foreign code might not have a frame pointer like we expect. Use CONTROL-STACK-POINTER-VALID-P to check it. Patch by Bart Botta. --- diff --git a/NEWS b/NEWS index e97f4a4..f5c7aa9 100644 --- a/NEWS +++ b/NEWS @@ -44,6 +44,8 @@ * improvement: pretty-printing loop has been implemented properly. (thanks to Tobias Rittweiler) * documentation: CLOS slot typechecing policy has been documented. + * bug fix: SB-SPROF could be foiled by foreign code not have a frame + pointer, leading to memory faults. (thanks to Bart Botta) * bug fix: better floating point exception handling on x86/OpenBSD. (thanks to Josh Elsasser) * bug fix: exit status from QUIT when called under --script was lost diff --git a/contrib/sb-sprof/sb-sprof.lisp b/contrib/sb-sprof/sb-sprof.lisp index 3b6aad6..83a4f58 100644 --- a/contrib/sb-sprof/sb-sprof.lisp +++ b/contrib/sb-sprof/sb-sprof.lisp @@ -562,14 +562,11 @@ profiling") (with-alien ((scp (* os-context-t) :local scp)) (let* ((pc-ptr (sb-vm:context-pc scp)) (fp (sb-vm::context-register scp #.sb-vm::ebp-offset))) - ;; For some reason completely bogus small values for the - ;; frame pointer are returned every now and then, leading - ;; to segfaults. Try to avoid these cases. - ;; - ;; FIXME: Do a more thorough sanity check on ebp, or figure - ;; out why this is happening. - ;; -- JES, 2005-01-11 - (when (< fp 4096) + ;; foreign code might not have a useful frame + ;; pointer in ebp/rbp, so make sure it looks + ;; reasonable before walking the stack + (unless (sb-di::control-stack-pointer-valid-p (sb-sys:int-sap fp)) + (record samples pc-ptr) (return-from sigprof-handler nil)) (incf (samples-trace-count samples)) (pushnew self (samples-sampled-threads samples)) diff --git a/version.lisp-expr b/version.lisp-expr index d2a8cb7..da1c770 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.28.55" +"1.0.28.56"