From ab0c349261098f3466a248348872a3b5ce901d85 Mon Sep 17 00:00:00 2001 From: John Reiser Date: Sun, 9 Jul 2006 17:29:22 -0700 Subject: [PATCH] workaround ElfLinker not handling addSection(,,) from dynamic block --- src/p_lx_elf.cpp | 2 +- src/stub/i386-linux.elf-entry.h | 30 +++++++++++++-------------- src/stub/src/i386-linux.elf-entry.asm | 2 +- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/p_lx_elf.cpp b/src/p_lx_elf.cpp index 7ba649ce..3c684f33 100644 --- a/src/p_lx_elf.cpp +++ b/src/p_lx_elf.cpp @@ -381,7 +381,7 @@ PackLinuxElf32x86::buildLinuxLoader( // This adds the definition to the "library", to be used later. linker->addSection("FOLDEXEC", cprLoader, sizeof(h) + sz_cpr); - delete [] cprLoader; + // FIXME: memory leak delete [] cprLoader; int const n_mru = ft->n_mru; // FIXME: belongs to filter? packerf? diff --git a/src/stub/i386-linux.elf-entry.h b/src/stub/i386-linux.elf-entry.h index 933ab5a0..a5d361b2 100644 --- a/src/stub/i386-linux.elf-entry.h +++ b/src/stub/i386-linux.elf-entry.h @@ -28,15 +28,15 @@ #define LINUX_I386ELF_LOADER_SIZE 40027 -#define LINUX_I386ELF_LOADER_ADLER32 0x460c7f14 -#define LINUX_I386ELF_LOADER_CRC32 0x7e1f3d6d +#define LINUX_I386ELF_LOADER_ADLER32 0xa3937df1 +#define LINUX_I386ELF_LOADER_CRC32 0xd4af9c56 unsigned char linux_i386elf_loader[40027] = { 127, 69, 76, 70, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 0 */ 1, 0, 3, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 10 */ 212, 10, 0, 0, 0, 0, 0, 0, 52, 0, 0, 0, 0, 0, 40, 0, /* 0x 20 */ -208, 0,205, 0,204,232,122, 0, 0, 0, 96,106, 63,139,116, 36, /* 0x 30 */ - 40,139,124, 36, 48,131,205,255,235, 3,164, 0, 0, 0, 0, 0, /* 0x 40 */ +208, 0,205, 0,232,122, 0, 0, 0, 96,106, 63,139,116, 36, 40, /* 0x 30 */ +139,124, 36, 48,131,205,255,235, 3,164, 0, 0, 0, 0, 0, 0, /* 0x 40 */ 235, 3, 0, 0, 0, 0, 0, 0,138, 6, 70,136, 7, 71, 1,219, /* 0x 50 */ 117, 7,139, 30,131,238,252, 17,219,114, 1, 49,192, 64,138, 7, /* 0x 60 */ 114,255,184, 1, 0, 0, 0, 1,219,117, 7,139, 30,131,238,252, /* 0x 70 */ @@ -102,7 +102,7 @@ unsigned char linux_i386elf_loader[40027] = { 90,232, 29, 0, 0, 0, 80, 82, 79, 84, 95, 69, 88, 69, 67,124, /* 0x 430 */ 80, 82, 79, 84, 95, 87, 82, 73, 84, 69, 32,102, 97,105,108,101, /* 0x 440 */ 100, 46, 10, 89,106, 2, 91,106, 4, 88,205,128,179,127,106, 1, /* 0x 450 */ - 88,205,128, 94,141, 69,246, 43, 0,137,194, 3, 64, 72, 5,255, /* 0x 460 */ + 88,205,128, 94,141, 69,247, 43, 0,137,194, 3, 64, 72, 5,255, /* 0x 460 */ 15, 0, 0, 37, 0,240,255,255, 80, 49,201,106,255,106, 50,181, /* 0x 470 */ 16,106, 7, 81, 80,137,227,106, 90, 88,205,128,133,192,120,154, /* 0x 480 */ 146,147,252,173, 80,137,225, 80, 81, 82,173, 80,173,137, 68, 36, /* 0x 490 */ @@ -209,16 +209,16 @@ unsigned char linux_i386elf_loader[40027] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x ae0 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, 0, 0, 0, /* 0x af0 */ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 52, 0, 0, 0, /* 0x b00 */ - 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, /* 0x b10 */ + 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, /* 0x b10 */ 0, 0, 0, 0, 27, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, /* 0x b20 */ 0, 0, 0, 0,236, 52, 0, 0, 8, 0, 0, 0,206, 0, 0, 0, /* 0x b30 */ 1, 0, 0, 0, 4, 0, 0, 0, 8, 0, 0, 0, 40, 0, 0, 0, /* 0x b40 */ - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 58, 0, 0, 0, /* 0x b50 */ + 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 57, 0, 0, 0, /* 0x b50 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, /* 0x b60 */ 0, 0, 0, 0, 49, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, /* 0x b70 */ - 0, 0, 0, 0, 58, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, /* 0x b80 */ + 0, 0, 0, 0, 57, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, /* 0x b80 */ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 62, 0, 0, 0, /* 0x b90 */ - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 72, 0, 0, 0, /* 0x ba0 */ + 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 71, 0, 0, 0, /* 0x ba0 */ 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, /* 0x bb0 */ 0, 0, 0, 0, 58, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, /* 0x bc0 */ 0, 0, 0, 0,244, 52, 0, 0, 8, 0, 0, 0,206, 0, 0, 0, /* 0x bd0 */ @@ -878,7 +878,7 @@ unsigned char linux_i386elf_loader[40027] = { 16, 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x34b0 */ 16, 0, 0, 0, 0, 95,115,116, 97,114,116, 0,102,105,108,116, /* 0x34c0 */ 101,114, 95,108,101,110,103,116,104, 0,102,105,108,116,101,114, /* 0x34d0 */ - 95, 99,116,111, 0, 78, 77, 82, 85, 0, 0, 0, 2, 0, 0, 0, /* 0x34e0 */ + 95, 99,116,111, 0, 78, 77, 82, 85, 0, 0, 0, 1, 0, 0, 0, /* 0x34e0 */ 2, 36, 0, 0, 1, 0, 0, 0, 23, 3, 0, 0, 1, 0, 0, 0, /* 0x34f0 */ 23, 3, 0, 0, 1, 0, 0, 0, 23, 1, 0, 0, 3, 0, 0, 0, /* 0x3500 */ 23, 2, 0, 0, 12, 0, 0, 0, 23, 4, 0, 0, 3, 0, 0, 0, /* 0x3510 */ @@ -924,24 +924,24 @@ unsigned char linux_i386elf_loader[40027] = { 32, 70,105,108,101, 32,111,102,102, 32, 32, 65,108,103,110, 32, /* 0x3790 */ 32, 70,108, 97,103,115, 10, 32, 32, 48, 32, 76, 69, 88, 69, 67, /* 0x37a0 */ 48, 48, 48, 32, 32, 32, 32, 32, 32, 48, 48, 48, 48, 48, 48, 48, /* 0x37b0 */ - 54, 32, 32, 48, 48, 48, 48, 48, 48, 48, 48, 32, 32, 48, 48, 48, /* 0x37c0 */ + 53, 32, 32, 48, 48, 48, 48, 48, 48, 48, 48, 32, 32, 48, 48, 48, /* 0x37c0 */ 48, 48, 48, 48, 48, 32, 32, 48, 48, 48, 48, 48, 48, 51, 52, 32, /* 0x37d0 */ 32, 50, 42, 42, 48, 32, 32, 67, 79, 78, 84, 69, 78, 84, 83, 44, /* 0x37e0 */ 32, 82, 69, 76, 79, 67, 44, 32, 82, 69, 65, 68, 79, 78, 76, 89, /* 0x37f0 */ 10, 32, 32, 49, 32, 76, 69, 88, 69, 67, 48, 48, 57, 32, 32, 32, /* 0x3800 */ 32, 32, 32, 48, 48, 48, 48, 48, 48, 48, 48, 32, 32, 48, 48, 48, /* 0x3810 */ 48, 48, 48, 48, 48, 32, 32, 48, 48, 48, 48, 48, 48, 48, 48, 32, /* 0x3820 */ - 32, 48, 48, 48, 48, 48, 48, 51, 97, 32, 32, 50, 42, 42, 48, 32, /* 0x3830 */ + 32, 48, 48, 48, 48, 48, 48, 51, 57, 32, 32, 50, 42, 42, 48, 32, /* 0x3830 */ 32, 67, 79, 78, 84, 69, 78, 84, 83, 44, 32, 82, 69, 65, 68, 79, /* 0x3840 */ 78, 76, 89, 10, 32, 32, 50, 32, 76, 69, 88, 69, 67, 48, 49, 48, /* 0x3850 */ 32, 32, 32, 32, 32, 32, 48, 48, 48, 48, 48, 48, 48,101, 32, 32, /* 0x3860 */ 48, 48, 48, 48, 48, 48, 48, 48, 32, 32, 48, 48, 48, 48, 48, 48, /* 0x3870 */ - 48, 48, 32, 32, 48, 48, 48, 48, 48, 48, 51, 97, 32, 32, 50, 42, /* 0x3880 */ + 48, 48, 32, 32, 48, 48, 48, 48, 48, 48, 51, 57, 32, 32, 50, 42, /* 0x3880 */ 42, 48, 32, 32, 67, 79, 78, 84, 69, 78, 84, 83, 44, 32, 82, 69, /* 0x3890 */ 65, 68, 79, 78, 76, 89, 10, 32, 32, 51, 32, 78, 50, 66, 83, 77, /* 0x38a0 */ 65, 49, 48, 32, 32, 32, 32, 32, 32, 48, 48, 48, 48, 48, 48, 48, /* 0x38b0 */ 51, 32, 32, 48, 48, 48, 48, 48, 48, 48, 48, 32, 32, 48, 48, 48, /* 0x38c0 */ - 48, 48, 48, 48, 48, 32, 32, 48, 48, 48, 48, 48, 48, 52, 56, 32, /* 0x38d0 */ + 48, 48, 48, 48, 48, 32, 32, 48, 48, 48, 48, 48, 48, 52, 55, 32, /* 0x38d0 */ 32, 50, 42, 42, 48, 32, 32, 67, 79, 78, 84, 69, 78, 84, 83, 44, /* 0x38e0 */ 32, 82, 69, 76, 79, 67, 44, 32, 82, 69, 65, 68, 79, 78, 76, 89, /* 0x38f0 */ 10, 32, 32, 52, 32, 78, 50, 66, 70, 65, 83, 49, 48, 32, 32, 32, /* 0x3900 */ @@ -2122,7 +2122,7 @@ unsigned char linux_i386elf_loader[40027] = { 67, 79, 82, 68, 83, 32, 70, 79, 82, 32, 91, 76, 69, 88, 69, 67, /* 0x8270 */ 48, 48, 48, 93, 58, 10, 79, 70, 70, 83, 69, 84, 32, 32, 32, 84, /* 0x8280 */ 89, 80, 69, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, /* 0x8290 */ - 32, 86, 65, 76, 85, 69, 32, 10, 48, 48, 48, 48, 48, 48, 48, 50, /* 0x82a0 */ + 32, 86, 65, 76, 85, 69, 32, 10, 48, 48, 48, 48, 48, 48, 48, 49, /* 0x82a0 */ 32, 82, 95, 51, 56, 54, 95, 80, 67, 51, 50, 32, 32, 32, 32, 32, /* 0x82b0 */ 32, 32, 32, 76, 69, 88, 69, 67, 48, 50, 48, 10, 10, 10, 82, 69, /* 0x82c0 */ 76, 79, 67, 65, 84, 73, 79, 78, 32, 82, 69, 67, 79, 82, 68, 83, /* 0x82d0 */ diff --git a/src/stub/src/i386-linux.elf-entry.asm b/src/stub/src/i386-linux.elf-entry.asm index 312d63c4..2bd35d0e 100644 --- a/src/stub/src/i386-linux.elf-entry.asm +++ b/src/stub/src/i386-linux.elf-entry.asm @@ -41,7 +41,7 @@ .globl _start section LEXEC000 _start: - int3 +//// int3 /* ;; How to debug this code: Uncomment the 'int3' breakpoint instruction above. ;; Build the stubs and upx. Compress a testcase, such as a copy of /bin/date.