[1/2] elf: Record original entry point in GLRO(dl_entry)
Checks
| Context |
Check |
Description |
| redhat-pt-bot/TryBot-apply_patch |
success
|
Patch applied to master at the time it was sent
|
| linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_glibc_build--master-arm |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_glibc_check--master-aarch64 |
fail
|
Test failed
|
Commit Message
This could be useful information for debugging purposes. On Linux,
the kernel-provided value in the auxilary vector is overwritten
by ld.so.
This is also the address that GDB uses on some architectures to
set the breakpoint on the return from an inferior function call.
---
elf/rtld.c | 1 +
sysdeps/generic/ldsodefs.h | 4 ++++
2 files changed, 5 insertions(+)
@@ -1366,6 +1366,7 @@ dl_main (const ElfW(Phdr) *phdr,
#endif
const char *ld_so_name = _dl_argv[0];
+ GLRO(dl_entry) = *user_entry;
if (*user_entry == (ElfW(Addr)) ENTRY_POINT)
{
/* Ho ho. We are not the program interpreter! We are the program
@@ -682,6 +682,10 @@ struct rtld_global_ro
/* Dynamic linker operations used after static dlopen. */
const struct dlfcn_hook *_dl_dlfcn_hook;
+ /* Original kernel-provided entry point. Could be the main program
+ or ld.so itself. */
+ ElfW(Addr) _dl_entry;
+
/* List of auditing interfaces. */
struct audit_ifaces *_dl_audit;
unsigned int _dl_naudit;