MH_EXECUTE runs under lldb, fails under shell

mmap  addr=0x100000000  len=0x3003  prot=0x3  flags=0x1012  fd=-1  off=0x0  reloc=0x0
maddr=0xffffffffffffffff  addr=0x100000000
	modified:   p_mach.cpp
	modified:   p_mach_enum.h
	modified:   stub/src/amd64-darwin.macho-entry.S
	modified:   stub/src/amd64-darwin.macho-fold.S
	modified:   stub/src/amd64-darwin.macho-main.c
This commit is contained in:
John Reiser
2017-12-13 09:54:44 -08:00
parent 3400ae9dbe
commit 5063480a38
9 changed files with 946 additions and 782 deletions
+14 -14
View File
@@ -3,19 +3,19 @@ file format elf64-x86-64
Sections:
Idx Name Size VMA LMA File off Algn Flags
0 AMD64BXX 0000004c 0000000000000000 0000000000000000 00000040 2**0 CONTENTS, READONLY
1 MACHMAINX 00000006 0000000000000000 0000000000000000 0000008c 2**0 CONTENTS, RELOC, READONLY
2 MACH_UNC 00000008 0000000000000000 0000000000000000 00000092 2**0 CONTENTS, READONLY
3 NRV_HEAD 00000067 0000000000000000 0000000000000000 0000009a 2**0 CONTENTS, READONLY
4 NRV2E 000000b7 0000000000000000 0000000000000000 00000101 2**0 CONTENTS, RELOC, READONLY
5 NRV2D 0000009e 0000000000000000 0000000000000000 000001b8 2**0 CONTENTS, RELOC, READONLY
6 NRV2B 00000090 0000000000000000 0000000000000000 00000256 2**0 CONTENTS, RELOC, READONLY
7 LZMA_ELF00 00000064 0000000000000000 0000000000000000 000002e6 2**0 CONTENTS, RELOC, READONLY
8 LZMA_DEC10 000009f7 0000000000000000 0000000000000000 0000034a 2**0 CONTENTS, READONLY
9 LZMA_DEC20 000009f7 0000000000000000 0000000000000000 00000d41 2**0 CONTENTS, READONLY
10 LZMA_DEC30 00000014 0000000000000000 0000000000000000 00001738 2**0 CONTENTS, READONLY
11 NRV_TAIL 00000000 0000000000000000 0000000000000000 0000174c 2**0 CONTENTS, READONLY
12 MACHMAINY 00000011 0000000000000000 0000000000000000 0000174c 2**0 CONTENTS, READONLY
13 MACHMAINZ 00000107 0000000000000000 0000000000000000 0000175d 2**0 CONTENTS, RELOC, READONLY
1 MACHMAINX 00000005 0000000000000000 0000000000000000 0000008c 2**0 CONTENTS, RELOC, READONLY
2 MACH_UNC 00000008 0000000000000000 0000000000000000 00000091 2**0 CONTENTS, READONLY
3 NRV_HEAD 00000067 0000000000000000 0000000000000000 00000099 2**0 CONTENTS, READONLY
4 NRV2E 000000b7 0000000000000000 0000000000000000 00000100 2**0 CONTENTS, RELOC, READONLY
5 NRV2D 0000009e 0000000000000000 0000000000000000 000001b7 2**0 CONTENTS, RELOC, READONLY
6 NRV2B 00000090 0000000000000000 0000000000000000 00000255 2**0 CONTENTS, RELOC, READONLY
7 LZMA_ELF00 00000064 0000000000000000 0000000000000000 000002e5 2**0 CONTENTS, RELOC, READONLY
8 LZMA_DEC10 000009f7 0000000000000000 0000000000000000 00000349 2**0 CONTENTS, READONLY
9 LZMA_DEC20 000009f7 0000000000000000 0000000000000000 00000d40 2**0 CONTENTS, READONLY
10 LZMA_DEC30 00000014 0000000000000000 0000000000000000 00001737 2**0 CONTENTS, READONLY
11 NRV_TAIL 00000000 0000000000000000 0000000000000000 0000174b 2**0 CONTENTS, READONLY
12 MACHMAINY 00000011 0000000000000000 0000000000000000 0000174b 2**0 CONTENTS, READONLY
13 MACHMAINZ 00000107 0000000000000000 0000000000000000 0000175c 2**0 CONTENTS, RELOC, READONLY
SYMBOL TABLE:
0000000000000000 l d NRV_HEAD 0000000000000000 NRV_HEAD
0000000000000000 l d LZMA_DEC30 0000000000000000 LZMA_DEC30
@@ -36,7 +36,7 @@ SYMBOL TABLE:
RELOCATION RECORDS FOR [MACHMAINX]:
OFFSET TYPE VALUE
0000000000000002 R_X86_64_PC32 MACHMAINZ+0x000000000000009a
0000000000000001 R_X86_64_PC32 MACHMAINZ+0x000000000000009a
RELOCATION RECORDS FOR [NRV2E]:
OFFSET TYPE VALUE
+46 -45
View File
@@ -72,31 +72,32 @@ LOAD tmp/amd64-darwin.macho-main.o
.plt
*(.plt)
.text 0x0000000008048000 0x590
.text 0x0000000008048000 0xc70
*(.text .stub .text.* .gnu.linkonce.t.*)
.text 0x0000000008048000 0xe1 tmp/amd64-darwin.macho-fold.o
0x00000000080480b7 munmap
0x000000000804809b bswap
0x00000000080480c7 mmap
0x00000000080480ab write
.text 0x0000000008048000 0xe2 tmp/amd64-darwin.macho-fold.o
0x00000000080480b8 munmap
0x000000000804809c bswap
0x00000000080480c8 mmap
0x00000000080480ac write
0x0000000008048000 _start
0x00000000080480cb read
0x00000000080480bb pread
0x00000000080480af exit
0x00000000080480c3 open
0x00000000080480b3 mprotect
0x00000000080480bf close
*fill* 0x00000000080480e1 0x3 90909090
.text 0x00000000080480e4 0x4ac tmp/amd64-darwin.macho-main.o
0x0000000008048426 upx_main
0x00000000080480cc read
0x00000000080480bc pread
0x00000000080480b0 exit
0x00000000080480c4 open
0x00000000080480b4 mprotect
0x00000000080480c0 close
*fill* 0x00000000080480e2 0x2 90909090
.text 0x00000000080480e4 0xb8c tmp/amd64-darwin.macho-main.o
0x000000000804863d do_xmap
0x0000000008048a4b upx_main
*(.text.*personality*)
*(.gnu.warning)
.fini
*(.fini)
0x0000000008048590 PROVIDE (__etext, .)
0x0000000008048590 PROVIDE (_etext, .)
0x0000000008048590 PROVIDE (etext, .)
0x0000000008048c70 PROVIDE (__etext, .)
0x0000000008048c70 PROVIDE (_etext, .)
0x0000000008048c70 PROVIDE (etext, .)
.rodata
*(.rodata .rodata.* .gnu.linkonce.r.*)
@@ -112,8 +113,8 @@ LOAD tmp/amd64-darwin.macho-main.o
.gcc_except_table
*(.gcc_except_table .gcc_except_table.*)
0x0000000008048590 . = (ALIGN (0x1000) - ((0x1000 - .) & 0xfff))
0x0000000008049590 . = (0x1000 DATA_SEGMENT_ALIGN 0x1000)
0x0000000008048c70 . = (ALIGN (0x1000) - ((0x1000 - .) & 0xfff))
0x0000000008049c70 . = (0x1000 DATA_SEGMENT_ALIGN 0x1000)
.eh_frame
*(.eh_frame)
@@ -128,22 +129,22 @@ LOAD tmp/amd64-darwin.macho-main.o
*(.tbss .tbss.* .gnu.linkonce.tb.*)
*(.tcommon)
.preinit_array 0x0000000008049590 0x0
0x0000000008049590 PROVIDE (__preinit_array_start, .)
.preinit_array 0x0000000008049c70 0x0
0x0000000008049c70 PROVIDE (__preinit_array_start, .)
*(.preinit_array)
0x0000000008049590 PROVIDE (__preinit_array_end, .)
0x0000000008049c70 PROVIDE (__preinit_array_end, .)
.init_array 0x0000000008049590 0x0
0x0000000008049590 PROVIDE (__init_array_start, .)
.init_array 0x0000000008049c70 0x0
0x0000000008049c70 PROVIDE (__init_array_start, .)
*(SORT(.init_array.*))
*(.init_array)
0x0000000008049590 PROVIDE (__init_array_end, .)
0x0000000008049c70 PROVIDE (__init_array_end, .)
.fini_array 0x0000000008049590 0x0
0x0000000008049590 PROVIDE (__fini_array_start, .)
.fini_array 0x0000000008049c70 0x0
0x0000000008049c70 PROVIDE (__fini_array_start, .)
*(.fini_array)
*(SORT(.fini_array.*))
0x0000000008049590 PROVIDE (__fini_array_end, .)
0x0000000008049c70 PROVIDE (__fini_array_end, .)
.ctors
*crtbegin*.o(.ctors)
@@ -169,35 +170,35 @@ LOAD tmp/amd64-darwin.macho-main.o
.got
*(.got)
0x0000000008049590 . = (. DATA_SEGMENT_RELRO_END 0xc)
0x0000000008049c70 . = (. DATA_SEGMENT_RELRO_END 0xc)
.got.plt
*(.got.plt)
.data 0x0000000008049590 0x0
.data 0x0000000008049c70 0x0
*(.data .data.* .gnu.linkonce.d.*)
.data 0x0000000008049590 0x0 tmp/amd64-darwin.macho-fold.o
.data 0x0000000008049590 0x0 tmp/amd64-darwin.macho-main.o
.data 0x0000000008049c70 0x0 tmp/amd64-darwin.macho-fold.o
.data 0x0000000008049c70 0x0 tmp/amd64-darwin.macho-main.o
*(.gnu.linkonce.d.*personality*)
.data1
*(.data1)
0x0000000008049590 _edata = .
0x0000000008049590 PROVIDE (edata, .)
0x0000000008049590 __bss_start = .
0x0000000008049c70 _edata = .
0x0000000008049c70 PROVIDE (edata, .)
0x0000000008049c70 __bss_start = .
.bss 0x0000000008049590 0x0
.bss 0x0000000008049c70 0x0
*(.dynbss)
*(.bss .bss.* .gnu.linkonce.b.*)
.bss 0x0000000008049590 0x0 tmp/amd64-darwin.macho-fold.o
.bss 0x0000000008049590 0x0 tmp/amd64-darwin.macho-main.o
.bss 0x0000000008049c70 0x0 tmp/amd64-darwin.macho-fold.o
.bss 0x0000000008049c70 0x0 tmp/amd64-darwin.macho-main.o
*(COMMON)
0x0000000008049590 . = ALIGN ((. != 0x0)?0x4:0x1)
0x0000000008049590 . = ALIGN (0x4)
0x0000000008049590 . = ALIGN (0x4)
0x0000000008049590 _end = .
0x0000000008049590 PROVIDE (end, .)
0x0000000008049590 . = DATA_SEGMENT_END (.)
0x0000000008049c70 . = ALIGN ((. != 0x0)?0x4:0x1)
0x0000000008049c70 . = ALIGN (0x4)
0x0000000008049c70 . = ALIGN (0x4)
0x0000000008049c70 _end = .
0x0000000008049c70 PROVIDE (end, .)
0x0000000008049c70 . = DATA_SEGMENT_END (.)
.stab
*(.stab)