From 959aaebede4e35211b6b73b96f70fe4d9ecbc12a Mon Sep 17 00:00:00 2001 From: John Reiser Date: Mon, 2 Jul 2007 14:27:31 -0700 Subject: [PATCH] bvmlinuz piggy.o need not be last in bzImage --- src/p_vmlinz.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/p_vmlinz.cpp b/src/p_vmlinz.cpp index 44813160..72728395 100644 --- a/src/p_vmlinz.cpp +++ b/src/p_vmlinz.cpp @@ -208,7 +208,11 @@ int PackVmlinuzI386::decompressKernel() if (fd_pos != file_size) { //printf("fd_pos: %ld, file_size: %ld\n", (long)fd_pos, (long)file_size); - throwCantPack("trailing bytes after kernel image; use option '-f' to force packing"); + + // linux-2.6.21.5/arch/i386/boot/compressed/vmlinux.lds + // puts .data.compressed ahead of .text, .rodata, etc; + // so piggy.o need not be last in bzImage. Alas. + //throwCantPack("trailing bytes after kernel image; use option '-f' to force packing"); } @@ -216,11 +220,12 @@ int PackVmlinuzI386::decompressKernel() // 2.4.x: [cli;] cld; mov $...,%eax if (memcmp(ibuf, "\xFC\xB8", 2) == 0) goto head_ok; if (memcmp(ibuf, "\xFA\xFC\xB8", 3) == 0) goto head_ok; + // 2.6.21.5 CONFIG_PARAVIRT mov %cs,%eax; test $3,%eax; jne ...; + if (memcmp(ibuf, "\x8c\xc8\xa9\x03\x00\x00\x00\x0f\x85", 9) == 0) goto head_ok; + if (memcmp(ibuf, "\x8c\xc8\xa8\x03\x0f\x85", 6) == 0) goto head_ok; // 2.6.x: [cli;] cld; lgdt ... if (memcmp(ibuf, "\xFC\x0F\x01", 3) == 0) goto head_ok; if (memcmp(ibuf, "\xFA\xFC\x0F\x01", 4) == 0) goto head_ok; - // 2.6.21.5 CONFIG_PARAVIRT mov %cs,%eax; test $3,%eax; jne ...; - if (memcmp(ibuf, "\x8c\xc8\xa9\x03\x00\x00\x00\x0f\x85", 9) == 0) goto head_ok; // 2.6.x+grsecurity+strongswan+openwall+trustix: ljmp $0x10,... if (ibuf[0] == 0xEA && memcmp(ibuf+5, "\x10\x00", 2) == 0) goto head_ok; // x86_64 2.6.x