summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorart <art@openbsd.org>2002-07-11 14:05:42 +0000
committerart <art@openbsd.org>2002-07-11 14:05:42 +0000
commit8de38fa05aa255c8198d0d79653e08ec698212c3 (patch)
tree2b175081f1dd7c3404b965be534b1d72be943fcd
parentchroot aware (diff)
downloadwireguard-openbsd-8de38fa05aa255c8198d0d79653e08ec698212c3.tar.xz
wireguard-openbsd-8de38fa05aa255c8198d0d79653e08ec698212c3.zip
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.
-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");