From b1f02f91d7907adb5d0f4aff66eb8c34ae4dae6b Mon Sep 17 00:00:00 2001 From: John Reiser Date: Tue, 9 Nov 2010 10:47:53 -0800 Subject: [PATCH] NetBSD 5.0 wants PT_NOTE and branded executables --- src/p_lx_elf.cpp | 113 +++++++++++- src/p_lx_elf.h | 9 + src/stub/Makefile | 15 ++ src/stub/i386-netbsd.elf-fold.h | 153 ++++++++++++++++ src/stub/i386-openbsd.elf-fold.h | 250 +++++++++++++------------- src/stub/scripts/brandelf.py | 6 + src/stub/src/i386-openbsd.elf-fold.S | 4 +- src/stub/tmp/i386-netbsd.elf-fold.bin | Bin 0 -> 1809 bytes src/stub/tmp/i386-netbsd.elf-fold.map | 55 ++++++ 9 files changed, 472 insertions(+), 133 deletions(-) create mode 100644 src/stub/i386-netbsd.elf-fold.h create mode 100644 src/stub/tmp/i386-netbsd.elf-fold.bin create mode 100644 src/stub/tmp/i386-netbsd.elf-fold.map diff --git a/src/p_lx_elf.cpp b/src/p_lx_elf.cpp index 107d2cc2..c4c5a7e7 100644 --- a/src/p_lx_elf.cpp +++ b/src/p_lx_elf.cpp @@ -44,6 +44,8 @@ #define PT_LOAD32 Elf32_Phdr::PT_LOAD #define PT_LOAD64 Elf64_Phdr::PT_LOAD +#define PT_NOTE32 Elf32_Phdr::PT_NOTE +#define PT_NOTE64 Elf64_Phdr::PT_NOTE static unsigned const EF_ARM_HASENTRY = 0x02; static unsigned const EF_ARM_EABI_VER4 = 0x04000000; @@ -396,7 +398,8 @@ void PackLinuxElf::defineSymbols(Filter const *) } PackLinuxElf32::PackLinuxElf32(InputFile *f) - : super(f), phdri(NULL), shdri(NULL), page_mask(~0u<o_unix.is_ptinterp) { + unsigned j; + for (j = 0; j < sizeof(stub_i386_netbsd_elf_fold)-1; ++j) { + if (0x60==tmp[ j] + && 0x47==tmp[1+j] ) { + /* put INC EDI before PUSHA: inhibits auxv_up for PT_INTERP */ + tmp[ j] = 0x47; + tmp[1+j] = 0x60; + break; + } + } + } + buildLinuxLoader( + stub_i386_bsd_elf_entry, sizeof(stub_i386_bsd_elf_entry), + tmp, sizeof(stub_i386_netbsd_elf_fold), ft); +} + static const #include "stub/i386-openbsd.elf-fold.h" @@ -1148,7 +1174,7 @@ bool PackLinuxElf32::canPack() fi->seek(0, SEEK_SET); if (4==get_te32(¬e.descsz) && 1==get_te32(¬e.type) - && 0==note.end + // && 0==note.end && (1+ strlen(osabi_note))==get_te32(¬e.namesz) && 0==strcmp(osabi_note, (char const *)note.text) ) { @@ -1570,6 +1596,75 @@ PackLinuxElf32::generateElfHdr( } } +void +PackNetBSDElf32x86::generateElfHdr( + OutputFile *fo, + void const *proto, + unsigned const brka +) +{ + cprElfHdr3 *const h3 = (cprElfHdr3 *)&elfout; + memcpy(h3, proto, sizeof(*h3)); // reads beyond, but OK + h3->ehdr.e_ident[Elf32_Ehdr::EI_OSABI] = ei_osabi; + assert(2==get_te16(&h3->ehdr.e_phnum)); + set_te16(&h3->ehdr.e_phnum, 3); + + assert(get_te32(&h3->ehdr.e_phoff) == sizeof(Elf32_Ehdr)); + h3->ehdr.e_shoff = 0; + assert(get_te16(&h3->ehdr.e_ehsize) == sizeof(Elf32_Ehdr)); + assert(get_te16(&h3->ehdr.e_phentsize) == sizeof(Elf32_Phdr)); + set_te16(&h3->ehdr.e_shentsize, sizeof(Elf32_Shdr)); + h3->ehdr.e_shnum = 0; + h3->ehdr.e_shstrndx = 0; + + sz_elf_hdrs = sizeof(*h3) - sizeof(linfo); + unsigned const note_offset = sz_elf_hdrs; + set_te32(&h3->phdr[0].p_filesz, sizeof(*h3)+sizeof(elfnote)); // + identsize; + h3->phdr[0].p_memsz = h3->phdr[0].p_filesz; + + unsigned const brkb = brka | ((0==(~page_mask & brka)) ? 0x20 : 0); + set_te32(&h3->phdr[1].p_type, PT_LOAD32); // be sure + set_te32(&h3->phdr[1].p_offset, ~page_mask & brkb); + set_te32(&h3->phdr[1].p_vaddr, brkb); + set_te32(&h3->phdr[1].p_paddr, brkb); + h3->phdr[1].p_filesz = 0; + h3->phdr[1].p_memsz = 0; + set_te32(&h3->phdr[1].p_flags, Elf32_Phdr::PF_R | Elf32_Phdr::PF_W); + + set_te32(&h3->phdr[2].p_type, Elf32_Phdr::PT_NOTE); + set_te32(&h3->phdr[2].p_offset, note_offset); + set_te32(&h3->phdr[2].p_vaddr, note_offset); + set_te32(&h3->phdr[2].p_paddr, note_offset); + set_te32(&h3->phdr[2].p_filesz, sizeof(elfnote)); + set_te32(&h3->phdr[2].p_memsz, sizeof(elfnote)); + set_te32(&h3->phdr[2].p_flags, Elf32_Phdr::PF_R); + set_te32(&h3->phdr[2].p_align, 4); + + set_te32(&elfnote.namesz, 8); + set_te32(&elfnote.descsz, 4); + set_te32(&elfnote.type, 1); + strcpy(elfnote.text, "NetBSD"); + if (pt_note) { + struct Elf32_Note oldnote; + fi->seek(get_te32(&pt_note->p_offset), SEEK_SET); + fi->readx(&oldnote, sizeof(oldnote)); + elfnote.end = oldnote.end; + } + else { + elfnote.end = 0; + } + + if (ph.format==getFormat()) { + memset(&h3->linfo, 0, sizeof(h3->linfo)); + fo->write(h3, sizeof(*h3) - sizeof(h3->linfo)); + fo->write(&elfnote, sizeof(elfnote)); + fo->write(&h3->linfo, sizeof(h3->linfo)); + } + else { + assert(false); // unknown ph.format, PackLinuxElf32 + } +} + void PackOpenBSDElf32x86::generateElfHdr( OutputFile *fo, @@ -1697,6 +1792,9 @@ void PackLinuxElf32::pack1(OutputFile * /*fo*/, Filter & /*ft*/) Elf32_Phdr const *phdr = phdri; for (unsigned j=0; j < e_phnum; ++phdr, ++j) { + if (!pt_note && phdr->PT_NOTE32 == get_te32(&phdr->p_type)) { + pt_note = const_cast(phdr); + } if (phdr->PT_LOAD32 == get_te32(&phdr->p_type)) { unsigned x = get_te32(&phdr->p_align) >> lg2_page; while (x>>=1) { @@ -1800,6 +1898,9 @@ void PackLinuxElf64::pack1(OutputFile * /*fo*/, Filter & /*ft*/) Elf64_Phdr const *phdr = phdri; for (unsigned j=0; j < e_phnum; ++phdr, ++j) { + if (!pt_note && phdr->PT_NOTE64 == get_te32(&phdr->p_type)) { + pt_note = const_cast(phdr); + } if (phdr->PT_LOAD64 == get_te64(&phdr->p_type)) { unsigned x = get_te64(&phdr->p_align) >> lg2_page; while (x>>=1) { diff --git a/src/p_lx_elf.h b/src/p_lx_elf.h index 155e155d..7b0d32ad 100644 --- a/src/p_lx_elf.h +++ b/src/p_lx_elf.h @@ -141,6 +141,7 @@ protected: protected: Elf32_Ehdr ehdri; // from input file Elf32_Phdr *phdri; // for input file + Elf32_Phdr *pt_note; // PT_NOTE if any Elf32_Shdr const *shdri; // from input file unsigned page_mask; // AND clears the offset-within-page @@ -238,6 +239,7 @@ protected: protected: Elf64_Ehdr ehdri; // from input file Elf64_Phdr *phdri; // for input file + Elf64_Phdr *pt_note; // PT_NOTE if any Elf64_Shdr const *shdri; // from input file acc_uint64l_t page_mask; // AND clears the offset-within-page @@ -413,6 +415,13 @@ public: PackNetBSDElf32x86(InputFile *f); virtual ~PackNetBSDElf32x86(); virtual const char *getFullName(const options_t *) const { return "i386-netbsd.elf"; } +protected: + virtual void buildLoader(const Filter *ft); + virtual void generateElfHdr( + OutputFile *, + void const *proto, + unsigned const brka + ); }; class PackOpenBSDElf32x86 : public PackBSDElf32x86 diff --git a/src/stub/Makefile b/src/stub/Makefile index 18be1308..842f1479 100644 --- a/src/stub/Makefile +++ b/src/stub/Makefile @@ -85,6 +85,7 @@ STUBS += i386-darwin.dylib-entry.h # STUBS += i386-darwin.dylib-fold.h STUBS += i386-darwin.macho-entry.h STUBS += i386-darwin.macho-fold.h +STUBS += i386-netbsd.elf-fold.h STUBS += i386-openbsd.elf-fold.h STUBS += i386-dos32.djgpp2.h STUBS += i386-dos32.djgpp2-stubify.h @@ -643,6 +644,7 @@ i086-dos16.sys.h : $(srcdir)/src/$$T.S # /*********************************************************************** # // i386-bsd.elf +# // i386-netbsd.elf # // i386-openbsd.elf # ************************************************************************/ @@ -676,6 +678,19 @@ tmp/i386-bsd.elf-main.o : $(srcdir)/src/$$T.c $(call tc,objdump) -dr $(tc_objdump_disasm_options) $@ | $(RTRIM) > $@.disasm +# info: we use the tc settings from i386-linux.elf +i386-netbsd.elf%.h : tc_list = i386-linux.elf arch-i386 default +i386-netbsd.elf%.h : tc_bfdname = elf32-i386 + +# NetBSD uses the OpenBSD fold.o (for PT_NOTE handling), but the plain BSD entry.o and main.o +i386-netbsd.elf-fold.h : tmp/i386-openbsd.elf-fold.o tmp/i386-bsd.elf-main.o tmp/i386-bsd.syscall.o $(srcdir)/src/i386-bsd.elf-fold.lds + $(call tc,ld) --strip-all -T $(srcdir)/src/i386-bsd.elf-fold.lds -Map tmp/$T.map $(filter %.o,$^) -o tmp/$T.bin + $(call tc,f-objstrip,tmp/$T.bin) + $(call tc,sstrip) tmp/$T.bin + $(call tc,brandelf) --elfosabi=netbsd tmp/$T.bin + $(call tc,bin2h) tmp/$T.bin $@ + + # info: we use the tc settings from i386-linux.elf i386-openbsd.elf%.h : tc_list = i386-linux.elf arch-i386 default i386-openbsd.elf%.h : tc_bfdname = elf32-i386 diff --git a/src/stub/i386-netbsd.elf-fold.h b/src/stub/i386-netbsd.elf-fold.h new file mode 100644 index 00000000..bb5f5cfa --- /dev/null +++ b/src/stub/i386-netbsd.elf-fold.h @@ -0,0 +1,153 @@ +/* i386-netbsd.elf-fold.h + created from i386-netbsd.elf-fold.bin, 1809 (0x711) bytes + + This file is part of the UPX executable compressor. + + Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1996-2010 Laszlo Molnar + Copyright (C) 2000-2010 John F. Reiser + All Rights Reserved. + + UPX and the UCL library are free software; you can redistribute them + and/or modify them under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. + If not, write to the Free Software Foundation, Inc., + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + Markus F.X.J. Oberhumer Laszlo Molnar + + + John F. Reiser + + */ + + +#define STUB_I386_NETBSD_ELF_FOLD_SIZE 1809 +#define STUB_I386_NETBSD_ELF_FOLD_ADLER32 0x8cfe07f6 +#define STUB_I386_NETBSD_ELF_FOLD_CRC32 0x8e80731e + +unsigned char stub_i386_netbsd_elf_fold[1809] = { +/* 0x0000 */ 127, 69, 76, 70, 1, 1, 1, 12, 0, 0, 0, 0, 0, 0, 0, 0, +/* 0x0010 */ 2, 0, 3, 0, 1, 0, 0, 0,128, 16,192, 0, 52, 0, 0, 0, +/* 0x0020 */ 0, 0, 0, 0, 0, 0, 0, 0, 52, 0, 32, 0, 2, 0, 0, 0, +/* 0x0030 */ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 16,192, 0, +/* 0x0040 */ 0, 16,192, 0, 17, 7, 0, 0, 20, 7, 0, 0, 5, 0, 0, 0, +/* 0x0050 */ 0, 16, 0, 0, 1, 0, 0, 0, 17, 7, 0, 0, 0, 0, 0, 0, +/* 0x0060 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +/* 0x0070 */ 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +/* 0x0080 */ 41,201,186,248, 2, 0, 0,137,230,137,231,232,144, 0, 0, 0, +/* 0x0090 */ 137,230,209,234, 25,192, 41,193,141, 36,196,133,210,117,243,137, +/* 0x00a0 */ 231,232,122, 0, 0, 0,129,236, 0, 10, 0, 0, 83,139, 83, 72, +/* 0x00b0 */ 141,148, 26,255, 31, 0, 0,129,226, 0,240,255,255, 82, 41,192, +/* 0x00c0 */ 102,131,123, 16, 3,117, 1,146, 80,139,115, 24,139,131,136, 0, +/* 0x00d0 */ 0, 0,141,132, 24,172, 0, 0, 0, 41,198,139, 24,139, 72, 4, +/* 0x00e0 */ 131,193, 12,141, 84, 36, 12, 96, 71,232,126, 4, 0, 0,131,196, +/* 0x00f0 */ 36, 89, 91,129,196, 0, 10, 0, 0, 90,193,226, 12, 1,211, 80, +/* 0x0100 */ 106, 0,137,229, 41,217, 41,192, 81, 83, 80, 79, 60,175,175,117, +/* 0x0110 */ 252,255, 55, 49,255, 49,246, 49,210, 49,201, 49,219,176, 73,195, +/* 0x0120 */ 173,171,173,171,133,192,117,250,173,171,133,192,117,250, 87,173, +/* 0x0130 */ 171,131,248, 32,115, 3, 15,179,194,133,192,173,171,117,240,131, +/* 0x0140 */ 239, 8, 1,201, 64,243,171, 72,171,171, 95,195, 85,137,229, 87, +/* 0x0150 */ 86,137,206, 83,137,195, 57, 8,139,120, 4,115, 7,106,127,232, +/* 0x0160 */ 101, 5, 0, 0,133,201,116, 8,138, 7, 71,136, 2, 66,226,248, +/* 0x0170 */ 1,115, 4, 41, 51,141,101,244, 91, 94, 95,201,195, 85,137,229, +/* 0x0180 */ 87, 86,137,198, 83,137,211,131,236, 24,139, 69, 8,139,125, 12, +/* 0x0190 */ 137, 69,220,131, 58, 0, 15,132,182, 0, 0, 0,141, 85,228,185, +/* 0x01a0 */ 12, 0, 0, 0,137,240,232,161,255,255,255,139, 69,228,139, 77, +/* 0x01b0 */ 232,133,192,117, 19,129,249, 85, 80, 88, 33,117, 15,131, 62, 0, +/* 0x01c0 */ 15,132,140, 0, 0, 0,235, 4,133,201,117, 7,106,127,232,246, +/* 0x01d0 */ 4, 0, 0, 57,193,119,245, 59, 3,119,241, 57,193,115, 86,137, +/* 0x01e0 */ 69,224,141, 69,224,255,117,236, 80,255,115, 4, 81,255,118, 4, +/* 0x01f0 */ 255, 85,220,131,196, 20,133,192,117,210,139, 85,224, 59, 85,228, +/* 0x0200 */ 117,202,138, 69,237,132,192,116, 34,133,255,116, 30,129,250, 0, +/* 0x0210 */ 2, 0, 0,119, 4, 57, 19,117, 18, 15,182,192, 80, 15,182, 69, +/* 0x0220 */ 238, 80, 82,255,115, 4,255,215,131,196, 16,139, 69,232, 1, 70, +/* 0x0230 */ 4, 41, 6,235, 10,139, 83, 4,137,240,232, 13,255,255,255,139, +/* 0x0240 */ 85,228,139, 3, 1, 83, 4, 41,208,133,192,137, 3,233, 68,255, +/* 0x0250 */ 255,255,141,101,244, 91, 94, 95,201,195,133,192, 83,137,211,116, +/* 0x0260 */ 29,168, 1,117, 25,139, 16, 57,218,116, 7, 74,117, 11,133,219, +/* 0x0270 */ 116, 7,137, 24,137, 72, 4,235, 5,131,192, 8,235,231, 91,195, +/* 0x0280 */ 85,137,229, 87, 86, 83,131,236, 60,137, 69,228,139, 69, 8,137, +/* 0x0290 */ 85,224,139,125,224,199, 69,204,255,255,255,255,139, 85, 12,137, +/* 0x02a0 */ 69,220,139, 69,224,139, 77, 20,137, 85,216, 3,127, 28,139, 85, +/* 0x02b0 */ 224,137, 77,212,102,131,120, 16, 2, 15,183, 74, 44,137,251, 15, +/* 0x02c0 */ 148,192, 49,246, 15,182,192,137,202,193,224, 4, 5, 2, 16, 0, +/* 0x02d0 */ 0, 74,120, 30,131, 59, 1,117, 20,139, 83, 8, 59, 85,204,115, +/* 0x02e0 */ 3,137, 85,204, 3, 83, 20, 57,214,115, 2,137,214,131,195, 32, +/* 0x02f0 */ 226,226,139, 93,204,106, 0,106,255,129,227, 0,240,255,255, 80, +/* 0x0300 */ 41,222,106, 0,129,198,255, 15, 0, 0,129,230, 0,240,255,255, +/* 0x0310 */ 86, 83,232,141, 3, 0, 0,139, 77,224,141, 52, 48,131,196, 24, +/* 0x0320 */ 41,216,102,131,121, 44, 0,137,117,240,137, 69,208,199, 69,200, +/* 0x0330 */ 0, 0, 0, 0, 15,132,232, 1, 0, 0,139, 7,131,248, 6,117, +/* 0x0340 */ 34,131,125,220, 0, 15,132,193, 1, 0, 0,139, 77,208,186, 3, +/* 0x0350 */ 0, 0, 0, 3, 79, 8,139, 69,216,232,252,254,255,255,233,169, +/* 0x0360 */ 1, 0, 0, 72, 15,133,162, 1, 0, 0,139, 79, 24,199, 69,196, +/* 0x0370 */ 64, 98, 81,115,139, 69,208,131,225, 7, 3, 71, 8,193,225, 2, +/* 0x0380 */ 139, 87, 16,211,109,196,139, 79, 20,137,198,131,101,196, 7, 1, +/* 0x0390 */ 193,137, 85,232,137, 77,188,137,193,129,225,255, 15, 0, 0,137, +/* 0x03a0 */ 69,236, 1,202, 41,206,131,125,220, 0,137, 85,192,116, 41,106, +/* 0x03b0 */ 0,139, 69,196,106,255,104, 18, 16, 0, 0,131,200, 2, 80,137, +/* 0x03c0 */ 208,131,192, 3, 80, 86,232,217, 2, 0, 0,131,196, 24, 57,198, +/* 0x03d0 */ 15,133,225, 0, 0, 0,235, 36,139, 71, 4, 41,200, 80,255,117, +/* 0x03e0 */ 228,106, 18,255,117,196,255,117,192, 86,232,181, 2, 0, 0,131, +/* 0x03f0 */ 196, 24, 57,198, 15,133,189, 0, 0, 0,235, 34,131,125,220, 0, +/* 0x0400 */ 116, 28,246, 69,196, 4,139, 69,212,117, 2, 49,192, 80,139, 69, +/* 0x0410 */ 220,255,117,228,141, 85,232,232, 97,253,255,255, 88, 90,139, 69, +/* 0x0420 */ 192,247,216, 37,255, 15, 0, 0,246, 69,196, 2,137, 69,184,116, +/* 0x0430 */ 21,131,125,184, 0,139, 85,192,141, 4, 22,116, 9,139, 77,184, +/* 0x0440 */ 198, 0, 0, 64,226,250,131,125,220, 0,116,114,131, 63, 1,117, +/* 0x0450 */ 83,246, 71, 24, 1,116, 77,139, 87, 20,139, 95, 8,141, 12, 26, +/* 0x0460 */ 3, 77,208, 59, 87, 16,117, 14,137,200,247,216, 37,255, 15, 0, +/* 0x0470 */ 0,131,248, 3,119, 14,107, 69,208, 52,131,127, 4, 0,141, 76, +/* 0x0480 */ 3, 12,117, 15,139, 1, 61,205,128,201,195,116, 6,199, 1,205, +/* 0x0490 */ 128,201,195,133,201,116, 13,139, 69,216, 49,210,131,224,254,232, +/* 0x04a0 */ 182,253,255,255,255,117,196,255,117,192, 86,232, 53, 2, 0, 0, +/* 0x04b0 */ 131,196, 12,133,192,116, 7,106,127,232, 11, 2, 0, 0,139, 69, +/* 0x04c0 */ 192, 3, 69,184,141, 28, 6, 59, 93,188,115, 33,106, 0,106,255, +/* 0x04d0 */ 104, 18, 16, 0, 0,255,117,196, 41, 93,188,255,117,188, 83,232, +/* 0x04e0 */ 192, 1, 0, 0,131,196, 24, 57,195,116, 33,235,202,131,125,220, +/* 0x04f0 */ 0,116, 25,139, 69,192,131,192, 3, 37,255, 15, 0, 0,131,248, +/* 0x0500 */ 3,119, 9, 80, 83,232,215, 1, 0, 0, 89, 91,139, 77,224,131, +/* 0x0510 */ 199, 32,255, 69,200, 15,183, 65, 44, 57, 69,200, 15,140, 24,254, +/* 0x0520 */ 255,255,131,125,220, 0,117, 15,255,117,228,232,173, 1, 0, 0, +/* 0x0530 */ 90,133,192,116, 21,235,128,139, 69,224,102,131,120, 16, 3,116, +/* 0x0540 */ 9,255,117,240,232,127, 1, 0, 0, 88,131,125, 16, 0,116, 8, +/* 0x0550 */ 139, 77,208,139, 85, 16,137, 10,139, 69,224,139, 64, 24, 1, 69, +/* 0x0560 */ 208,139, 69,208,141,101,244, 91, 94, 95,201,195, 85,137,229, 87, +/* 0x0570 */ 86, 83,131,236, 16,141, 85, 24,139, 69, 8,106, 0,139,125, 28, +/* 0x0580 */ 137, 69,236,139, 69, 16,139, 93, 32,141,119, 52,137, 69,232,131, +/* 0x0590 */ 192, 2,255,117,232,137, 69,228,141, 69, 32,232,221,251,255,255, +/* 0x05a0 */ 139, 69, 12,185, 0, 16, 0, 0,186, 6, 0, 0, 0,137, 69, 32, +/* 0x05b0 */ 139, 69,236, 41, 93, 36,232,159,252,255,255, 15,183, 79, 44,139, +/* 0x05c0 */ 69,236,186, 5, 0, 0, 0,232,142,252,255,255, 15,183, 79, 42, +/* 0x05d0 */ 139, 69,236,186, 4, 0, 0, 0,232,125,252,255,255,139, 77, 40, +/* 0x05e0 */ 3, 78, 8,186, 3, 0, 0, 0,139, 69,236,131,193, 52,232,103, +/* 0x05f0 */ 252,255,255,141, 69,240,255,117,228,137,250, 80,141, 69, 32,255, +/* 0x0600 */ 117,236, 80,139, 69,232,232,117,252,255,255,186, 9, 0, 0, 0, +/* 0x0610 */ 137,193,137,195,139, 69,236,232, 62,252,255,255,102,139, 79, 44, +/* 0x0620 */ 131,196, 24, 49,210,102,133,201,116,112,131, 62, 3,117, 96,106, +/* 0x0630 */ 0,139, 69,240,106, 0, 3, 70, 8, 80,232,154, 0, 0, 0,131, +/* 0x0640 */ 196, 12,133,192,137,195,120, 22,104, 0, 2, 0, 0, 87, 80,232, +/* 0x0650 */ 125, 0, 0, 0,131,196, 12, 61, 0, 2, 0, 0,116, 7,106,127, +/* 0x0660 */ 232,100, 0, 0, 0,141, 69,240,137,250,106, 0, 80,137,216,106, +/* 0x0670 */ 0,106, 0,232, 8,252,255,255,139, 77,240,137,195,139, 69,236, +/* 0x0680 */ 186, 7, 0, 0, 0,232,208,251,255,255,131,196, 16,235, 11, 66, +/* 0x0690 */ 15,183,193,131,198, 32, 57,194,124,144,141,101,244,137,216, 91, +/* 0x06a0 */ 94, 95,201,195, 85,137,229, 49,192, 80,255,117, 28, 80,255,117, +/* 0x06b0 */ 24,255,117, 20,255,117, 16,255,117, 12,255,117, 8, 80,176,197, +/* 0x06c0 */ 80, 80,176,198,205,128,201,195,195,176, 1, 15,182,192,205,128, +/* 0x06d0 */ 195,176, 3,235,246,176, 4,235,242,176, 5,235,238,176, 6,235, +/* 0x06e0 */ 234,176, 73,235,230,176, 74,235,226,176, 33,235,222,176, 20,235, +/* 0x06f0 */ 218,176, 92,235,214,176, 59,235,210,176, 2,235,206,176,130,235, +/* 0x0700 */ 202,176,116,235,198,176,240,235,194,176, 10,235,190,176, 7,235, +/* 0x0710 */ 186 +}; diff --git a/src/stub/i386-openbsd.elf-fold.h b/src/stub/i386-openbsd.elf-fold.h index 992d1ed1..692bb17a 100644 --- a/src/stub/i386-openbsd.elf-fold.h +++ b/src/stub/i386-openbsd.elf-fold.h @@ -1,5 +1,5 @@ /* i386-openbsd.elf-fold.h - created from i386-openbsd.elf-fold.bin, 2033 (0x7f1) bytes + created from i386-openbsd.elf-fold.bin, 2037 (0x7f5) bytes This file is part of the UPX executable compressor. @@ -31,137 +31,137 @@ */ -#define STUB_I386_OPENBSD_ELF_FOLD_SIZE 2033 -#define STUB_I386_OPENBSD_ELF_FOLD_ADLER32 0x94526218 -#define STUB_I386_OPENBSD_ELF_FOLD_CRC32 0xf97a3786 +#define STUB_I386_OPENBSD_ELF_FOLD_SIZE 2037 +#define STUB_I386_OPENBSD_ELF_FOLD_ADLER32 0x9fc663c6 +#define STUB_I386_OPENBSD_ELF_FOLD_CRC32 0xe41e59f7 -unsigned char stub_i386_openbsd_elf_fold[2033] = { +unsigned char stub_i386_openbsd_elf_fold[2037] = { /* 0x0000 */ 127, 69, 76, 70, 1, 1, 1, 12, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x0010 */ 2, 0, 3, 0, 1, 0, 0, 0,128, 16,192, 0, 52, 0, 0, 0, /* 0x0020 */ 0, 0, 0, 0, 0, 0, 0, 0, 52, 0, 32, 0, 2, 0, 0, 0, /* 0x0030 */ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 16,192, 0, -/* 0x0040 */ 0, 16,192, 0,241, 7, 0, 0,244, 7, 0, 0, 5, 0, 0, 0, -/* 0x0050 */ 0, 16, 0, 0, 1, 0, 0, 0,241, 7, 0, 0, 0, 0, 0, 0, +/* 0x0040 */ 0, 16,192, 0,245, 7, 0, 0,248, 7, 0, 0, 5, 0, 0, 0, +/* 0x0050 */ 0, 16, 0, 0, 1, 0, 0, 0,245, 7, 0, 0, 0, 0, 0, 0, /* 0x0060 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x0070 */ 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -/* 0x0080 */ 41,201,186,248, 2, 0, 0,137,230,137,231,232,137, 0, 0, 0, +/* 0x0080 */ 41,201,186,248, 2, 0, 0,137,230,137,231,232,144, 0, 0, 0, /* 0x0090 */ 137,230,209,234, 25,192, 41,193,141, 36,196,133,210,117,243,137, -/* 0x00a0 */ 231,232,115, 0, 0, 0,129,236, 0, 10, 0, 0, 83,139, 83, 72, +/* 0x00a0 */ 231,232,122, 0, 0, 0,129,236, 0, 10, 0, 0, 83,139, 83, 72, /* 0x00b0 */ 141,148, 26,255, 31, 0, 0,129,226, 0,240,255,255, 82, 41,192, -/* 0x00c0 */ 102,131,123, 16, 3,117, 1,146, 80,139,115, 24,141,131,196, 0, -/* 0x00d0 */ 0, 0, 41,198,139, 24,139, 72, 4,131,193, 12,141, 84, 36, 12, -/* 0x00e0 */ 96, 71,232, 76, 5, 0, 0,131,196, 36, 89, 91,129,196, 0, 10, -/* 0x00f0 */ 0, 0, 90,193,226, 12, 1,211, 80,106, 0,137,229, 41,217, 41, -/* 0x0100 */ 192, 81, 83, 80, 79, 60,175,175,117,252,255, 55, 49,255, 49,246, -/* 0x0110 */ 49,210, 49,201, 49,219,176, 73,195,173,171,173,171,133,192,117, -/* 0x0120 */ 250,173,171,133,192,117,250, 87,173,171,131,248, 32,115, 3, 15, -/* 0x0130 */ 179,194,133,192,173,171,117,240,131,239, 8, 1,201, 64,243,171, -/* 0x0140 */ 72,171,171, 95,195, 0, 0, 0, 85,137,229, 87, 86,137,206, 83, -/* 0x0150 */ 137,195, 57, 8,139,120, 4,115, 7,106,127,232, 73, 6, 0, 0, -/* 0x0160 */ 133,201,116, 8,138, 7, 71,136, 2, 66,226,248, 1,115, 4, 41, -/* 0x0170 */ 51,141,101,244, 91, 94, 95,201,195, 85,137,229, 87, 86,137,198, -/* 0x0180 */ 83,137,211,131,236, 24,139, 69, 8,139,125, 12,137, 69,220,131, -/* 0x0190 */ 58, 0, 15,132,182, 0, 0, 0,141, 85,228,185, 12, 0, 0, 0, -/* 0x01a0 */ 137,240,232,161,255,255,255,139, 69,228,139, 77,232,133,192,117, -/* 0x01b0 */ 19,129,249, 85, 80, 88, 33,117, 15,131, 62, 0, 15,132,140, 0, -/* 0x01c0 */ 0, 0,235, 4,133,201,117, 7,106,127,232,218, 5, 0, 0, 57, -/* 0x01d0 */ 193,119,245, 59, 3,119,241, 57,193,115, 86,137, 69,224,141, 69, -/* 0x01e0 */ 224,255,117,236, 80,255,115, 4, 81,255,118, 4,255, 85,220,131, -/* 0x01f0 */ 196, 20,133,192,117,210,139, 85,224, 59, 85,228,117,202,138, 69, -/* 0x0200 */ 237,132,192,116, 34,133,255,116, 30,129,250, 0, 2, 0, 0,119, -/* 0x0210 */ 4, 57, 19,117, 18, 15,182,192, 80, 15,182, 69,238, 80, 82,255, -/* 0x0220 */ 115, 4,255,215,131,196, 16,139, 69,232, 1, 70, 4, 41, 6,235, -/* 0x0230 */ 10,139, 83, 4,137,240,232, 13,255,255,255,139, 85,228,139, 3, -/* 0x0240 */ 1, 83, 4, 41,208,133,192,137, 3,233, 68,255,255,255,141,101, -/* 0x0250 */ 244, 91, 94, 95,201,195,133,192, 83,137,211,116, 29,168, 1,117, -/* 0x0260 */ 25,139, 16, 57,218,116, 7, 74,117, 11,133,219,116, 7,137, 24, -/* 0x0270 */ 137, 72, 4,235, 5,131,192, 8,235,231, 91,195, 85,137,229, 87, -/* 0x0280 */ 86, 83,131,236,104,137, 69,200,139, 69, 12,137, 85,196,139, 77, -/* 0x0290 */ 24,199, 69,228, 0, 0, 0, 0,137, 69,192,139, 69,196,137, 77, -/* 0x02a0 */ 184,139, 93,196,139,117,196,199, 69,232, 0, 0, 0, 0, 15,183, -/* 0x02b0 */ 72, 44,199, 69,220, 0, 0, 0, 0,139, 85, 16,199, 69,224, 0, -/* 0x02c0 */ 0, 0, 0, 3, 91, 28,199, 69,236,255,255,255,255, 15,183,118, -/* 0x02d0 */ 16,137, 85,188,137,202,199, 69,240,255,255,255,255, 74,137, 93, -/* 0x02e0 */ 180,137,117,176,199, 69,148, 0, 0, 0, 0,120, 62,137,206,131, -/* 0x02f0 */ 59, 1,117, 49,139, 67, 24,139, 75, 8,131,224, 1,141, 20,133, -/* 0x0300 */ 0, 0, 0, 0, 57, 76, 42,236,118, 11,139, 67, 16,137, 76, 42, -/* 0x0310 */ 236,137, 68, 21,228,139, 67, 20,141,125,220, 1,200, 57, 4, 58, -/* 0x0320 */ 115, 3,137, 4, 58,131,195, 32, 78,117,196,131,125,176, 2,116, -/* 0x0330 */ 63,129,125,220,255,255,255, 31,118, 54,139, 77, 8,139, 93, 8, -/* 0x0340 */ 139, 65, 4,137,194,137,193,139, 3,129,225,255,255,255, 3,129, -/* 0x0350 */ 226, 0, 0, 0,252, 37,255,255,255, 3, 57,193,118, 2,137,200, -/* 0x0360 */ 141,148, 2,255, 15, 0, 0,129,226, 0,240,255,255,137, 85,148, -/* 0x0370 */ 139,117, 8, 49,255,199, 69,144, 1, 0, 0, 0,137,117,152,141, -/* 0x0380 */ 69,236,139, 85,148,139,117,152,139, 28, 7,137,217,129,227, 0, -/* 0x0390 */ 240,255,255,129,225,255, 15, 0, 0, 3, 76, 47,228,137, 28, 7, -/* 0x03a0 */ 139, 68, 47,220, 1,194, 41,216,137, 22, 3, 93,148,106, 0, 5, -/* 0x03b0 */ 255, 15, 0, 0,106,255, 37, 0,240,255,255,104, 18, 16, 0, 0, -/* 0x03c0 */ 129,193,255, 15, 0, 0,106, 0,129,225, 0,240,255,255, 80,131, -/* 0x03d0 */ 198, 4, 83,137, 68, 47,220,137, 76, 47,228,232,164, 3, 0, 0, -/* 0x03e0 */ 137, 68, 61,212,131,196, 24,131,199, 4,255, 77,144,137,117,152, -/* 0x03f0 */ 121,141,139, 69,212,199, 69,168, 0, 0, 0, 0,139, 85,236,139, -/* 0x0400 */ 77,196, 41,208,102,131,121, 44, 0,137, 69,172, 15,132,236, 1, -/* 0x0410 */ 0, 0,139, 93,180,139, 3,131,248, 6,117, 34,131,125,192, 0, -/* 0x0420 */ 15,132,193, 1, 0, 0,139, 77,172,186, 3, 0, 0, 0, 3, 75, -/* 0x0430 */ 8,139, 69,188,232, 29,254,255,255,233,169, 1, 0, 0, 72, 15, -/* 0x0440 */ 133,162, 1, 0, 0,139,117,180,199, 69,164, 64, 98, 81,115,139, -/* 0x0450 */ 69,172, 3, 70, 8,139, 78, 24,139, 86, 20,131,225, 7,137, 69, -/* 0x0460 */ 208, 1,194,193,225, 2,211,109,164,137, 85,156,139, 78, 16,137, -/* 0x0470 */ 194,131,101,164, 7,129,226,255, 15, 0, 0,137, 77,204,141, 52, -/* 0x0480 */ 17,139, 77,180, 41,208,137, 69,160,139, 65, 4, 41,208,131,125, -/* 0x0490 */ 192, 0, 80,139, 69,200,116, 3,131,200,255,131,125,192, 1, 80, -/* 0x04a0 */ 25,192, 37, 0,240,255,255, 5, 18, 16, 0, 0,131,125,192, 0, -/* 0x04b0 */ 80,139, 69,164,116, 3,131,200, 2,131,125,192, 0, 80,137,240, -/* 0x04c0 */ 116, 3,141, 70, 3, 80,255,117,160,232,182, 2, 0, 0,131,196, -/* 0x04d0 */ 24, 57, 69,160, 15,133,188, 0, 0, 0,131,125,192, 0,116, 28, -/* 0x04e0 */ 246, 69,164, 4,139, 69,184,117, 2, 49,192, 80,139, 69,192,255, -/* 0x04f0 */ 117,200,141, 85,204,232,127,252,255,255, 95, 88,137,247,247,223, -/* 0x0500 */ 129,231,255, 15, 0, 0,246, 69,164, 2,116, 17,139, 69,160, 1, -/* 0x0510 */ 240,133,255,116, 8,137,249,198, 0, 0, 64,226,250,131,125,192, -/* 0x0520 */ 0,116,122,139, 93,180,131, 59, 1,117, 88,246, 67, 24, 1,116, -/* 0x0530 */ 82,139, 83, 20,137,216,139, 91, 8,141, 12, 26, 3, 77,172, 59, -/* 0x0540 */ 80, 16,117, 14,137,200,247,216, 37,255, 15, 0, 0,131,248, 3, -/* 0x0550 */ 119, 17,139, 85,180,107, 69,172, 52,131,122, 4, 0,141, 76, 3, -/* 0x0560 */ 12,117, 15,139, 1, 61,205,128,201,195,116, 6,199, 1,205,128, -/* 0x0570 */ 201,195,133,201,116, 13,139, 69,188, 49,210,131,224,254,232,211, -/* 0x0580 */ 252,255,255,255,117,164, 86,255,117,160,232, 54, 2, 0, 0,131, -/* 0x0590 */ 196, 12,133,192,116, 7,106,127,232, 12, 2, 0, 0,141, 4, 62, -/* 0x05a0 */ 139, 93,160, 1,195, 59, 93,156,115, 33,106, 0,106,255,104, 18, -/* 0x05b0 */ 16, 0, 0,255,117,164, 41, 93,156,255,117,156, 83,232,194, 1, -/* 0x05c0 */ 0, 0,131,196, 24, 57,195,116, 30,235,203,131,125,192, 0,116, -/* 0x05d0 */ 22,141, 70, 3, 37,255, 15, 0, 0,131,248, 3,119, 9, 80, 83, -/* 0x05e0 */ 232,220, 1, 0, 0, 89, 91,139, 77,196,255, 69,168, 15,183, 65, -/* 0x05f0 */ 44,131, 69,180, 32, 57, 69,168, 15,140, 20,254,255,255,131,125, -/* 0x0600 */ 192, 0,117, 13,255,117,200,232,177, 1, 0, 0, 90,133,192,117, -/* 0x0610 */ 133,131,125, 20, 0,116, 8,139,117,172,139, 93, 20,137, 51,139, -/* 0x0620 */ 69,196,139, 64, 24, 1, 69,172,139, 69,172,141,101,244, 91, 94, -/* 0x0630 */ 95,201,195, 85,137,229, 87, 86, 83,131,236, 24,141, 85, 24,139, -/* 0x0640 */ 69, 8,106, 0,139,125, 28,199, 69,232, 0, 0, 0, 0,137, 69, -/* 0x0650 */ 228,139, 69, 16,139, 93, 32,199, 69,236, 0, 0, 0, 0,137, 69, -/* 0x0660 */ 224,131,192, 2,255,117,224,137, 69,220,141, 69, 32,141,119, 52, -/* 0x0670 */ 232, 4,251,255,255,139, 69, 12,185, 0, 16, 0, 0,186, 6, 0, -/* 0x0680 */ 0, 0,137, 69, 32,139, 69,228, 41, 93, 36,232,198,251,255,255, -/* 0x0690 */ 15,183, 79, 44,139, 69,228,186, 5, 0, 0, 0,232,181,251,255, -/* 0x06a0 */ 255, 15,183, 79, 42,139, 69,228,186, 4, 0, 0, 0,232,164,251, -/* 0x06b0 */ 255,255,139, 77, 40, 3, 78, 8,186, 3, 0, 0, 0,139, 69,228, -/* 0x06c0 */ 131,193, 52,232,142,251,255,255,141, 69,240,255,117,220,137,250, -/* 0x06d0 */ 80,141, 69, 32,255,117,228, 80,141, 69,232, 80,139, 69,224,232, -/* 0x06e0 */ 152,251,255,255,186, 9, 0, 0, 0,137,193,137,195,139, 69,228, -/* 0x06f0 */ 232, 97,251,255,255,102,139, 79, 44,131,196, 28, 49,210,102,133, -/* 0x0700 */ 201,116,116,131, 62, 3,117,100,106, 0,139, 69,240,106, 0, 3, -/* 0x0710 */ 70, 8, 80,232,161, 0, 0, 0,131,196, 12,133,192,137,195,120, -/* 0x0720 */ 22,104, 0, 2, 0, 0, 87, 80,232,132, 0, 0, 0,131,196, 12, -/* 0x0730 */ 61, 0, 2, 0, 0,116, 7,106,127,232,107, 0, 0, 0,141, 69, -/* 0x0740 */ 240,137,250,106, 0, 80,106, 0,141, 69,232,106, 0, 80,137,216, -/* 0x0750 */ 232, 39,251,255,255,139, 77,240,137,195,139, 69,228,186, 7, 0, -/* 0x0760 */ 0, 0,232,239,250,255,255,131,196, 20,235, 11, 66, 15,183,193, -/* 0x0770 */ 131,198, 32, 57,194,124,140,141,101,244,137,216, 91, 94, 95,201, -/* 0x0780 */ 195, 0, 0, 0, 85,137,229, 49,192, 80,255,117, 28, 80,255,117, -/* 0x0790 */ 24,255,117, 20,255,117, 16,255,117, 12,255,117, 8, 80,176,197, -/* 0x07a0 */ 80, 80,176,198,205,128,201,195,195,176, 1, 15,182,192,205,128, -/* 0x07b0 */ 195,176, 3,235,246,176, 4,235,242,176, 5,235,238,176, 6,235, -/* 0x07c0 */ 234,176, 73,235,230,176, 74,235,226,176, 33,235,222,176, 20,235, -/* 0x07d0 */ 218,176, 92,235,214,176, 59,235,210,176, 2,235,206,176,130,235, -/* 0x07e0 */ 202,176,116,235,198,176,240,235,194,176, 10,235,190,176, 7,235, -/* 0x07f0 */ 186 +/* 0x00c0 */ 102,131,123, 16, 3,117, 1,146, 80,139,115, 24,139,131,136, 0, +/* 0x00d0 */ 0, 0,141,132, 24,172, 0, 0, 0, 41,198,139, 24,139, 72, 4, +/* 0x00e0 */ 131,193, 12,141, 84, 36, 12, 96, 71,232, 73, 5, 0, 0,131,196, +/* 0x00f0 */ 36, 89, 91,129,196, 0, 10, 0, 0, 90,193,226, 12, 1,211, 80, +/* 0x0100 */ 106, 0,137,229, 41,217, 41,192, 81, 83, 80, 79, 60,175,175,117, +/* 0x0110 */ 252,255, 55, 49,255, 49,246, 49,210, 49,201, 49,219,176, 73,195, +/* 0x0120 */ 173,171,173,171,133,192,117,250,173,171,133,192,117,250, 87,173, +/* 0x0130 */ 171,131,248, 32,115, 3, 15,179,194,133,192,173,171,117,240,131, +/* 0x0140 */ 239, 8, 1,201, 64,243,171, 72,171,171, 95,195, 85,137,229, 87, +/* 0x0150 */ 86,137,206, 83,137,195, 57, 8,139,120, 4,115, 7,106,127,232, +/* 0x0160 */ 73, 6, 0, 0,133,201,116, 8,138, 7, 71,136, 2, 66,226,248, +/* 0x0170 */ 1,115, 4, 41, 51,141,101,244, 91, 94, 95,201,195, 85,137,229, +/* 0x0180 */ 87, 86,137,198, 83,137,211,131,236, 24,139, 69, 8,139,125, 12, +/* 0x0190 */ 137, 69,220,131, 58, 0, 15,132,182, 0, 0, 0,141, 85,228,185, +/* 0x01a0 */ 12, 0, 0, 0,137,240,232,161,255,255,255,139, 69,228,139, 77, +/* 0x01b0 */ 232,133,192,117, 19,129,249, 85, 80, 88, 33,117, 15,131, 62, 0, +/* 0x01c0 */ 15,132,140, 0, 0, 0,235, 4,133,201,117, 7,106,127,232,218, +/* 0x01d0 */ 5, 0, 0, 57,193,119,245, 59, 3,119,241, 57,193,115, 86,137, +/* 0x01e0 */ 69,224,141, 69,224,255,117,236, 80,255,115, 4, 81,255,118, 4, +/* 0x01f0 */ 255, 85,220,131,196, 20,133,192,117,210,139, 85,224, 59, 85,228, +/* 0x0200 */ 117,202,138, 69,237,132,192,116, 34,133,255,116, 30,129,250, 0, +/* 0x0210 */ 2, 0, 0,119, 4, 57, 19,117, 18, 15,182,192, 80, 15,182, 69, +/* 0x0220 */ 238, 80, 82,255,115, 4,255,215,131,196, 16,139, 69,232, 1, 70, +/* 0x0230 */ 4, 41, 6,235, 10,139, 83, 4,137,240,232, 13,255,255,255,139, +/* 0x0240 */ 85,228,139, 3, 1, 83, 4, 41,208,133,192,137, 3,233, 68,255, +/* 0x0250 */ 255,255,141,101,244, 91, 94, 95,201,195,133,192, 83,137,211,116, +/* 0x0260 */ 29,168, 1,117, 25,139, 16, 57,218,116, 7, 74,117, 11,133,219, +/* 0x0270 */ 116, 7,137, 24,137, 72, 4,235, 5,131,192, 8,235,231, 91,195, +/* 0x0280 */ 85,137,229, 87, 86, 83,131,236,104,137, 69,200,139, 69, 12,137, +/* 0x0290 */ 85,196,139, 77, 24,199, 69,228, 0, 0, 0, 0,137, 69,192,139, +/* 0x02a0 */ 69,196,137, 77,184,139, 93,196,139,117,196,199, 69,232, 0, 0, +/* 0x02b0 */ 0, 0, 15,183, 72, 44,199, 69,220, 0, 0, 0, 0,139, 85, 16, +/* 0x02c0 */ 199, 69,224, 0, 0, 0, 0, 3, 91, 28,199, 69,236,255,255,255, +/* 0x02d0 */ 255, 15,183,118, 16,137, 85,188,137,202,199, 69,240,255,255,255, +/* 0x02e0 */ 255, 74,137, 93,180,137,117,176,199, 69,148, 0, 0, 0, 0,120, +/* 0x02f0 */ 62,137,206,131, 59, 1,117, 49,139, 67, 24,139, 75, 8,131,224, +/* 0x0300 */ 1,141, 20,133, 0, 0, 0, 0, 57, 76, 42,236,118, 11,139, 67, +/* 0x0310 */ 16,137, 76, 42,236,137, 68, 21,228,139, 67, 20,141,125,220, 1, +/* 0x0320 */ 200, 57, 4, 58,115, 3,137, 4, 58,131,195, 32, 78,117,196,131, +/* 0x0330 */ 125,176, 2,116, 63,129,125,220,255,255,255, 31,118, 54,139, 77, +/* 0x0340 */ 8,139, 93, 8,139, 65, 4,137,194,137,193,139, 3,129,225,255, +/* 0x0350 */ 255,255, 3,129,226, 0, 0, 0,252, 37,255,255,255, 3, 57,193, +/* 0x0360 */ 118, 2,137,200,141,148, 2,255, 15, 0, 0,129,226, 0,240,255, +/* 0x0370 */ 255,137, 85,148,139,117, 8, 49,255,199, 69,144, 1, 0, 0, 0, +/* 0x0380 */ 137,117,152,141, 69,236,139, 85,148,139,117,152,139, 28, 7,137, +/* 0x0390 */ 217,129,227, 0,240,255,255,129,225,255, 15, 0, 0, 3, 76, 47, +/* 0x03a0 */ 228,137, 28, 7,139, 68, 47,220, 1,194, 41,216,137, 22, 3, 93, +/* 0x03b0 */ 148,106, 0, 5,255, 15, 0, 0,106,255, 37, 0,240,255,255,104, +/* 0x03c0 */ 18, 16, 0, 0,129,193,255, 15, 0, 0,106, 0,129,225, 0,240, +/* 0x03d0 */ 255,255, 80,131,198, 4, 83,137, 68, 47,220,137, 76, 47,228,232, +/* 0x03e0 */ 164, 3, 0, 0,137, 68, 61,212,131,196, 24,131,199, 4,255, 77, +/* 0x03f0 */ 144,137,117,152,121,141,139, 69,212,199, 69,168, 0, 0, 0, 0, +/* 0x0400 */ 139, 85,236,139, 77,196, 41,208,102,131,121, 44, 0,137, 69,172, +/* 0x0410 */ 15,132,236, 1, 0, 0,139, 93,180,139, 3,131,248, 6,117, 34, +/* 0x0420 */ 131,125,192, 0, 15,132,193, 1, 0, 0,139, 77,172,186, 3, 0, +/* 0x0430 */ 0, 0, 3, 75, 8,139, 69,188,232, 29,254,255,255,233,169, 1, +/* 0x0440 */ 0, 0, 72, 15,133,162, 1, 0, 0,139,117,180,199, 69,164, 64, +/* 0x0450 */ 98, 81,115,139, 69,172, 3, 70, 8,139, 78, 24,139, 86, 20,131, +/* 0x0460 */ 225, 7,137, 69,208, 1,194,193,225, 2,211,109,164,137, 85,156, +/* 0x0470 */ 139, 78, 16,137,194,131,101,164, 7,129,226,255, 15, 0, 0,137, +/* 0x0480 */ 77,204,141, 52, 17,139, 77,180, 41,208,137, 69,160,139, 65, 4, +/* 0x0490 */ 41,208,131,125,192, 0, 80,139, 69,200,116, 3,131,200,255,131, +/* 0x04a0 */ 125,192, 1, 80, 25,192, 37, 0,240,255,255, 5, 18, 16, 0, 0, +/* 0x04b0 */ 131,125,192, 0, 80,139, 69,164,116, 3,131,200, 2,131,125,192, +/* 0x04c0 */ 0, 80,137,240,116, 3,141, 70, 3, 80,255,117,160,232,182, 2, +/* 0x04d0 */ 0, 0,131,196, 24, 57, 69,160, 15,133,188, 0, 0, 0,131,125, +/* 0x04e0 */ 192, 0,116, 28,246, 69,164, 4,139, 69,184,117, 2, 49,192, 80, +/* 0x04f0 */ 139, 69,192,255,117,200,141, 85,204,232,127,252,255,255, 95, 88, +/* 0x0500 */ 137,247,247,223,129,231,255, 15, 0, 0,246, 69,164, 2,116, 17, +/* 0x0510 */ 139, 69,160, 1,240,133,255,116, 8,137,249,198, 0, 0, 64,226, +/* 0x0520 */ 250,131,125,192, 0,116,122,139, 93,180,131, 59, 1,117, 88,246, +/* 0x0530 */ 67, 24, 1,116, 82,139, 83, 20,137,216,139, 91, 8,141, 12, 26, +/* 0x0540 */ 3, 77,172, 59, 80, 16,117, 14,137,200,247,216, 37,255, 15, 0, +/* 0x0550 */ 0,131,248, 3,119, 17,139, 85,180,107, 69,172, 52,131,122, 4, +/* 0x0560 */ 0,141, 76, 3, 12,117, 15,139, 1, 61,205,128,201,195,116, 6, +/* 0x0570 */ 199, 1,205,128,201,195,133,201,116, 13,139, 69,188, 49,210,131, +/* 0x0580 */ 224,254,232,211,252,255,255,255,117,164, 86,255,117,160,232, 54, +/* 0x0590 */ 2, 0, 0,131,196, 12,133,192,116, 7,106,127,232, 12, 2, 0, +/* 0x05a0 */ 0,141, 4, 62,139, 93,160, 1,195, 59, 93,156,115, 33,106, 0, +/* 0x05b0 */ 106,255,104, 18, 16, 0, 0,255,117,164, 41, 93,156,255,117,156, +/* 0x05c0 */ 83,232,194, 1, 0, 0,131,196, 24, 57,195,116, 30,235,203,131, +/* 0x05d0 */ 125,192, 0,116, 22,141, 70, 3, 37,255, 15, 0, 0,131,248, 3, +/* 0x05e0 */ 119, 9, 80, 83,232,220, 1, 0, 0, 89, 91,139, 77,196,255, 69, +/* 0x05f0 */ 168, 15,183, 65, 44,131, 69,180, 32, 57, 69,168, 15,140, 20,254, +/* 0x0600 */ 255,255,131,125,192, 0,117, 13,255,117,200,232,177, 1, 0, 0, +/* 0x0610 */ 90,133,192,117,133,131,125, 20, 0,116, 8,139,117,172,139, 93, +/* 0x0620 */ 20,137, 51,139, 69,196,139, 64, 24, 1, 69,172,139, 69,172,141, +/* 0x0630 */ 101,244, 91, 94, 95,201,195, 85,137,229, 87, 86, 83,131,236, 24, +/* 0x0640 */ 141, 85, 24,139, 69, 8,106, 0,139,125, 28,199, 69,232, 0, 0, +/* 0x0650 */ 0, 0,137, 69,228,139, 69, 16,139, 93, 32,199, 69,236, 0, 0, +/* 0x0660 */ 0, 0,137, 69,224,131,192, 2,255,117,224,137, 69,220,141, 69, +/* 0x0670 */ 32,141,119, 52,232, 4,251,255,255,139, 69, 12,185, 0, 16, 0, +/* 0x0680 */ 0,186, 6, 0, 0, 0,137, 69, 32,139, 69,228, 41, 93, 36,232, +/* 0x0690 */ 198,251,255,255, 15,183, 79, 44,139, 69,228,186, 5, 0, 0, 0, +/* 0x06a0 */ 232,181,251,255,255, 15,183, 79, 42,139, 69,228,186, 4, 0, 0, +/* 0x06b0 */ 0,232,164,251,255,255,139, 77, 40, 3, 78, 8,186, 3, 0, 0, +/* 0x06c0 */ 0,139, 69,228,131,193, 52,232,142,251,255,255,141, 69,240,255, +/* 0x06d0 */ 117,220,137,250, 80,141, 69, 32,255,117,228, 80,141, 69,232, 80, +/* 0x06e0 */ 139, 69,224,232,152,251,255,255,186, 9, 0, 0, 0,137,193,137, +/* 0x06f0 */ 195,139, 69,228,232, 97,251,255,255,102,139, 79, 44,131,196, 28, +/* 0x0700 */ 49,210,102,133,201,116,116,131, 62, 3,117,100,106, 0,139, 69, +/* 0x0710 */ 240,106, 0, 3, 70, 8, 80,232,161, 0, 0, 0,131,196, 12,133, +/* 0x0720 */ 192,137,195,120, 22,104, 0, 2, 0, 0, 87, 80,232,132, 0, 0, +/* 0x0730 */ 0,131,196, 12, 61, 0, 2, 0, 0,116, 7,106,127,232,107, 0, +/* 0x0740 */ 0, 0,141, 69,240,137,250,106, 0, 80,106, 0,141, 69,232,106, +/* 0x0750 */ 0, 80,137,216,232, 39,251,255,255,139, 77,240,137,195,139, 69, +/* 0x0760 */ 228,186, 7, 0, 0, 0,232,239,250,255,255,131,196, 20,235, 11, +/* 0x0770 */ 66, 15,183,193,131,198, 32, 57,194,124,140,141,101,244,137,216, +/* 0x0780 */ 91, 94, 95,201,195, 0, 0, 0, 85,137,229, 49,192, 80,255,117, +/* 0x0790 */ 28, 80,255,117, 24,255,117, 20,255,117, 16,255,117, 12,255,117, +/* 0x07a0 */ 8, 80,176,197, 80, 80,176,198,205,128,201,195,195,176, 1, 15, +/* 0x07b0 */ 182,192,205,128,195,176, 3,235,246,176, 4,235,242,176, 5,235, +/* 0x07c0 */ 238,176, 6,235,234,176, 73,235,230,176, 74,235,226,176, 33,235, +/* 0x07d0 */ 222,176, 20,235,218,176, 92,235,214,176, 59,235,210,176, 2,235, +/* 0x07e0 */ 206,176,130,235,202,176,116,235,198,176,240,235,194,176, 10,235, +/* 0x07f0 */ 190,176, 7,235,186 }; diff --git a/src/stub/scripts/brandelf.py b/src/stub/scripts/brandelf.py index 1ca117ff..77aa2340 100644 --- a/src/stub/scripts/brandelf.py +++ b/src/stub/scripts/brandelf.py @@ -69,6 +69,10 @@ def do_file(fn): raise Exception, "%s is not %s" % (fn, opts.bfdname) ##write("\x00Linux\x00\x00\x00") write("\x00" * 9) + def brand_netbsd(s): + if e_ident[4:7] != s: + raise Exception, "%s is not %s" % (fn, opts.bfdname) + write("\x02") def brand_openbsd(s): if e_ident[4:7] != s: raise Exception, "%s is not %s" % (fn, opts.bfdname) @@ -84,6 +88,8 @@ def do_file(fn): brand_freebsd("\x01\x01\x01") elif opts.bfdname == "elf32-i386" and opts.elfosabi == "linux": brand_linux("\x01\x01\x01") + elif opts.bfdname == "elf32-i386" and opts.elfosabi == "netbsd": + brand_openbsd("\x01\x01\x01") elif opts.bfdname == "elf32-i386" and opts.elfosabi == "openbsd": brand_openbsd("\x01\x01\x01") elif opts.bfdname == "elf32-littlearm" and opts.elfosabi == "arm": diff --git a/src/stub/src/i386-openbsd.elf-fold.S b/src/stub/src/i386-openbsd.elf-fold.S index 1128b631..1cdce9c0 100644 --- a/src/stub/src/i386-openbsd.elf-fold.S +++ b/src/stub/src/i386-openbsd.elf-fold.S @@ -37,7 +37,6 @@ #define e_type 16 #define e_entry (16 + 2*2 + 4) #define p_memsz 5*4 -#define sznote 0x18 #define szb_info 12 #define szl_info 12 #define szp_info 12 @@ -115,7 +114,8 @@ L53: push eax // dynbase mov esi, [e_entry + ebx] // end of compressed data - lea eax, [szElf32_Ehdr + 3*szElf32_Phdr + sznote + szl_info + szp_info + ebx] // 1st &b_info + mov eax, [szElf32_Ehdr + 2*szElf32_Phdr + p_memsz + ebx] // PT_NOTE.p_memsz + lea eax, [szElf32_Ehdr + 3*szElf32_Phdr + eax + szl_info + szp_info + ebx] // 1st &b_info sub esi, eax // length of compressed data mov ebx, [ eax] // length of uncompressed ELF headers mov ecx, [4+ eax] // length of compressed ELF headers diff --git a/src/stub/tmp/i386-netbsd.elf-fold.bin b/src/stub/tmp/i386-netbsd.elf-fold.bin new file mode 100644 index 0000000000000000000000000000000000000000..672f893f71b81aeadb67217b5eb9afeced6b29a7 GIT binary patch literal 1809 zcmZuyZEO@p7@oaddRI8O6Ap5iiY=*$XZpj7HRdcJ5{DMT*@bgkKCGaTO3s)VZ`a~S zEp@nrVOT>9zx-qLm!>vsV&tPiv&Ws+j{rFffdZ8rwZOtwJVk3Q$oS4dqd%NvJDq3V zci!jyye_7l{xASz zsKoh(h}}-!3(AJ{vC2|mM)rWLxjXz7Y>_+*vnGXP{N@X_{%wuU2MR(YSG#FTcTPOE zIWy*$POC{ouSCvA?DYw?dD+2(#vT4tlt(9{!_mR$MQcsAx2Lx!Z5z|~{oV-M81)?Hbe1e`P6JdsZtkX~ND0vzMb{`U+XyZpkVra?vjC0QLIEy<# zW9HRhx*>RuYAO^Q2< z*gp5#mU|&ckcnj!yu&`K6|w3J z({JQhbBN~2_MBJBP|cz7V>Hu!S&*W5LK=#k5=N+I>yad4IG5x*=7XnXz@yRvv1PTz zIS+XQwy}I5eOc5)Eo)RF11dMhlk>Teh`x|?9zjgAO=Xc@$>K-y2(28O7X0+L$TO0Wm~0G7 zdYrX}*jAtEe^8DW8d`(KJUVdyAu=U*%zGUd>PeS^%yqKg2ry~+$z6k4y`o4J-mq%(+g9~1%8f^@d1+Ld7m7a-X)9Z{YSQ0qZc6WtEE?5u(W zGaO`X)n-RM#SXDO+;E^5OkC~!cw02R|EQR$eHD;0imMr(h_ux@pWfj-aJab+j(uY6 zIv?Ew9uok}0OWK6z~Ya}&-=5GOfE2hHwWv_njeR@Lde2QC-Ka++QR z04&n!BvR=JqzE~_GPP3KP@njna0=ilOc;00s=(n4$ydjYzrP=%Mn`7GB-AE1s^ANA zBgBm$H~if2sn++ZYUM@IWGxBCz{y=%OLiwM#r@5i<=(U^+#A*!_o}tl9kXiOOIFCe iV7=&`wHn-E%j2H1K6HmH-OXDi_qa9N{m$~beg6QA{s;B| literal 0 HcmV?d00001 diff --git a/src/stub/tmp/i386-netbsd.elf-fold.map b/src/stub/tmp/i386-netbsd.elf-fold.map new file mode 100644 index 00000000..c09e9633 --- /dev/null +++ b/src/stub/tmp/i386-netbsd.elf-fold.map @@ -0,0 +1,55 @@ + +Memory Configuration + +Name Origin Length Attributes +*default* 0x0000000000000000 0xffffffffffffffff + +Linker script and memory map + +TARGET(elf32-i386) + 0x0000000000c01080 . = ((0xc01000 + SIZEOF_HEADERS) + 0xc) + +.text 0x0000000000c01080 0x694 + *(.text) + .text 0x0000000000c01080 0xcc tmp/i386-openbsd.elf-fold.o + .text 0x0000000000c0114c 0x558 tmp/i386-bsd.elf-main.o + 0x0000000000c0156c upx_main + .text 0x0000000000c016a4 0x6d tmp/i386-bsd.syscall.o + 0x0000000000c0170d waitpid + 0x0000000000c016e1 munmap + 0x0000000000c016f5 execve + 0x0000000000c016ed getpid + 0x0000000000c016fd ftruncate + 0x0000000000c016a4 mmap + 0x0000000000c01705 nanosleep + 0x0000000000c016d5 write + 0x0000000000c016d1 read + 0x0000000000c01709 unlink + 0x0000000000c016f9 fork + 0x0000000000c01701 gettimeofday + 0x0000000000c016e9 access + 0x0000000000c016c9 exit + 0x0000000000c016c8 brk + 0x0000000000c016d9 open + 0x0000000000c016e5 mprotect + 0x0000000000c016f1 fcntl + 0x0000000000c016dd close + *(.data) + *fill* 0x0000000000c01711 0x3 00 + .data 0x0000000000c01714 0x0 tmp/i386-openbsd.elf-fold.o + .data 0x0000000000c01714 0x0 tmp/i386-bsd.elf-main.o + .data 0x0000000000c01714 0x0 tmp/i386-bsd.syscall.o + +.data + +.bss 0x0000000000c01714 0x0 + .bss 0x0000000000c01714 0x0 tmp/i386-openbsd.elf-fold.o + .bss 0x0000000000c01714 0x0 tmp/i386-bsd.elf-main.o + .bss 0x0000000000c01714 0x0 tmp/i386-bsd.syscall.o + +.rel.dyn 0x0000000000c01714 0x0 + .rel.text 0x0000000000000000 0x0 tmp/i386-openbsd.elf-fold.o +LOAD tmp/i386-openbsd.elf-fold.o +LOAD tmp/i386-bsd.elf-main.o +LOAD tmp/i386-bsd.syscall.o +OUTPUT(tmp/i386-netbsd.elf-fold.bin elf32-i386)