Change class PackLinuxI386elf : public PackLinuxI386

into   class PackLinuxElf32x86 : public PackLinuxElf32Le : public PackLinuxElf32
which makes the code for compressing ELF (for direct-to-memory decompression)
cleaner because ELF has some of the class tree to itself.
This assumes PROT_EXEC|PROT_WRITE ought to work.
This is checked at runtime, and if it fails then
give a message on stderr and exit(127).

Modify --force-execve so that runtime avoids PROT_EXEC|PROT_WRITE.
Then executables compressed with --force-execve will run under
PaX, grSecurity, and strict SELinux.
This commit is contained in:
John Reiser
2006-05-21 13:58:24 -07:00
parent 69a00c0ab3
commit d2718e99a4
26 changed files with 1049 additions and 969 deletions
+7 -7
View File
@@ -55,16 +55,16 @@ static const
static const
#include "stub/fold_pti86.h"
PackLinuxI386interp::PackLinuxI386interp(InputFile *f) :
PackLinuxElf32x86interp::PackLinuxElf32x86interp(InputFile *f) :
super(f)
{
}
PackLinuxI386interp::~PackLinuxI386interp()
PackLinuxElf32x86interp::~PackLinuxElf32x86interp()
{
}
bool PackLinuxI386interp::canPack()
bool PackLinuxElf32x86interp::canPack()
{
if (opt->o_unix.make_ptinterp) {
return true;
@@ -75,7 +75,7 @@ bool PackLinuxI386interp::canPack()
return super::canPack();
}
void PackLinuxI386interp::pack1(OutputFile *fo, Filter &)
void PackLinuxElf32x86interp::pack1(OutputFile *fo, Filter &)
{
fi->seek(0, SEEK_SET);
fi->readx(&ehdri, sizeof(ehdri));
@@ -124,7 +124,7 @@ void PackLinuxI386interp::pack1(OutputFile *fo, Filter &)
#undef E
}
void PackLinuxI386interp::pack2(OutputFile *fo, Filter &ft)
void PackLinuxElf32x86interp::pack2(OutputFile *fo, Filter &ft)
{
if (opt->o_unix.make_ptinterp) {
return; // ignore current input file!
@@ -135,7 +135,7 @@ void PackLinuxI386interp::pack2(OutputFile *fo, Filter &ft)
#undef PAGE_MASK
#define PAGE_MASK (~0u<<12)
void PackLinuxI386interp::pack3(OutputFile *fo, Filter &/*ft*/)
void PackLinuxElf32x86interp::pack3(OutputFile *fo, Filter &/*ft*/)
{
unsigned base = getbase(phdri, ehdri.e_phnum);
unsigned sz = PAGE_MASK & (~PAGE_MASK + elfout.phdr[0].p_filesz);
@@ -194,7 +194,7 @@ void PackLinuxI386interp::pack3(OutputFile *fo, Filter &/*ft*/)
}
void PackLinuxI386interp::unpack(OutputFile *fo)
void PackLinuxElf32x86interp::unpack(OutputFile *fo)
{
#define MAX_INTERP_HDR 512
char bufehdr[MAX_INTERP_HDR];