diff options
| author | Georg Kotheimer <georg.kotheimer@kernkonzept.com> | 2025-03-03 16:41:14 +0100 |
|---|---|---|
| committer | Waldemar Brodkorb <wbx@openadk.org> | 2025-03-04 07:43:56 +0100 |
| commit | 737a0edf4d2d52c6c2836ffe24c7143b63498123 (patch) | |
| tree | 6eaa7464c70ef9a9bb088f36a20b8bda20b86174 /ldso | |
| parent | 227b7c825b6c79479f7222be03e83991b927da26 (diff) | |
Support non-cached entries in getauxval
Previously the getauxval implementation was limited to the auxiliary
vector entries cached in _dl_auxvt. To also support entries outside of
that cached subset, store the start address of the auxiliary vector,
and if an uncached entry type is encountered search the entire auxiliary
vector.
Signed-off-by: Marcus Haehnel <marcus.haehnel@kernkonzept.com>
Diffstat (limited to 'ldso')
| -rwxr-xr-x | ldso/include/ldso.h | 3 | ||||
| -rw-r--r-- | ldso/ldso/dl-startup.c | 4 |
2 files changed, 6 insertions, 1 deletions
diff --git a/ldso/include/ldso.h b/ldso/include/ldso.h index a397cce61..60e0a5bec 100755 --- a/ldso/include/ldso.h +++ b/ldso/include/ldso.h @@ -192,7 +192,8 @@ extern void *_dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE loa #endif #define AUX_MAX_AT_ID 40 -extern ElfW(auxv_t) _dl_auxvt[AUX_MAX_AT_ID]; +extern ElfW(auxv_t) _dl_auxvt[AUX_MAX_AT_ID]; /* Cache frequently accessed auxiliary vector entries */ +extern ElfW(auxv_t) *_dl_auxv_start; /* Start of the auxiliary vector */ void load_vdso(void *sys_info_ehdr, char **envp ); diff --git a/ldso/ldso/dl-startup.c b/ldso/ldso/dl-startup.c index e7000bd87..e0d8c8fff 100644 --- a/ldso/ldso/dl-startup.c +++ b/ldso/ldso/dl-startup.c @@ -100,6 +100,7 @@ extern ElfW(Addr) _begin[] attribute_hidden; ElfW(auxv_t) _dl_auxvt[AUX_MAX_AT_ID]; +ElfW(auxv_t) *_dl_auxv_start; #ifdef LDSO_NEED_DPNT ElfW(Dyn) *_dl_saved_dpnt = 0; @@ -131,6 +132,7 @@ DL_START(unsigned long args) struct elf_resolve tpnt_tmp; struct elf_resolve *tpnt = &tpnt_tmp; ElfW(auxv_t) _dl_auxvt_tmp[AUX_MAX_AT_ID]; + ElfW(auxv_t) *_dl_auxv_start_tmp; ElfW(Dyn) *dpnt; uint32_t *p32; @@ -166,6 +168,7 @@ DL_START(unsigned long args) /* The junk on the stack immediately following the environment is * the Auxiliary Vector Table. Read out the elements of the auxvt, * sort and store them in auxvt for later use. */ + _dl_auxv_start_tmp = (ElfW(auxv_t) *)aux_dat; while (*aux_dat) { ElfW(auxv_t) *auxv_entry = (ElfW(auxv_t) *) aux_dat; @@ -367,6 +370,7 @@ DL_START(unsigned long args) * now the globals work. so copy the aux vector */ _dl_memcpy( _dl_auxvt, _dl_auxvt_tmp, sizeof( ElfW(auxv_t) ) * AUX_MAX_AT_ID ); + _dl_auxv_start = _dl_auxv_start_tmp; _dl_elf_main = (int (*)(int, char **, char **)) _dl_get_ready_to_run(tpnt, load_addr, envp, argv |
