From 1e7c541b2f332daf5fb1c35a0b3f7d15cd0e36bc Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Sat, 22 Sep 2018 17:31:14 +0200 Subject: [PATCH] Fix case where running abort hook could trash registers * libguile/vm-engine.c (abort): If the abort doesn't need to longjmp and the abort hook was enabled, cache registers first to avoid restoring a bad IP to the VM. --- libguile/vm-engine.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libguile/vm-engine.c b/libguile/vm-engine.c index 4e0ef77ec..542cac413 100644 --- a/libguile/vm-engine.c +++ b/libguile/vm-engine.c @@ -1118,14 +1118,17 @@ VM_NAME (scm_thread *thread) intervening C frames to jump over, so we just continue directly. */ + CACHE_REGISTER (); ABORT_HOOK (); #if ENABLE_JIT if (mcode && !VP->disable_mcode) - scm_jit_enter_mcode (thread, mcode); + { + scm_jit_enter_mcode (thread, mcode); + CACHE_REGISTER (); + } #endif - CACHE_REGISTER (); NEXT (0); }