diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2023-02-25 16:11:00 +0100 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2023-02-25 16:11:00 +0100 |
| commit | 5a7761c294f2ac0b703027bede709025e90b13e2 (patch) | |
| tree | dcb40b6007104b535b523b3197e272b1ff7ac853 /src/libtools | |
| parent | ad332494d01897f876ab6b326cf895c9c9389ca9 (diff) | |
| download | box64-5a7761c294f2ac0b703027bede709025e90b13e2.tar.gz box64-5a7761c294f2ac0b703027bede709025e90b13e2.zip | |
Try to improved the Workaround, to make it more generic
Diffstat (limited to 'src/libtools')
| -rwxr-xr-x | src/libtools/signals.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libtools/signals.c b/src/libtools/signals.c index f72f6121..98062054 100755 --- a/src/libtools/signals.c +++ b/src/libtools/signals.c @@ -853,9 +853,14 @@ void my_box64signalhandler(int32_t sig, siginfo_t* info, void * ucntx) CancelBlock64(0); cancelFillBlock(); // Segfault inside a Fillblock, cancel it's creation... } + // try to see if the si_code makes sense + if((sig==SIGSEGV) && (addr) && (info->si_code == 1) && prot&(PROT_READ|PROT_WRITE|PROT_EXEC)) { + printf_log(LOG_DEBUG, "Workaround for suspicious si_code for %p / prot=0x%x\n", addr, prot); + info->si_code = 2; + } dynablock_t* db = NULL; int db_searched = 0; - if ((sig==SIGSEGV) && (addr) && /*(info->si_code == SEGV_ACCERR) &&*/ (prot&PROT_DYNAREC)) { + 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); |