[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[hurd] 48/70: exec: keep track of the range where executable segments ar
From: |
Samuel Thibault |
Subject: |
[hurd] 48/70: exec: keep track of the range where executable segments are mapped |
Date: |
Mon, 16 Sep 2013 07:41:43 +0000 |
This is an automated email from the git hooks/post-receive script.
sthibault pushed a commit to branch upstream
in repository hurd.
commit 56ec51a012c76670d421fe9d3d3699278564cee5
Author: Justus Winter <address@hidden>
Date: Thu Aug 15 09:38:06 2013 +0200
exec: keep track of the range where executable segments are mapped
Keep track of the range where executable segments are mapped into
memory and hand that information over to the proc server.
* exec/priv.h (struct execdata): Add {start,end}_code.
* exec/exec.c (prepare): Initialize {start,end}_code.
(load_section): Update {start,end}_code.
(do_exec): Use proc_set_code to hand {start,end}_code to the proc server.
---
exec/exec.c | 23 +++++++++++++++++++++++
exec/priv.h | 4 ++++
2 files changed, 27 insertions(+)
diff --git a/exec/exec.c b/exec/exec.c
index f139792..6eb81c8 100644
--- a/exec/exec.c
+++ b/exec/exec.c
@@ -207,6 +207,17 @@ load_section (void *section, struct execdata *u)
}
}
+ /* If this segment is executable, adjust start_code and end_code
+ so that this mapping is within that range. */
+ if (vm_prot & VM_PROT_EXECUTE)
+ {
+ if (u->start_code == 0 || u->start_code > addr)
+ u->start_code = addr;
+
+ if (u->end_code < addr + memsz)
+ u->end_code = addr + memsz;
+ }
+
if (mapstart > addr)
{
/* We must read and copy in the space in the section before the
@@ -445,6 +456,9 @@ prepare (file_t file, struct execdata *e)
e->interp.section = NULL;
+ e->start_code = 0;
+ e->end_code = 0;
+
/* Initialize E's stdio stream. */
prepare_stream (e);
@@ -1399,6 +1413,15 @@ do_exec (file_t file,
}
boot->user_entry = e.entry; /* already adjusted in `load' */
+ /* Set the start_code and end_code values for this process.
+ /hurd/exec is used to start /hurd/proc, so at this point there is
+ no proc server, so we need to be careful here. */
+ if (boot->portarray[INIT_PORT_PROC] != MACH_PORT_NULL)
+ e.error = proc_set_code (boot->portarray[INIT_PORT_PROC],
+ e.start_code, e.end_code);
+ if (e.error)
+ goto out;
+
/* Create the initial thread. */
e.error = thread_create (newtask, &thread);
if (e.error)
diff --git a/exec/priv.h b/exec/priv.h
index b9c6e99..85e03ae 100644
--- a/exec/priv.h
+++ b/exec/priv.h
@@ -73,6 +73,10 @@ struct execdata
vm_address_t entry;
file_t file;
+ /* Set by load_section. */
+ vm_address_t start_code;
+ vm_address_t end_code;
+
/* Note that if `file_data' (below) is set, then these just point
into that and should not be deallocated (file_data is malloc'd). */
char *map_buffer; /* Our mapping window or read buffer. */
--
Alioth's /usr/local/bin/git-commit-notice on
/srv/git.debian.org/git/pkg-hurd/hurd.git
- [hurd] 60/70: libdiskfs: add fsys_get_source, (continued)
- [hurd] 60/70: libdiskfs: add fsys_get_source, Samuel Thibault, 2013/09/16
- [hurd] 56/70: libnetfs: add fsys_get_children, Samuel Thibault, 2013/09/16
- [hurd] 41/70: mach-defpager: register mach-defpager translators as important, Samuel Thibault, 2013/09/16
- [hurd] 62/70: libtrivfs: add fsys_get_source, Samuel Thibault, 2013/09/16
- [hurd] 66/70: exec: remove support for transparently unbzip2ing executables, Samuel Thibault, 2013/09/16
- [hurd] 58/70: trans/symlink.c: add fsys_get_children, Samuel Thibault, 2013/09/16
- [hurd] 67/70: exec: remove support for transparently ungziping executables, Samuel Thibault, 2013/09/16
- [hurd] 54/70: libfshelp: add translator-list.c, Samuel Thibault, 2013/09/16
- [hurd] 70/70: Merge remote-tracking branch 'upstream/master' into upstream, Samuel Thibault, 2013/09/16
- [hurd] 53/70: libnetfs: track file name in struct peropen, Samuel Thibault, 2013/09/16
- [hurd] 48/70: exec: keep track of the range where executable segments are mapped,
Samuel Thibault <=
- [hurd] 64/70: hurd: add fsys_get_source, Samuel Thibault, 2013/09/16
- [hurd] 59/70: hurd: add fsys_get_children, Samuel Thibault, 2013/09/16
- [hurd] 68/70: Handle notification on page eviction, Samuel Thibault, 2013/09/16
- [hurd] 65/70: trans: add mtab translator, Samuel Thibault, 2013/09/16
- [hurd] 49/70: proc: remove unused file exc-reply.defs, Samuel Thibault, 2013/09/16
- [hurd] 47/70: hurd: add proc_{get,set}_code, Samuel Thibault, 2013/09/16
- [hurd] 44/70: mount: handle -t auto, Samuel Thibault, 2013/09/16
- [hurd] 55/70: libdiskfs: add fsys_get_children, Samuel Thibault, 2013/09/16
- [hurd] 18/70: libshouldbeinlibc: Add nullauth.{c,h}, Samuel Thibault, 2013/09/16
- [hurd] 39/70: libnetfs: register libnetfs-based translators as important, Samuel Thibault, 2013/09/16