1
0
mirror of https://github.com/upx/upx synced 2025-09-28 19:06:07 +08:00

Linux kernels must be ET_EXEC

This commit is contained in:
John Reiser 2010-03-09 09:20:46 -08:00
parent ffb60d5149
commit 5895058a17

View File

@ -86,14 +86,16 @@ PackLinuxElf32::checkEhdr(Elf32_Ehdr const *ehdr) const
if (get_te16(&ehdr->e_phentsize) != sizeof(Elf32_Phdr)) if (get_te16(&ehdr->e_phentsize) != sizeof(Elf32_Phdr))
return 6; return 6;
// check for Linux kernels if (type == Elf32_Ehdr::ET_EXEC) {
unsigned const entry = get_te32(&ehdr->e_entry); // check for Linux kernels
if (entry == 0xC0100000) // uncompressed vmlinux unsigned const entry = get_te32(&ehdr->e_entry);
return 1000; if (entry == 0xC0100000) // uncompressed vmlinux
if (entry == 0x00001000) // compressed vmlinux return 1000;
return 1001; if (entry == 0x00001000) // compressed vmlinux
if (entry == 0x00100000) // compressed bvmlinux return 1001;
return 1002; if (entry == 0x00100000) // compressed bvmlinux
return 1002;
}
// FIXME: add more checks for kernels // FIXME: add more checks for kernels