Author: Remi Meier <remi.me...@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
 
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to