summaryrefslogtreecommitdiff
path: root/gnu/usr.bin
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2002-07-27 22:06:07 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2002-07-27 22:06:07 +0000
commit659c2f0673396beeb4facd899032a54711bff499 (patch)
treeaddf87d28512bf790c252835a6f977c6b5b34c98 /gnu/usr.bin
parentb2710fc8b5b6cf7f609d732331fb132ba95e82bf (diff)
ask uvm to map the bss of each .so module non-executable. again, we
cannot do this to the data segments until we know how big the got/plt zone is... anyone want to track that down?
Diffstat (limited to 'gnu/usr.bin')
-rw-r--r--gnu/usr.bin/ld/rtld/rtld.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/gnu/usr.bin/ld/rtld/rtld.c b/gnu/usr.bin/ld/rtld/rtld.c
index 296cf4e8e58..aee02e4ccfa 100644
--- a/gnu/usr.bin/ld/rtld/rtld.c
+++ b/gnu/usr.bin/ld/rtld/rtld.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtld.c,v 1.27 2002/07/19 19:28:12 marc Exp $ */
+/* $OpenBSD: rtld.c,v 1.28 2002/07/27 22:06:06 deraadt Exp $ */
/* $NetBSD: rtld.c,v 1.43 1996/01/14 00:35:17 pk Exp $ */
/*
* Copyright (c) 1993 Paul Kranenburg
@@ -323,7 +323,7 @@ rtld(int version, struct crt_ldso *crtp, struct _dynamic *dp)
/* Set breakpoint for the benefit of debuggers */
if (mprotect(addr, PAGSIZ,
- PROT_READ|PROT_WRITE|PROT_EXEC) == -1) {
+ PROT_READ|PROT_WRITE|PROT_EXEC) == -1) {
err(1, "Cannot set breakpoint (%s)", main_progname);
}
md_set_breakpoint((long)crtp->crt_bp, (long *)&ddp->dd_bpt_shadow);
@@ -606,8 +606,8 @@ again:
}
if ((addr = mmap(0, hdr.a_text + hdr.a_data + hdr.a_bss,
- PROT_READ|PROT_EXEC,
- MAP_COPY, fd, 0)) == (caddr_t)-1) {
+ PROT_READ|PROT_EXEC,
+ MAP_COPY, fd, 0)) == (caddr_t)-1) {
(void)close(fd);
return NULL;
}
@@ -623,9 +623,9 @@ again:
}
if (mmap(addr + hdr.a_text + hdr.a_data, hdr.a_bss,
- PROT_READ|PROT_WRITE|PROT_EXEC,
- MAP_ANON|MAP_COPY|MAP_FIXED,
- anon_fd, 0) == (caddr_t)-1) {
+ PROT_READ|PROT_WRITE,
+ MAP_ANON|MAP_COPY|MAP_FIXED,
+ anon_fd, 0) == (caddr_t)-1) {
(void)close(fd);
return NULL;
}
@@ -720,8 +720,8 @@ check_text_reloc(struct relocation_info *r, struct so_map *smp, caddr_t addr)
if (smp->som_write == 0 &&
mprotect(smp->som_addr + LM_TXTADDR(smp),
- LD_TEXTSZ(smp->som_dynamic),
- PROT_READ|PROT_WRITE|PROT_EXEC) == -1) {
+ LD_TEXTSZ(smp->som_dynamic),
+ PROT_READ|PROT_WRITE|PROT_EXEC) == -1) {
err(1, "Cannot enable writes to %s:%s",
main_progname, smp->som_path);
@@ -811,11 +811,10 @@ reloc_map(struct so_map *smp)
if (smp->som_write) {
if (mprotect(smp->som_addr + LM_TXTADDR(smp),
- LD_TEXTSZ(smp->som_dynamic),
- PROT_READ|PROT_EXEC) == -1) {
-
+ LD_TEXTSZ(smp->som_dynamic),
+ PROT_READ|PROT_EXEC) == -1) {
err(1, "Cannot disable writes to %s:%s",
- main_progname, smp->som_path);
+ main_progname, smp->som_path);
}
smp->som_write = 0;
}