From 10dc580a3a50d58a6e3345762a8b7a6ec8140bb4 Mon Sep 17 00:00:00 2001 From: John Reiser Date: Mon, 8 Jan 2007 13:56:47 -0800 Subject: [PATCH] tweak i386-linux.kernel.vmlinux-head.S --- src/p_vmlinx.cpp | 3 +-- src/stub/amd64-linux.kernel.vmlinux-head.h | 16 ++++++++-------- src/stub/i386-linux.kernel.vmlinux-head.h | 16 ++++++++-------- src/stub/src/i386-linux.kernel.vmlinux-head.S | 2 ++ 4 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/p_vmlinx.cpp b/src/p_vmlinx.cpp index 7c006f28..7fdc111e 100644 --- a/src/p_vmlinx.cpp +++ b/src/p_vmlinx.cpp @@ -954,7 +954,7 @@ bool PackVmlinuxAMD64::has_valid_vmlinux_head() // // Example test jig: -// $ gcc -o test-piggy -nostartfiles -nostdlib test-piggy.o piggy.o +// $ gcc -m32 -o test-piggy -nostartfiles -nostdlib test-piggy.o piggy.o // $ gdb test-piggy // (gdb) run >dumped // (gdb) /* Execute [single step, etc.; the decompressor+unfilter moves!] @@ -1000,7 +1000,6 @@ bool PackVmlinuxAMD64::has_valid_vmlinux_head() // pushl $0x100000 # 1MB address // call mmap // leal -0x9000(%esp),%esi # expect "lea 0x9000(%esi),%esp" later -// push %cs ///* Fall into .text of upx-compressed vmlinux. */ //----- diff --git a/src/stub/amd64-linux.kernel.vmlinux-head.h b/src/stub/amd64-linux.kernel.vmlinux-head.h index 88e1dd32..a679acc9 100644 --- a/src/stub/amd64-linux.kernel.vmlinux-head.h +++ b/src/stub/amd64-linux.kernel.vmlinux-head.h @@ -1,5 +1,5 @@ /* amd64-linux.kernel.vmlinux-head.h - created from amd64-linux.kernel.vmlinux-head.bin, 33 (0x21) bytes + created from amd64-linux.kernel.vmlinux-head.bin, 37 (0x25) bytes This file is part of the UPX executable compressor. @@ -28,12 +28,12 @@ */ -#define STUB_AMD64_LINUX_KERNEL_VMLINUX_HEAD_SIZE 33 -#define STUB_AMD64_LINUX_KERNEL_VMLINUX_HEAD_ADLER32 0x206f1291 -#define STUB_AMD64_LINUX_KERNEL_VMLINUX_HEAD_CRC32 0x5b6874bd +#define STUB_AMD64_LINUX_KERNEL_VMLINUX_HEAD_SIZE 37 +#define STUB_AMD64_LINUX_KERNEL_VMLINUX_HEAD_ADLER32 0x81fb1575 +#define STUB_AMD64_LINUX_KERNEL_VMLINUX_HEAD_CRC32 0xf78f5286 -unsigned char stub_amd64_linux_kernel_vmlinux_head[33] = { -140,200,131,192, 8,142,216,142,192,141,142, 0,144, 0, 0,137, /* 0x 0 */ - 73,248,137, 65,252, 15,178, 97,248,106, 0,157,232,252,255,255, /* 0x 10 */ -255 /* 0x 20 */ +unsigned char stub_amd64_linux_kernel_vmlinux_head[37] = { +140,200,131,192, 8,142,216,142,192,142,224,142,232,141,142, 0, /* 0x 0 */ +144, 0, 0,137, 73,248,137, 65,252, 15,178, 97,248,106, 0,157, /* 0x 10 */ +232,252,255,255,255 /* 0x 20 */ }; diff --git a/src/stub/i386-linux.kernel.vmlinux-head.h b/src/stub/i386-linux.kernel.vmlinux-head.h index e4bd288f..f06153b8 100644 --- a/src/stub/i386-linux.kernel.vmlinux-head.h +++ b/src/stub/i386-linux.kernel.vmlinux-head.h @@ -1,5 +1,5 @@ /* i386-linux.kernel.vmlinux-head.h - created from i386-linux.kernel.vmlinux-head.bin, 33 (0x21) bytes + created from i386-linux.kernel.vmlinux-head.bin, 37 (0x25) bytes This file is part of the UPX executable compressor. @@ -28,12 +28,12 @@ */ -#define STUB_I386_LINUX_KERNEL_VMLINUX_HEAD_SIZE 33 -#define STUB_I386_LINUX_KERNEL_VMLINUX_HEAD_ADLER32 0x206f1291 -#define STUB_I386_LINUX_KERNEL_VMLINUX_HEAD_CRC32 0x5b6874bd +#define STUB_I386_LINUX_KERNEL_VMLINUX_HEAD_SIZE 37 +#define STUB_I386_LINUX_KERNEL_VMLINUX_HEAD_ADLER32 0x81fb1575 +#define STUB_I386_LINUX_KERNEL_VMLINUX_HEAD_CRC32 0xf78f5286 -unsigned char stub_i386_linux_kernel_vmlinux_head[33] = { -140,200,131,192, 8,142,216,142,192,141,142, 0,144, 0, 0,137, /* 0x 0 */ - 73,248,137, 65,252, 15,178, 97,248,106, 0,157,232,252,255,255, /* 0x 10 */ -255 /* 0x 20 */ +unsigned char stub_i386_linux_kernel_vmlinux_head[37] = { +140,200,131,192, 8,142,216,142,192,142,224,142,232,141,142, 0, /* 0x 0 */ +144, 0, 0,137, 73,248,137, 65,252, 15,178, 97,248,106, 0,157, /* 0x 10 */ +232,252,255,255,255 /* 0x 20 */ }; diff --git a/src/stub/src/i386-linux.kernel.vmlinux-head.S b/src/stub/src/i386-linux.kernel.vmlinux-head.S index e0579374..7a944596 100644 --- a/src/stub/src/i386-linux.kernel.vmlinux-head.S +++ b/src/stub/src/i386-linux.kernel.vmlinux-head.S @@ -36,6 +36,8 @@ movl %cs,%eax; addl $1<<3,%eax # the next segment after %cs movl %eax,%ds movl %eax,%es + movl %eax,%fs + movl %eax,%gs leal 0x9000(%esi),%ecx # 0x99000 typical movl %ecx,-8(%ecx) # 32-bit offset for stack pointer movl %eax,-4(%ecx) # segment for stack pointer