Skip to content

Commit

Permalink
commit for minor alpha release v0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
elfmaster committed Nov 27, 2018
1 parent c583acd commit ae68b98
Show file tree
Hide file tree
Showing 6 changed files with 313 additions and 59 deletions.
4 changes: 2 additions & 2 deletions examples/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
all:
gcc -O2 -g -fPIC -pie elfparse.c ../src/libelfmaster.a -o elfparse
gcc -O3 -g ldd.c ../src/libelfmaster.a -o ldd
gcc -O0 -g -fPIC -pie elfparse.c ../src/libelfmaster.a -o elfparse
gcc -O0 -g ldd.c ../src/libelfmaster.a -o ldd
gcc -O2 -g read_mem.c ../src/libelfmaster.a -o read_mem
gcc -O2 -g plt_dump.c ../src/libelfmaster.a -o plt_dump
gcc -O2 -g plt_dump2.c ../src/libelfmaster.a -o plt_dump2
Expand Down
2 changes: 1 addition & 1 deletion examples/pltgot.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ int main(int argc, char **argv)
elfobj_t obj;
elf_error_t error;
elf_pltgot_iterator_t pltgot_iter;
struct elf_pltgot pltgot;
struct elf_pltgot_entry pltgot;

if (argc < 2) {
printf("Usage: %s <binary>\n", argv[0]);
Expand Down
4 changes: 3 additions & 1 deletion include/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,9 @@ void free_arrays(elfobj_t *);

void free_misc(elfobj_t *);

bool insane_headers(elfobj_t *);
bool insane_section_headers(elfobj_t *);

bool insane_dynamic_segment(elfobj_t *);

bool reconstruct_elf_sections(elfobj_t *, elf_error_t *);

Expand Down
20 changes: 20 additions & 0 deletions include/libelfmaster.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@

#define MAX_ERROR_STR_LEN 128

/*
* DT_PLTREL tag has two valid
* values, 0x7 and 0x11
*/
#define ELF_DT_PLTREL_RELA 0x7
#define ELF_DT_PLTREL_REL 0x11

/*
* In reality will never exceed 2,3, or 4 at the highest.
*/
Expand Down Expand Up @@ -192,6 +199,10 @@ struct pt_load {
uint32_t flag;
};

/*
* TODO
* Move the anomaly values to internal.h.
*/
/*
* Flags for anomalies on section headers
*/
Expand All @@ -202,6 +213,12 @@ struct pt_load {
#define INVALID_F_SHENTSIZE (1ULL << 4)
#define INVALID_F_SH_HEADERS (1ULL << 5)
#define INVALID_F_SHSTRTAB (1ULL << 6)

/*
* Flags for anomalies on dynamic segment
*/
#define INVALID_F_VITAL_DTAG_VALUE (1ULL << 7)

/*
* This struct is not meant to access directly. It is an opaque
* type. It is only accessed directly from within the API code
Expand Down Expand Up @@ -295,6 +312,9 @@ typedef struct elfobj {
struct {
uint64_t size;
} relent;
struct {
uint64_t size;
} relaent;
struct {
uint64_t addr;
uint64_t size;
Expand Down
Loading

0 comments on commit ae68b98

Please sign in to comment.