summaryrefslogtreecommitdiff
path: root/lib/csu/common.c
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2002-07-11 14:05:43 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2002-07-11 14:05:43 +0000
commitff83622b0eb65803cd287f23998e0a4de48e6f68 (patch)
tree576247011aa16eb87639c5e3b8477bec294f7798 /lib/csu/common.c
parent0f1846d0f72656ce55b3e153ab860972071791d0 (diff)
We need to map the data segment of ld.so with PROT_EXEC for the GOT.
This is in preparation for actually honoring exec protection in sparc pmap. NOTICE! You really want to rebuild the whole userland with this change before the kernel fix goes in. Otherwise all shared binaries will dump core.
Diffstat (limited to 'lib/csu/common.c')
-rw-r--r--lib/csu/common.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/csu/common.c b/lib/csu/common.c
index 721b113d93e..78088dd5c92 100644
--- a/lib/csu/common.c
+++ b/lib/csu/common.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: common.c,v 1.9 2002/06/05 22:09:53 espie Exp $ */
+/* $OpenBSD: common.c,v 1.10 2002/07/11 14:05:42 art Exp $ */
/* $NetBSD: common.c,v 1.4 1995/09/23 22:34:20 pk Exp $ */
/*
* Copyright (c) 1993,1995 Paul Kranenburg
@@ -109,9 +109,13 @@ __load_rtld(dp)
#define N_BSSADDR(x) ((x).a_text + (x).a_data)
#endif
- /* Map in data segment of ld.so writable */
+ /*
+ * Map in data segment of ld.so writable
+ * The segment must be PROT_EXEC too because the
+ * GOT is located there.
+ */
if (mmap(crt.crt_ba+N_DATADDR(hdr), hdr.a_data,
- PROT_READ|PROT_WRITE,
+ PROT_READ|PROT_WRITE|PROT_EXEC,
MAP_FIXED|MAP_PRIVATE,
crt.crt_ldfd, N_DATOFF(hdr)) == -1) {
_FATAL("Cannot map ld.so\n");