summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2017-10-24 20:06:55 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2017-10-24 20:06:55 +0000
commitcc92a49c1d2dd362b9d0502347afdbd9836bcf9b (patch)
tree2822fc39eaf43dcf5002d07129cc3da7e2507fbd /sys
parente7e899e65b9f7ed361218bbfff41c1596ae8c59c (diff)
In ld scripts, an output section with no input sections is always marked
writable, so the stub gap.o has .rodata flagged as RW. Instead of letting that propagate to the final :rodata PT_LOAD section, force the flags on the section to 4 (==PF_R) in the PHDRS block. problem noted by mortimer@ ok deraadt@ kettenis@
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/amd64/conf/ld.script4
-rw-r--r--sys/arch/arm64/conf/kern.ldscript4
-rw-r--r--sys/arch/i386/conf/ld.script4
3 files changed, 6 insertions, 6 deletions
diff --git a/sys/arch/amd64/conf/ld.script b/sys/arch/amd64/conf/ld.script
index 8878a9e1d6e..4d74b3eb8e3 100644
--- a/sys/arch/amd64/conf/ld.script
+++ b/sys/arch/amd64/conf/ld.script
@@ -1,4 +1,4 @@
-/* $OpenBSD: ld.script,v 1.7 2017/07/06 06:21:56 deraadt Exp $ */
+/* $OpenBSD: ld.script,v 1.8 2017/10/24 20:06:54 guenther Exp $ */
/*
* Copyright (c) 2009 Tobias Weingartner <weingart@tepid.org>
@@ -23,7 +23,7 @@ OUTPUT_ARCH(i386:x86-64)
PHDRS
{
text PT_LOAD FILEHDR PHDRS;
- rodata PT_LOAD;
+ rodata PT_LOAD FLAGS (4);
data PT_LOAD;
bss PT_LOAD;
openbsd_randomize PT_OPENBSD_RANDOMIZE;
diff --git a/sys/arch/arm64/conf/kern.ldscript b/sys/arch/arm64/conf/kern.ldscript
index f4420390c03..4f6f17d6bb0 100644
--- a/sys/arch/arm64/conf/kern.ldscript
+++ b/sys/arch/arm64/conf/kern.ldscript
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern.ldscript,v 1.6 2017/10/04 21:04:56 patrick Exp $ */
+/* $OpenBSD: kern.ldscript,v 1.7 2017/10/24 20:06:54 guenther Exp $ */
/* $NetBSD: ldscript.evbarm,v 1.2 2003/03/05 23:54:22 thorpej Exp $ */
OUTPUT_ARCH(aarch64)
@@ -7,7 +7,7 @@ OUTPUT_ARCH(aarch64)
PHDRS
{
text PT_LOAD;
- rodata PT_LOAD;
+ rodata PT_LOAD FLAGS (4);
data PT_LOAD;
openbsd_randomize PT_OPENBSD_RANDOMIZE;
}
diff --git a/sys/arch/i386/conf/ld.script b/sys/arch/i386/conf/ld.script
index 1db92582958..32343bd5def 100644
--- a/sys/arch/i386/conf/ld.script
+++ b/sys/arch/i386/conf/ld.script
@@ -1,4 +1,4 @@
-/* $OpenBSD: ld.script,v 1.7 2017/06/21 20:08:53 deraadt Exp $ */
+/* $OpenBSD: ld.script,v 1.8 2017/10/24 20:06:54 guenther Exp $ */
/*
* Copyright (c) 2015 Mike Larkin <mlarkin@openbsd.org>
@@ -24,7 +24,7 @@ OUTPUT_ARCH(i386)
PHDRS
{
text PT_LOAD FILEHDR PHDRS;
- rodata PT_LOAD;
+ rodata PT_LOAD FLAGS (4);
data PT_LOAD;
bss PT_LOAD;
openbsd_randomize PT_OPENBSD_RANDOMIZE;