Author: Armin Rigo <[email protected]>
Branch:
Changeset: r91420:530b46ef1b95
Date: 2017-05-27 12:06 +0200
http://bitbucket.org/pypy/pypy/changeset/530b46ef1b95/
Log: Fix a rare stacklet issue that was there since a while with
shadowstack. This is basically the same as b2569cf1bd55 was for
threads.
diff --git a/rpython/memory/gctransform/framework.py
b/rpython/memory/gctransform/framework.py
--- a/rpython/memory/gctransform/framework.py
+++ b/rpython/memory/gctransform/framework.py
@@ -925,6 +925,10 @@
def gct_gc_adr_of_root_stack_top(self, hop):
self._gc_adr_of_gcdata_attr(hop, 'root_stack_top')
+ def gct_gc_modified_shadowstack(self, hop):
+ # for stacklet
+ hop.genop("direct_call",
[self.root_walker.gc_modified_shadowstack_ptr])
+
def gct_gc_detach_callback_pieces(self, hop):
op = hop.spaceop
assert len(op.args) == 0
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
@@ -245,6 +245,13 @@
from rpython.rlib import _stacklet_shadowstack
_stacklet_shadowstack.complete_destrptr(gctransformer)
+ gcdata = self.gcdata
+ def gc_modified_shadowstack():
+ gcdata.can_look_at_partial_stack = False
+
+ self.gc_modified_shadowstack_ptr = getfn(gc_modified_shadowstack,
+ [], annmodel.s_None)
+
def postprocess_graph(self, gct, graph, any_inlining):
from rpython.memory.gctransform import shadowcolor
if any_inlining:
diff --git a/rpython/rlib/_stacklet_shadowstack.py
b/rpython/rlib/_stacklet_shadowstack.py
--- a/rpython/rlib/_stacklet_shadowstack.py
+++ b/rpython/rlib/_stacklet_shadowstack.py
@@ -77,6 +77,7 @@
llmemory.raw_memcopy(sscopy + SIZEADDR, base, length_bytes)
llop.gc_adr_of_root_stack_top(llmemory.Address).address[0] = (
base + length_bytes)
+ llop.gc_modified_shadowstack(lltype.Void)
llmemory.raw_free(sscopy)
def alloc_stacklet():
diff --git a/rpython/rtyper/lltypesystem/lloperation.py
b/rpython/rtyper/lltypesystem/lloperation.py
--- a/rpython/rtyper/lltypesystem/lloperation.py
+++ b/rpython/rtyper/lltypesystem/lloperation.py
@@ -515,6 +515,7 @@
'gc_adr_of_root_stack_base': LLOp(),
'gc_adr_of_root_stack_top': LLOp(),
# returns the address of gcdata.root_stack_base/top (for shadowstack only)
+ 'gc_modified_shadowstack': LLOp(),
# for asmgcroot support to get the address of various static structures
# see translator/c/src/mem.h for the valid indices
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit