aboutsummaryrefslogtreecommitdiff
path: root/libexec/rtld-elf/map_object.c
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2012-01-30 19:52:17 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2012-01-30 19:52:17 +0000
commit6d7610d75aa1fe978567c1199bc2cb602fcd8ac1 (patch)
tree90d988f3878c9def0fc410882cbbb5bab9561e6d /libexec/rtld-elf/map_object.c
parent1b38b227395b0fa2c7e01a58d1ffc558aaed3e20 (diff)
downloadsrc-6d7610d75aa1fe978567c1199bc2cb602fcd8ac1.tar.gz
src-6d7610d75aa1fe978567c1199bc2cb602fcd8ac1.zip
Notes
Diffstat (limited to 'libexec/rtld-elf/map_object.c')
-rw-r--r--libexec/rtld-elf/map_object.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/libexec/rtld-elf/map_object.c b/libexec/rtld-elf/map_object.c
index aca1b2d0d43a..6a1369284444 100644
--- a/libexec/rtld-elf/map_object.c
+++ b/libexec/rtld-elf/map_object.c
@@ -84,6 +84,8 @@ map_object(int fd, const char *path, const struct stat *sb)
Elf_Addr bss_vlimit;
caddr_t bss_addr;
Elf_Word stack_flags;
+ Elf_Addr relro_page;
+ size_t relro_size;
hdr = get_elf_header(fd, path);
if (hdr == NULL)
@@ -100,6 +102,8 @@ map_object(int fd, const char *path, const struct stat *sb)
nsegs = -1;
phdyn = phinterp = phtls = NULL;
phdr_vaddr = 0;
+ relro_page = 0;
+ relro_size = 0;
segs = alloca(sizeof(segs[0]) * hdr->e_phnum);
stack_flags = RTLD_DEFAULT_STACK_PF_EXEC | PF_R | PF_W;
while (phdr < phlimit) {
@@ -134,6 +138,11 @@ map_object(int fd, const char *path, const struct stat *sb)
case PT_GNU_STACK:
stack_flags = phdr->p_flags;
break;
+
+ case PT_GNU_RELRO:
+ relro_page = phdr->p_vaddr;
+ relro_size = phdr->p_memsz;
+ break;
}
++phdr;
@@ -269,6 +278,9 @@ map_object(int fd, const char *path, const struct stat *sb)
obj->tlsinit = mapbase + phtls->p_vaddr;
}
obj->stack_flags = stack_flags;
+ obj->relro_page = obj->relocbase + trunc_page(relro_page);
+ obj->relro_size = round_page(relro_size);
+
return obj;
}