about summary refs log tree commit diff stats
path: root/src/libtools
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2023-02-20 21:30:22 +0100
committerptitSeb <sebastien.chev@gmail.com>2023-02-20 21:30:22 +0100
commitbfef8c9bbe8a16373742cb9c9e5691b93e994f58 (patch)
tree246b21e67025f3159006efd04f78fc6e4ec696bf /src/libtools
parent42b83789880c300711f08e3852784e17cafaf7ac (diff)
parent3fe2843bb3b95d8edd63d21c4f6acad7f652be91 (diff)
downloadbox64-bfef8c9bbe8a16373742cb9c9e5691b93e994f58.tar.gz
box64-bfef8c9bbe8a16373742cb9c9e5691b93e994f58.zip
Merge branch 'main' into steam_chrome
Diffstat (limited to 'src/libtools')
-rwxr-xr-xsrc/libtools/signals.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libtools/signals.c b/src/libtools/signals.c
index ffe36ea6..92ab59ef 100755
--- a/src/libtools/signals.c
+++ b/src/libtools/signals.c
@@ -855,7 +855,7 @@ void my_box64signalhandler(int32_t sig, siginfo_t* info, void * ucntx)
     }
     dynablock_t* db = NULL;
     int db_searched = 0;
-    if ((sig==SIGSEGV) && (addr) && (info->si_code == SEGV_ACCERR) && (prot&PROT_DYN)) {
+    if ((sig==SIGSEGV) && (addr) && (info->si_code == SEGV_ACCERR) && (prot&PROT_DYNAREC)) {
         mutex_lock(&mutex_dynarec_prot);
         // check if SMC inside block
         db = FindDynablockFromNativeAddress(pc);
@@ -966,6 +966,9 @@ dynarec_log(/*LOG_DEBUG*/LOG_INFO, "Repeated SIGSEGV with Access error on %p for
             glitch2_prot = 0;
         }
         mutex_unlock(&mutex_dynarec_prot);
+    } else if ((sig==SIGSEGV) && (addr) && (info->si_code == SEGV_ACCERR) && (prot&PROT_DYNAREC_R)) {
+        // unprotect and continue to signal handler, because Write is not there on purpose
+        unprotectDB((uintptr_t)addr, 1, 1);    // unprotect 1 byte... But then, the whole page will be unprotected
     }
     if(!db_searched)
         db = FindDynablockFromNativeAddress(pc);