[pypy-commit] stmgc c7-refactor: In case of abort, restore explicitly the position of the shadowstack.

arigo noreply at buildbot.pypy.org
Wed Feb 19 10:41:31 CET 2014


Author: Armin Rigo <arigo at tunes.org>
Branch: c7-refactor
Changeset: r778:44b81083d7cf
Date: 2014-02-19 10:41 +0100
http://bitbucket.org/pypy/stmgc/changeset/44b81083d7cf/

Log:	In case of abort, restore explicitly the position of the
	shadowstack.

diff --git a/c7/stm/core.c b/c7/stm/core.c
--- a/c7/stm/core.c
+++ b/c7/stm/core.c
@@ -119,6 +119,7 @@
     STM_PSEGMENT->transaction_state = (jmpbuf != NULL ? TS_REGULAR
                                                       : TS_INEVITABLE);
     STM_SEGMENT->jmpbuf_ptr = jmpbuf;
+    STM_PSEGMENT->shadowstack_at_start_of_transaction = tl->shadowstack;
 
     mutex_unlock();
 
@@ -330,6 +331,7 @@
 
     stm_jmpbuf_t *jmpbuf_ptr = STM_SEGMENT->jmpbuf_ptr;
     stm_thread_local_t *tl = STM_SEGMENT->running_thread;
+    tl->shadowstack = STM_PSEGMENT->shadowstack_at_start_of_transaction;
     release_thread_segment(tl);
     STM_PSEGMENT->safe_point = SP_NO_TRANSACTION;
     STM_PSEGMENT->transaction_state = TS_NONE;
diff --git a/c7/stm/core.h b/c7/stm/core.h
--- a/c7/stm/core.h
+++ b/c7/stm/core.h
@@ -63,6 +63,7 @@
     uint8_t safe_point;         /* one of the SP_xxx constants */
     uint8_t transaction_state;  /* one of the TS_xxx constants */
     uintptr_t real_nursery_section_end;
+    object_t **shadowstack_at_start_of_transaction;
 };
 
 enum {


More information about the pypy-commit mailing list