[pypy-commit] pypy nogil-unsafe-2: (arigo, remi) 'fix' for potential crash

Raemi pypy.commits at gmail.com
Thu Mar 2 11:17:05 EST 2017


Author: Remi Meier <remi.meier at gmail.com>
Branch: nogil-unsafe-2
Changeset: r90492:e32f17803824
Date: 2017-03-02 17:15 +0100
http://bitbucket.org/pypy/pypy/changeset/e32f17803824/

Log:	(arigo, remi) 'fix' for potential crash

diff --git a/rpython/memory/gctransform/shadowstack.py b/rpython/memory/gctransform/shadowstack.py
--- a/rpython/memory/gctransform/shadowstack.py
+++ b/rpython/memory/gctransform/shadowstack.py
@@ -94,6 +94,12 @@
             # XXX: only visit if nursery_free was not NULL
             base = (tl + tl_shadowstack._offset).address[0]
             top = (tl + tl_shadowstack_top._offset).address[0]
+            if base == llmemory.NULL or top == llmemory.NULL:
+                # gctransform/shadowstack.py does not set these two fields
+                # atomically. Hence, if one is still NULL, we don't need to
+                # walk that new thread's shadowstack (XXX: compiler may reorder
+                # without barriers)
+                return
             self.rootstackhook(collect_stack_root, base, top)
         self._walk_thread_stack = walk_thread_stack
 


More information about the pypy-commit mailing list