ELF2 64-bits: Use /dev/shm (O_TMPFILE) if memfd_create fails

Such as Ubuntu-20.04, Linux kernel 5.15.0-67, #74-20.04.1, 2023-02-22
	modified:   ../misc/testsuite/upx_testsuite_1-expected_sha256sums.sh
	modified:   stub/Makefile
	modified:   stub/src/amd64-linux.elf-entry.S
	modified:   stub/src/amd64-linux.elf-fold.S
	modified:   stub/src/amd64-linux.elf-main2.c
	modified:   stub/src/arm64-linux.elf-fold.S
	modified:   stub/src/upxfd_android.c
           plus generated *.h *.map *.dump
This commit is contained in:
John Reiser
2024-06-26 13:38:46 -07:00
parent 5f6bdb0a8f
commit e561da33bd
13 changed files with 2113 additions and 2038 deletions
+3 -3
View File
@@ -2,8 +2,8 @@ file format elf64-x86-64
Sections:
Idx Name Size VMA LMA File off Algn Flags
0 ELFMAINX 0171 0 0 040 2**0 CONTENTS
1 ELFMAINZ 04 0 0 01b4 2**2 CONTENTS
0 ELFMAINX 01a6 0 0 040 2**0 CONTENTS
1 ELFMAINZ 04 0 0 01e8 2**2 CONTENTS
SYMBOL TABLE:
0000000000000000 l d ELFMAINZ 0 ELFMAINZ
0000000000000000 l d ELFMAINX 0 ELFMAINX
@@ -12,7 +12,7 @@ SYMBOL TABLE:
RELOCATION RECORDS FOR [ELFMAINX]:
OFFSET TYPE VALUE
0000000000000059 R_X86_64_PC32 ELFMAINZ+0xfffffffffffffffc
0000000000000087 R_X86_64_PC32 ELFMAINZ+0xfffffffffffffffc
RELOCATION RECORDS FOR [ELFMAINZ]:
OFFSET TYPE VALUE
+17 -17
View File
@@ -46,24 +46,24 @@ LOAD tmp/amd64-expand.o
LOAD tmp/amd64-linux.elf-main2.o
OUTPUT(tmp/amd64-linux.elf-fold.bin elf64-x86-64)
SYSCALLS 0x0000000000000000 0x8e
SYSCALLS 0x0000000000000000 0x8e tmp/amd64-linux.elf-fold.o
0x0000000000000018 Pmap
0x000000000000006a munmap
0x000000000000007a ftruncate
0x000000000000002a mmap
0x0000000000000086 write
0x0000000000000011 memfd_create
0x000000000000008a read
SYSCALLS 0x0000000000000000 0xc0
SYSCALLS 0x0000000000000000 0xc0 tmp/amd64-linux.elf-fold.o
0x000000000000004a Pmap
0x000000000000009c munmap
0x00000000000000ac ftruncate
0x000000000000005c mmap
0x00000000000000b8 write
0x00000000000000bc read
0x0000000000000011 upxfd_create
0x0000000000000000 my_bkpt
0x0000000000000045 Pprotect
0x0000000000000086 Pwrite
0x000000000000005a Punmap
0x000000000000006e exit
0x0000000000000072 brk
0x000000000000007e open
0x0000000000000082 mprotect
0x0000000000000076 close
0x0000000000000077 Pprotect
0x00000000000000b8 Pwrite
0x000000000000008c Punmap
0x00000000000000a0 exit
0x00000000000000a4 brk
0x00000000000000b0 open
0x00000000000000b4 mprotect
0x00000000000000a8 close
LZMA_DEC10 0x0000000000000000 0x9f7
LZMA_DEC10 0x0000000000000000 0x9f7 tmp/amd64-expand.o
+16 -16
View File
@@ -12,17 +12,17 @@ LOAD tmp/arm64-expand.o
LOAD tmp/arm64-linux.elf-main2.o
OUTPUT(tmp/arm64-linux.elf-fold.bin elf64-littleaarch64)
.text 0x0000000000000000 0xa98
.text 0x0000000000000000 0x240 tmp/arm64-linux.elf-fold.o
.text 0x0000000000000000 0xaa0
.text 0x0000000000000000 0x248 tmp/arm64-linux.elf-fold.o
0x0000000000000008 get_page_mask
0x0000000000000018 mmap_privanon
0x0000000000000028 mmap
0x0000000000000044 Pprotect
0x0000000000000044 mprotect
.text 0x0000000000000240 0x0 tmp/arm64-expand.o
.text 0x0000000000000240 0x858 tmp/arm64-linux.elf-main2.o
0x00000000000008f4 underlay
0x0000000000000960 upx_main
.text 0x0000000000000248 0x0 tmp/arm64-expand.o
.text 0x0000000000000248 0x858 tmp/arm64-linux.elf-main2.o
0x00000000000008fc underlay
0x0000000000000968 upx_main
.data 0x0000000000000000 0x0
.data 0x0000000000000000 0x0 tmp/arm64-linux.elf-fold.o
@@ -34,8 +34,8 @@ OUTPUT(tmp/arm64-linux.elf-fold.bin elf64-littleaarch64)
.bss 0x0000000000000000 0x0 tmp/arm64-expand.o
.bss 0x0000000000000000 0x0 tmp/arm64-linux.elf-main2.o
SYSCALLS 0x0000000000000000 0xe0
SYSCALLS 0x0000000000000000 0xe0 tmp/arm64-linux.elf-fold.o
SYSCALLS 0x0000000000000000 0x110
SYSCALLS 0x0000000000000000 0x110 tmp/arm64-linux.elf-fold.o
0x0000000000000000 my_bkpt
0x0000000000000008 exit
0x0000000000000010 read
@@ -44,14 +44,14 @@ SYSCALLS 0x0000000000000000 0xe0
0x0000000000000034 getpid
0x0000000000000040 brk
0x000000000000004c munmap
0x0000000000000058 memfd_create
0x0000000000000064 ftruncate
0x0000000000000070 unlink
0x0000000000000084 readlink
0x000000000000008c open
0x00000000000000a8 __clear_cache
0x00000000000000bc memcpy
0x00000000000000d0 memset
0x000000000000005c upxfd_create
0x0000000000000094 ftruncate
0x00000000000000a0 unlink
0x00000000000000b4 readlink
0x00000000000000bc open
0x00000000000000d8 __clear_cache
0x00000000000000ec memcpy
0x0000000000000100 memset
EXP_HEAD 0x0000000000000000 0x104
EXP_HEAD 0x0000000000000000 0x104 tmp/arm64-expand.o