From 1e749beb2e84401344337b2f3865f156a667d946 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Sat, 9 Nov 2024 09:53:48 +0100 Subject: [PATCH] Added BOX86_NOCRASHHANDLER to ignore crashhandler.so (for #1012) --- docs/USAGE.md | 5 +++++ src/include/debug.h | 1 + src/librarian/library.c | 9 +++++++++ src/main.c | 10 ++++++++++ src/tools/rcfile.c | 1 + system/box86.box86rc | 1 + 6 files changed, 27 insertions(+) diff --git a/docs/USAGE.md b/docs/USAGE.md index 2204e2170..423be8ddf 100755 --- a/docs/USAGE.md +++ b/docs/USAGE.md @@ -275,6 +275,11 @@ Disables the load of vulkan libraries. * 0 : Load vulkan libraries if found. * 1 : Disables the load of vulkan libraries, both the native and the i386 version (can be useful on Pi4, where the vulkan driver is not quite there yet.) +#### BOX86_NOCRASHHANDLER * +Diables crashhandler.so +* 0 : Regular process for crashhandler.so (Default) +* 1 : Do not load crashhandler.so, even if present + #### BOX86_FUTEX_WAITV * Use of the new fuext_waitc syscall * 0 : Do not try to use it, return unsupported (Default for BAD_SIGNAL build) diff --git a/src/include/debug.h b/src/include/debug.h index 50a179cbc..7dd0d88a2 100755 --- a/src/include/debug.h +++ b/src/include/debug.h @@ -61,6 +61,7 @@ extern int box86_musl; extern int box86_nopulse; // disabling the use of wrapped pulseaudio extern int box86_nogtk; // disabling the use of wrapped gtk extern int box86_novulkan; // disabling the use of wrapped vulkan +extern int box86_nocrashhandler; extern int box86_futex_waitv; extern int box86_mapclean; extern int box86_showsegv; diff --git a/src/librarian/library.c b/src/librarian/library.c index 2bd7945aa..dc2717579 100755 --- a/src/librarian/library.c +++ b/src/librarian/library.c @@ -452,6 +452,15 @@ library_t *NewLibrary(const char* path, box86context_t* context, elfheader_t* ve return NULL; } } + if(box86_nocrashhandler) { + if(strstr(lib->name, "crashhandler.so")==lib->name) { + box_free(lib->name); + box_free(lib->path); + initDummyLib(lib); + //box_free(lib); + return NULL; + } + } int notwrapped = FindInCollection(lib->name, &context->box86_emulated_libs); int essential = isEssentialLib(lib->name); if(!notwrapped && box86_prefer_emulated && !essential) diff --git a/src/main.c b/src/main.c index 802652b58..f773cdc08 100644 --- a/src/main.c +++ b/src/main.c @@ -131,6 +131,7 @@ int box86_musl = 0; int box86_nopulse = 0; int box86_nogtk = 0; int box86_novulkan = 0; +int box86_nocrashhandler = 0; #ifdef BAD_SIGNAL int box86_futex_waitv = 0; #else @@ -573,6 +574,15 @@ void LoadLogEnv() if(!box86_libcef) printf_log(LOG_INFO, "Dynarec will not detect libcef\n"); } + p = getenv("BOX86_NOCRASHHANDLER"); + if(p) { + if(strlen(p)==1) { + if(p[0]>='0' && p[0]<='1') + box86_nocrashhandler = p[0]-'0'; + } + if(box86_nocrashhandler) + printf_log(LOG_INFO, "Box86 will consider crashhnadler.so to not be present\n"); + } p = getenv("BOX86_SDL2_JGUID"); if(p) { if(strlen(p)==1) { diff --git a/src/tools/rcfile.c b/src/tools/rcfile.c index 8be6c16db..e478ef506 100644 --- a/src/tools/rcfile.c +++ b/src/tools/rcfile.c @@ -52,6 +52,7 @@ ENTRYSTRING_(BOX86_BOX64, box64) \ ENTRYSTRING_(BOX86_LD_PRELOAD, ld_preload) \ ENTRYBOOL(BOX86_NOSANDBOX, box86_nosandbox) \ ENTRYBOOL(BOX86_LIBCEF, box86_libcef) \ +ENTRYBOOL(BOX86_NOCRASHHANDLER, box86_nocrashhandler) \ ENTRYBOOL(BOX86_SDL2_JGUID, box86_sdl2_jguid) \ ENTRYBOOL(BOX86_MUTEX_ALIGNED, box86_mutex_aligned) \ ENTRYINT(BOX86_MALLOC_HACK, box86_malloc_hack, 0, 2, 2) \ diff --git a/system/box86.box86rc b/system/box86.box86rc index bbcc506f2..75a2df3f5 100644 --- a/system/box86.box86rc +++ b/system/box86.box86rc @@ -76,6 +76,7 @@ BOX86_NOGTK=1 BOX86_DYNAREC_STRONGMEM=1 BOX86_X11COLOR16=1 BOX86_DYNAREC_CALLRET=0 #it seems to be unstable in some cases, so disabling (for #920) +#BOX86_NOCRASHHANDLER=1 [streaming_client] BOX86_EMULATED_LIBS=libSDL2-2.0.so.0:libSDL2_ttf-2.0.so.0