1
0
mirror of https://github.com/upx/upx.git synced 2025-08-11 22:52:30 +08:00

Uninstall SIGSEGV handler

modified:   src/amd64-linux.elf-entry.S
	modified:   src/amd64-linux.elf-fold.S
This commit is contained in:
John Reiser
2025-07-27 12:02:38 -07:00
parent bf386524ef
commit dd2900e3a6
2 changed files with 13 additions and 4 deletions

View File

@ -102,13 +102,13 @@ SA_RESTORER= 0x04000000
__NR_rt_sigaction= 13 // /usr/include/asm/unistd_64.h
push %rdi // save reg
sub %edx,%edx // arg3= 0 ==> do not save old sigaction
push %rdx // 64 bits of signals
lea __restore_rt(%rip),%rax; push %rax // .sa_restorer DEBUG ONLY
push $SA_RESTORER | SA_SIGINFO // .sa_flags
push %rdx // 64 bits of flags for signals
push %rdx // .sa_restorer= NULL
push $SA_SIGINFO // .sa_flags (omit SA_RESTORER to save space)
lea sigsegv_sigaction(%rip),%rax; push %rax // .sa_sigaction
push %rsp; pop %rsi // arg2= &new struct sigaction
push $SIGSEGV; pop %rdi // arg1= signum
push $8; pop %r10 // sys4= 8 bytes of bits for signals
push $8; pop %sys4 // sys4= 8 bytes of bits for signals
push $__NR_rt_sigaction; pop %rax; syscall
add $(3 + 1) * NBPW,%rsp // toss struct sigaction
pop %rdi // restore reg

View File

@ -177,6 +177,15 @@ no_env_pse:
mov %ebp,%ebx # fd
movq %rax,3*NBPW(%rsp) # entry
// Uninstall SIGSEGV handler
SIGSEGV= 11
__NR_rt_sigaction= 13 // /usr/include/asm/unistd_64.h
push $8; pop %sys4 // sys_arg4 minimal byte count
xor %edx,%edx // no old
xor %esi,%esi // no new
push $SIGSEGV; pop %rdi
push $__NR_rt_sigaction; pop %eax; syscall
sz_Ehdr= 8*NBPW
e_type= 16
ET_EXEC= 2