Skip to content

Commit adff278

Browse files
nodejs-github-bottargos
authored andcommitted
deps,test: update postject to 1.0.0-alpha.5
PR-URL: #46934 Fixes: nodejs/postject#76 Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1 parent acfd9b8 commit adff278

File tree

8 files changed

+56
-23
lines changed

8 files changed

+56
-23
lines changed

deps/postject/postject-api.h

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#elif defined(__linux__)
1313
#include <elf.h>
1414
#include <link.h>
15-
#include <sys/auxv.h>
1615
#include <sys/param.h>
1716
#elif defined(_WIN32)
1817
#include <windows.h>
@@ -44,6 +43,16 @@ static inline bool postject_has_resource() {
4443
return sentinel[sizeof(POSTJECT_SENTINEL_FUSE)] == '1';
4544
}
4645

46+
#if defined(__linux__)
47+
static int postject__dl_iterate_phdr_callback(struct dl_phdr_info* info,
48+
size_t size,
49+
void* data) {
50+
// Snag the dl_phdr_info struct for the main program, then stop iterating
51+
*((struct dl_phdr_info*)data) = *info;
52+
return 1;
53+
}
54+
#endif
55+
4756
static const void* postject_find_resource(
4857
const char* name,
4958
size_t* size,
@@ -114,9 +123,12 @@ static const void* postject_find_resource(
114123
name = options->elf_section_name;
115124
}
116125

117-
uintptr_t p = getauxval(AT_PHDR);
118-
size_t n = getauxval(AT_PHNUM);
119-
uintptr_t base_addr = p - sizeof(ElfW(Ehdr));
126+
struct dl_phdr_info main_program_info;
127+
dl_iterate_phdr(postject__dl_iterate_phdr_callback, &main_program_info);
128+
129+
uintptr_t p = (uintptr_t)main_program_info.dlpi_phdr;
130+
size_t n = main_program_info.dlpi_phnum;
131+
uintptr_t base_addr = main_program_info.dlpi_addr;
120132

121133
// iterate program header
122134
for (; n > 0; n--, p += sizeof(ElfW(Phdr))) {

test/fixtures/postject-copy/node_modules/.package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/fixtures/postject-copy/node_modules/postject/dist/api.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/fixtures/postject-copy/node_modules/postject/dist/cli.js

Lines changed: 12 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/fixtures/postject-copy/node_modules/postject/dist/postject-api.h

Lines changed: 16 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/fixtures/postject-copy/node_modules/postject/package.json

Lines changed: 3 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/fixtures/postject-copy/package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/fixtures/postject-copy/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
"author": "",
1111
"license": "ISC",
1212
"dependencies": {
13-
"postject": "^1.0.0-alpha.4"
13+
"postject": "^1.0.0-alpha.5"
1414
}
1515
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy