diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2017-12-11 02:32:26 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2017-12-11 02:32:26 +0100 |
commit | 0ca198f1f90071a054287c204a3fd1b4ea315e18 (patch) | |
tree | 710b923b98b58c4e5f9546bb18b085baf9288c9e /exec/elfcore.c | |
parent | a8fecd7be76342fea85b5129d450ab01738dcbdf (diff) | |
download | hurd-0ca198f1f90071a054287c204a3fd1b4ea315e18.tar.gz hurd-0ca198f1f90071a054287c204a3fd1b4ea315e18.tar.bz2 hurd-0ca198f1f90071a054287c204a3fd1b4ea315e18.zip |
Record executable entry for PIE core dumps
* hurd/process.defs (proc_set_entry, proc_get_entry): New RPCs.
* hurd/process_reply.defs: Add skips for proc_set_entry, proc_get_entry.
* hurd/process_request.defs: Likewise.
* exec/exec.c (do_exec): Call proc_set_entry.
* proc/proc.h (proc): Add p_entry field.
* proc/mgt.c (S_proc_set_entry, S_proc_get_entry): New RPC
implementations.
* exec/elfcore.c (dump_core): Add at_entry note, call proc_get_entry to
get it, and write it with WRITE_NOTE.
Diffstat (limited to 'exec/elfcore.c')
-rw-r--r-- | exec/elfcore.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/exec/elfcore.c b/exec/elfcore.c index 12ecf34f..2dd499bf 100644 --- a/exec/elfcore.c +++ b/exec/elfcore.c @@ -331,6 +331,7 @@ dump_core (task_t task, file_t file, off_t corelimit, { DEFINE_NOTE (psinfo_t) psinfo; DEFINE_NOTE (pstatus_t) pstatus; + DEFINE_NOTE (ElfW(auxv_t)) at_entry; int flags = PI_FETCH_TASKINFO | PI_FETCH_THREADS | PI_FETCH_THREAD_BASIC; char *waits = 0; mach_msg_type_number_t num_waits = 0; @@ -410,6 +411,18 @@ dump_core (task_t task, file_t file, off_t corelimit, err = proc_get_arg_locations (proc, &psinfo.data.pr_argv, &psinfo.data.pr_envp); + if (err == 0) + { + /* Write position of executable. */ + vm_address_t addr; + err = proc_get_entry (proc, &addr); + if (err == 0) + { + at_entry.data.a_type = AT_ENTRY; + at_entry.data.a_un.a_val = addr; + err = WRITE_NOTE (NT_AUXV, at_entry); + } + } mach_port_deallocate (mach_task_self (), proc); } { |