Escape hatch needs 'notrack' to enter

modified:   stub/src/amd64-linux.elf-fold.S
	modified:   stub/src/i386-linux.elf-fold.S
This commit is contained in:
John Reiser 2025-03-02 11:22:05 -08:00
parent dbde75028c
commit fb0f6c6a00
2 changed files with 10 additions and 2 deletions

View File

@ -201,11 +201,16 @@ p_memsz= 5*NBPW
mov %ebx,%edi # fd
call close
.macro NOTRACK
.byte 0x3e
.endm
no_pse_map:
pop %arg1 # ADRU: unfolded upx_main2 etc.
pop %arg2 # LENU
push $__NR_munmap; pop %rax
/*notrack*/ jmp *(%r14) # goto: syscall; pop %rdx; ret
NOTRACK; jmp *(%r14) # goto: syscall; pop %rdx; ret
get_page_mask: .globl get_page_mask
mov PAGE_MASK(%rip),%rax

View File

@ -285,8 +285,11 @@ L60:
push eax
push eax // 32 bytes of zeroes now on stack, ready for 'popa'
.macro NOTRACK
.byte 0x3e
.endm
mov al, __NR_munmap // eax was 0 from L60
/*notrack*/ jmp [edi] // unmap ourselves via escape hatch, then goto entry
NOTRACK; jmp [edi] // unmap ourselves via escape hatch, then goto entry
section SYSCALLS
// Sometimes linux enforces page-aligned address