about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2024-07-13 11:35:42 +0200
committerptitSeb <sebastien.chev@gmail.com>2024-07-13 11:35:42 +0200
commit98270a86016d537e343f516444e6a893e1e52b7f (patch)
tree21998bb1a1a82a4a4c7ef3b6d5f2df9bfd91ca40 /src
parent182ca255f70695de53e11e7286a9ef32df95aebe (diff)
downloadbox64-98270a86016d537e343f516444e6a893e1e52b7f.tar.gz
box64-98270a86016d537e343f516444e6a893e1e52b7f.zip
Fix signal stack handling on reentrant signal when using SigAltStack
Diffstat (limited to 'src')
-rw-r--r--src/libtools/signals.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/libtools/signals.c b/src/libtools/signals.c
index 265e79bb..b57c522b 100644
--- a/src/libtools/signals.c
+++ b/src/libtools/signals.c
@@ -975,7 +975,7 @@ void my_sigactionhandler_oldcode(int32_t sig, int simple, siginfo_t* info, void
     int used_stack = 0;
     if(new_ss) {
         if(new_ss->ss_flags == SS_ONSTACK) { // already using it!
-            frame = ((uintptr_t)emu->regs[_SP].q[0] - 200) & 0x0f;
+            frame = ((uintptr_t)emu->regs[_SP].q[0] - 128) & ~0x0f;
         } else {
             frame = (uintptr_t)(((uintptr_t)new_ss->ss_sp + new_ss->ss_size - 16) & ~0x0f);
             used_stack = 1;
@@ -1269,8 +1269,6 @@ void my_sigactionhandler_oldcode(int32_t sig, int simple, siginfo_t* info, void
             printf_log(LOG_DEBUG, "Context has been changed in Sigactionhanlder, doing siglongjmp to resume emu at %p, RSP=%p\n", (void*)R_RIP, (void*)R_RSP);
             if(old_code)
                 *old_code = -1;    // re-init the value to allow another segfault at the same place
-            if(used_stack)  // release stack
-                new_ss->ss_flags = 0;
             //relockMutex(Locks);   // do not relock mutex, because of the siglongjmp, whatever was running is canceled
             #ifdef DYNAREC
             if(Locks & is_dyndump_locked)