When rewriting binaries that have originally been built by the Gentoo Linux toolchain, dyninst needs to know about the PT_PAX_FLAGS field that is added to the elf header.
Since http://git.dyninst.org/?p=dyninst.git;a=commit;h=91bdb5e73fd7a05c7750263efa9fb24e0a39c011 Using dyninst causes the UNKNOWN assert to trigger on PT_PAX_FLAGS. Add the correct constant to the switch statement to allow these binaries to be rewritten. The correct constant was retrieved from https://pax.grsecurity.net/binutils-2.19-pt-pax-flags-200811041810.patch Signed-off-by: Peter Foley <pefol...@pefoley.com> --- symtabAPI/src/emitElf-64.C | 3 ++- symtabAPI/src/emitElf-64.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/symtabAPI/src/emitElf-64.C b/symtabAPI/src/emitElf-64.C index 56e3bc5..06d1b45 100644 --- a/symtabAPI/src/emitElf-64.C +++ b/symtabAPI/src/emitElf-64.C @@ -239,7 +239,6 @@ static int elfSymVisibility(Symbol::SymbolVisibility sVisibility) } } - std::string phdrTypeStr(Elf64_Word phdr_type) { switch (phdr_type) { case PT_NULL: @@ -264,6 +263,8 @@ std::string phdrTypeStr(Elf64_Word phdr_type) { return "STACK"; case PT_GNU_RELRO: return "RELRO"; + case PT_PAX_FLAGS: + return "PAX"; default: assert(0); return "<UNKNOWN>"; diff --git a/symtabAPI/src/emitElf-64.h b/symtabAPI/src/emitElf-64.h index 7dfc570..b4451ee 100644 --- a/symtabAPI/src/emitElf-64.h +++ b/symtabAPI/src/emitElf-64.h @@ -37,7 +37,6 @@ #include <iostream> #include <vector> -//using namespace std; using std::cerr; using std::cout; using std::endl; @@ -49,6 +48,8 @@ extern const char *INTERP_NAME; extern const char *pdelf_get_shnames(Elf_X *elf); +#define PT_PAX_FLAGS (PT_LOOS + 0x5041580) /* PaX flags */ + namespace Dyninst{ namespace SymtabAPI{ // Error reporting -- 2.8.2 _______________________________________________ Dyninst-api mailing list Dyninst-api@cs.wisc.edu https://lists.cs.wisc.edu/mailman/listinfo/dyninst-api