diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2023-03-19 11:28:24 +0100 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2023-03-19 11:28:24 +0100 |
| commit | 6a2183189462127c2b23abc882245adc25eb644d (patch) | |
| tree | 02858c07a1b9f1f8e83673c21880f287d7d203e1 /src | |
| parent | ee49851de412dd9d0047807b49ef7814e000f620 (diff) | |
| download | box64-6a2183189462127c2b23abc882245adc25eb644d.tar.gz box64-6a2183189462127c2b23abc882245adc25eb644d.zip | |
Now handling the BIND_NOW flags in elf header
Diffstat (limited to 'src')
| -rwxr-xr-x | src/elfs/elfloader.c | 8 | ||||
| -rwxr-xr-x | src/elfs/elfloader_private.h | 1 | ||||
| -rwxr-xr-x | src/elfs/elfparser.c | 4 |
3 files changed, 13 insertions, 0 deletions
diff --git a/src/elfs/elfloader.c b/src/elfs/elfloader.c index 05ff19e1..5582ebef 100755 --- a/src/elfs/elfloader.c +++ b/src/elfs/elfloader.c @@ -844,6 +844,10 @@ int RelocateElfRELA(lib_t *maplib, lib_t *local_maplib, int bindnow, elfheader_t void checkHookedSymbols(lib_t *maplib, elfheader_t* h); // in mallochook.c int RelocateElf(lib_t *maplib, lib_t *local_maplib, int bindnow, elfheader_t* head) { + if((head->flags&DF_BIND_NOW) && !bindnow) { + bindnow = 1; + printf_log(LOG_DEBUG, "Forcing %s to Bind Now\n", head->name); + } if(head->rel) { int cnt = head->relsz / head->relent; DumpRelTable(head, cnt, (Elf64_Rel *)(head->rel + head->delta), "Rel"); @@ -865,6 +869,10 @@ int RelocateElf(lib_t *maplib, lib_t *local_maplib, int bindnow, elfheader_t* he int RelocateElfPlt(lib_t *maplib, lib_t *local_maplib, int bindnow, elfheader_t* head) { int need_resolver = 0; + if((head->flags&DF_BIND_NOW) && !bindnow) { + bindnow = 1; + printf_log(LOG_DEBUG, "Forcing %s to Bind Now\n", head->name); + } if(head->pltrel) { int cnt = head->pltsz / head->pltent; if(head->pltrel==DT_REL) { diff --git a/src/elfs/elfloader_private.h b/src/elfs/elfloader_private.h index c4637535..c3d387ef 100755 --- a/src/elfs/elfloader_private.h +++ b/src/elfs/elfloader_private.h @@ -34,6 +34,7 @@ struct elfheader_s { Elf64_Verdef* VerDef; int szVerDef; int e_type; + uint32_t flags; intptr_t delta; // should be 0 diff --git a/src/elfs/elfparser.c b/src/elfs/elfparser.c index 1fd3ca01..7b83e07e 100755 --- a/src/elfs/elfparser.c +++ b/src/elfs/elfparser.c @@ -278,6 +278,10 @@ elfheader_t* ParseElfHeader(FILE* f, const char* name, int exec) h->VerDef = (Elf64_Verdef*)ptr; printf_dump(LOG_DEBUG, "The DT_VERDEF is at address %p\n", h->VerDef); break; + case DT_FLAGS: + h->flags = val; + printf_dump(LOG_DEBUG, "The DT_FLAGS is 0x%x\n", h->flags); + break; } } if(h->rel) { |