Workaround inconsistent SIZEOF_HEADERS in stub/*.lds.
Test with --force-execve and --no-filter. p_lx_exc.cpp p_lx_sh.cpp stub/l_lx_sh86.asm stub/l_lx_sh86.h committer: jreiser <jreiser> 1144381286 +0000
This commit is contained in:
parent
c7b8a4b0c1
commit
243873cd2d
@ -260,8 +260,12 @@ PackLinuxI386::buildLinuxLoader(
|
||||
unsigned fold_hdrlen = 0;
|
||||
if (0 < szfold) {
|
||||
cprElfHdr1 const *const hf = (cprElfHdr1 const *)fold;
|
||||
fold_hdrlen = umax(0x80, sizeof(hf->ehdr) +
|
||||
hf->ehdr.e_phentsize * hf->ehdr.e_phnum + sizeof(l_info) );
|
||||
fold_hdrlen = sizeof(hf->ehdr) + hf->ehdr.e_phentsize * hf->ehdr.e_phnum +
|
||||
sizeof(l_info);
|
||||
if (0==*(int *)(fold_hdrlen + fold)) {
|
||||
// inconsistent SIZEOF_HEADERS in *.lds (ld, binutils)
|
||||
fold_hdrlen = umax(0x80, fold_hdrlen);
|
||||
}
|
||||
h.sz_unc = (szfold < fold_hdrlen) ? 0 : (szfold - fold_hdrlen);
|
||||
h.b_method = (unsigned char) ph.method;
|
||||
h.b_ftid = (unsigned char) ph.filter;
|
||||
@ -362,6 +366,9 @@ PackLinuxI386::buildLinuxLoader(
|
||||
addLoader("LEXEC017", NULL);
|
||||
}
|
||||
}
|
||||
else {
|
||||
addLoader("LEXEC017", NULL);
|
||||
}
|
||||
|
||||
addLoader("IDENTSTR", NULL);
|
||||
addLoader("LEXEC020", NULL);
|
||||
@ -402,7 +409,14 @@ PackLinuxI386::buildLoader(Filter const *ft)
|
||||
|
||||
// filter
|
||||
optimizeFilter(&fold_ft, buf, sz_fold);
|
||||
bool success = fold_ft.filter(buf + sizeof(cprElfHdr2), sz_fold - sizeof(cprElfHdr2));
|
||||
|
||||
unsigned fold_hdrlen = sizeof(l_info) + sizeof(Elf32_Ehdr) +
|
||||
sizeof(Elf32_Phdr) * get_native32(&((Elf32_Ehdr const *)(void *)buf)->e_phnum);
|
||||
if (0==*(int *)(fold_hdrlen + buf)) {
|
||||
// inconsistent SIZEOF_HEADERS in *.lds (ld, binutils)
|
||||
fold_hdrlen = umax(0x80, fold_hdrlen);
|
||||
}
|
||||
bool success = fold_ft.filter(buf + fold_hdrlen, sz_fold - fold_hdrlen);
|
||||
(void)success;
|
||||
|
||||
return buildLinuxLoader(
|
||||
@ -410,6 +424,7 @@ PackLinuxI386::buildLoader(Filter const *ft)
|
||||
buf, sz_fold, ft );
|
||||
}
|
||||
|
||||
// FIXME: getLoaderPrefixSize is unused?
|
||||
int PackLinuxI386::getLoaderPrefixSize() const
|
||||
{
|
||||
return 116;
|
||||
|
||||
@ -59,6 +59,15 @@ PackLinuxI386sh::~PackLinuxI386sh()
|
||||
{
|
||||
}
|
||||
|
||||
static unsigned
|
||||
umax(unsigned a, unsigned b)
|
||||
{
|
||||
if (a <= b) {
|
||||
return b;
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
int
|
||||
PackLinuxI386sh::buildLoader(Filter const *ft)
|
||||
{
|
||||
@ -78,7 +87,13 @@ PackLinuxI386sh::buildLoader(Filter const *ft)
|
||||
|
||||
// filter
|
||||
optimizeFilter(&fold_ft, buf, sz_fold);
|
||||
bool success = fold_ft.filter(buf + sizeof(cprElfHdr2), sz_fold - sizeof(cprElfHdr2));
|
||||
unsigned fold_hdrlen = sizeof(l_info) + sizeof(Elf32_Ehdr) +
|
||||
sizeof(Elf32_Phdr) * get_native32(&((Elf32_Ehdr const *)(void *)buf)->e_phnum);
|
||||
if (0==*(int *)(fold_hdrlen + buf)) {
|
||||
// inconsistent SIZEOF_HEADERS in *.lds (ld, binutils)
|
||||
fold_hdrlen = umax(0x80, fold_hdrlen);
|
||||
}
|
||||
bool success = fold_ft.filter(buf + fold_hdrlen, sz_fold - fold_hdrlen);
|
||||
UNUSED(success);
|
||||
|
||||
return buildLinuxLoader(
|
||||
|
||||
@ -107,6 +107,7 @@ decompress:
|
||||
mov [edx], edi
|
||||
|
||||
mov [7*4 + esp], eax
|
||||
;__LEXEC017__
|
||||
popa
|
||||
ret
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/* l_lx_sh86.h -- created from l_lx_sh86.bin, 4403 (0x1133) bytes
|
||||
/* l_lx_sh86.h -- created from l_lx_sh86.bin, 4416 (0x1140) bytes
|
||||
|
||||
This file is part of the UPX executable compressor.
|
||||
|
||||
@ -27,11 +27,11 @@
|
||||
*/
|
||||
|
||||
|
||||
#define LINUX_I386SH_LOADER_SIZE 4403
|
||||
#define LINUX_I386SH_LOADER_ADLER32 0xa08bedc6
|
||||
#define LINUX_I386SH_LOADER_CRC32 0x64e997fc
|
||||
#define LINUX_I386SH_LOADER_SIZE 4416
|
||||
#define LINUX_I386SH_LOADER_ADLER32 0x93e2f039
|
||||
#define LINUX_I386SH_LOADER_CRC32 0x1614a613
|
||||
|
||||
unsigned char linux_i386sh_loader[4403] = {
|
||||
unsigned char linux_i386sh_loader[4416] = {
|
||||
232, 0, 0, 0, 0, 96,139,116, 36, 36,139,124, 36, 44,131,205, /* 0x 0 */
|
||||
255,235, 0,164,235, 0,138, 6, 70,136, 7, 71, 1,219,117, 7, /* 0x 10 */
|
||||
139, 30,131,238,252, 17,219,114, 0, 49,192, 64,138, 7,114, 0, /* 0x 20 */
|
||||
@ -305,7 +305,7 @@ unsigned char linux_i386sh_loader[4403] = {
|
||||
70, 4, 0, 0, 0, 0, 0, 0, 75, 4, 0, 0, 67, 65, 76, 76, /* 0x10e0 */
|
||||
84, 82, 49, 48, 0, 5, 0, 0, 0, 67, 84, 84, 72, 69, 69, 78, /* 0x10f0 */
|
||||
68, 0, 75, 4, 0, 0, 76, 69, 88, 69, 67, 48, 49, 53, 0, 75, /* 0x1100 */
|
||||
4, 0, 0, 76, 69, 88, 69, 67, 48, 50, 48, 0,104, 4, 0, 0, /* 0x1110 */
|
||||
88, 84, 72, 69, 69, 78, 68, 88, 0,171, 4, 0, 0,255,255,255, /* 0x1120 */
|
||||
255,171, 4 /* 0x1130 */
|
||||
4, 0, 0, 76, 69, 88, 69, 67, 48, 49, 55, 0,102, 4, 0, 0, /* 0x1110 */
|
||||
76, 69, 88, 69, 67, 48, 50, 48, 0,104, 4, 0, 0, 88, 84, 72, /* 0x1120 */
|
||||
69, 69, 78, 68, 88, 0,171, 4, 0, 0,255,255,255,255,171, 4 /* 0x1130 */
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user