From 87d8bad92787a7d5d51d1cb49b4306b8425154dc Mon Sep 17 00:00:00 2001 From: Alastair Bridgewater Date: Fri, 30 Apr 2010 16:53:16 +0000 Subject: [PATCH] 1.0.38.4: Scrub control stack after scavenging on non-x86oid gencgc. * We scavenge the control stack as if it is entirely boxed data, rewriting pointers as necessary. * Stack frames tend to contain uninitialized words, which is fine so long as they are immediate data or valid pointers (they will be counted as live data, so the scavenge may be more conservative than necessary, but this is not an error). * The area beyond the current stack top is not scavenged, as it is not live data. * Cheneygc scrubs the control stack (clears the area beyond the stack top) once it (the control stack) has been scavenged. * Gencgc on non-x86oids (when precise stack scavenging is done) has not been scrubbing the control stack, leading to the possibility of having stale pointers in the active heap area. * Scrubbing the control stack after scavenging it reduces if not eliminates the random GC faults observed on PPC. * All of this explanation probably belongs in a document describing the hows and whys of GC on SBCL, not merely in a commit message. --- NEWS | 3 +++ src/runtime/gencgc.c | 4 ++++ version.lisp-expr | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index e4aeeb0..5d58181 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,9 @@ changes relative to sbcl-1.9.38: * bug fix: linkage-table entries on PPC now no longer overflow their space allocation (potentially causing crashes if they are written out of order). + * bug fix: Scrub control stack after scavenging in gencgc on non-x86oid + platforms, preventing the GC from seeing stale pointers on the control + stack in subsequent GCs (which would, and does, break invariants). changes in sbcl-1.0.38 relative to sbcl-1.0.37: * incompatible change: Thread names are now restricted to SIMPLE-STRINGs diff --git a/src/runtime/gencgc.c b/src/runtime/gencgc.c index 8c61a09..9ce74d4 100644 --- a/src/runtime/gencgc.c +++ b/src/runtime/gencgc.c @@ -3819,6 +3819,10 @@ scavenge_control_stack() control_stack_size = current_control_stack_pointer - control_stack; scavenge(control_stack, control_stack_size); + + /* Scrub the unscavenged control stack space, so that we can't run + * into any stale pointers in a later GC. */ + scrub_control_stack(); } /* Scavenging Interrupt Contexts */ diff --git a/version.lisp-expr b/version.lisp-expr index 184f63e..9582f35 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.38.3" +"1.0.38.4" -- 1.7.10.4