New option --catch-sigsegv on amd64, arm64, arm.v4a

Catch SIGSEGV during de-compression, and print state info
("auto debug") using /proc/self/maps and gdb.
This was motivated by suspicion of unreliable hardware
which triggered "Heisenbugs": a crash which cannot be reproduced.
If SIGSGV occurs without the "auto debug" info, then that
implies an error user code after de-compression, often when
user code accesses /proc/self/exe, which is not the un-compressed file.
	modified:   misc/testsuite/upx_testsuite_1-expected_sha256sums.sh
	modified:   src/help.cpp
	modified:   src/main.cpp
	modified:   src/options.h
	modified:   src/p_lx_elf.cpp
	modified:   src/stub/Makefile
	modified:   src/stub/src/amd64-linux.elf-entry.S
	modified:   src/stub/src/amd64-linux.elf-fold.S
	modified:   src/stub/src/arm.v4a-linux.elf-entry.S
	modified:   src/stub/src/arm.v4a-linux.elf-fold.S
	modified:   src/stub/src/arm64-linux.elf-entry.S
	modified:   src/stub/src/arm64-linux.elf-fold.S
           plus generated .h .dump .map
This commit is contained in:
John Reiser
2025-08-19 12:10:32 -07:00
parent 4530e5c264
commit e85e8bec5d
26 changed files with 6223 additions and 5639 deletions
+4
View File
@@ -742,6 +742,9 @@ static int do_option(int optc, const char *arg) {
case 678:
opt->o_unix.android_old = true;
break;
case 679:
opt->o_unix.catch_sigsegv = true;
break;
// ps1/exe
case 670:
opt->ps1_exe.boot_only = true;
@@ -957,6 +960,7 @@ int main_get_options(int argc, char **argv) {
{"android-shlib", 0, N, 676},
{"force-pie", 0x90, N, 677},
{"android-old", 0, N, 678},
{"catch-sigsegv", 0, N, 679},
// ps1/exe
{"boot-only", 0x90, N, 670},
{"no-align", 0x90, N, 671},