From 98270a86016d537e343f516444e6a893e1e52b7f Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Sat, 13 Jul 2024 11:35:42 +0200 Subject: Fix signal stack handling on reentrant signal when using SigAltStack --- src/libtools/signals.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src') 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) -- cgit 1.4.1