summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2023-12-20 14:50:10 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2023-12-20 14:50:10 +0000
commitd5c191091afc90123489dfe067d1eee94c9a2579 (patch)
tree1a18e82715667376a9fe9184ba345e21adba40fd
parentd80fc78a208a8bc3efbfe6d545360d0cde5ee065 (diff)
For strange reasons which made sense at the time, the text segment was
placed head of the btext (boot.text) segment. (the boot.text segment is "unmapped" after initization, as a self-protection mechanism). this meant the LOAD's virtual addresses were not in sequence, which clearly isn't what we intended.
-rw-r--r--libexec/ld.so/aarch64/ld.script6
-rw-r--r--libexec/ld.so/alpha/ld.script4
-rw-r--r--libexec/ld.so/amd64/ld.script2
-rw-r--r--libexec/ld.so/arm/ld.script6
-rw-r--r--libexec/ld.so/hppa/ld.script6
-rw-r--r--libexec/ld.so/i386/ld.script2
-rw-r--r--libexec/ld.so/m88k/ld.script2
-rw-r--r--libexec/ld.so/mips64/ld.script2
-rw-r--r--libexec/ld.so/powerpc/ld.script2
-rw-r--r--libexec/ld.so/riscv64/ld.script6
-rw-r--r--libexec/ld.so/sh/ld.script6
-rw-r--r--libexec/ld.so/sparc64/ld.script2
12 files changed, 23 insertions, 23 deletions
diff --git a/libexec/ld.so/aarch64/ld.script b/libexec/ld.so/aarch64/ld.script
index f2dbd181fd1..23ff1c3e0c1 100644
--- a/libexec/ld.so/aarch64/ld.script
+++ b/libexec/ld.so/aarch64/ld.script
@@ -1,8 +1,8 @@
PHDRS
{
rodata PT_LOAD FILEHDR PHDRS FLAGS (4);
- text PT_LOAD FLAGS (1);
btext PT_LOAD FLAGS (0x08000001);
+ text PT_LOAD FLAGS (1);
data PT_LOAD;
random PT_OPENBSD_RANDOMIZE;
syscalls PT_OPENBSD_SYSCALLS;
@@ -23,8 +23,6 @@ SECTIONS
/* TEXT */
. = ALIGN(0x10000);
- .text : { *(.text .text.*) } :text
- . = ALIGN(0x1000);
.boot.text :
{
. = ALIGN(0x1000);
@@ -33,6 +31,8 @@ SECTIONS
. = ALIGN(0x1000);
boot_text_end = .;
} :btext
+ . = ALIGN(0x1000);
+ .text : { *(.text .text.*) } :text
/* RELRO DATA */
. = DATA_SEGMENT_ALIGN (0x10000, 0x1000);
diff --git a/libexec/ld.so/alpha/ld.script b/libexec/ld.so/alpha/ld.script
index 33bfb8d8c7a..dd642a29f0c 100644
--- a/libexec/ld.so/alpha/ld.script
+++ b/libexec/ld.so/alpha/ld.script
@@ -23,8 +23,6 @@ SECTIONS
/* TEXT */
. = ALIGN(0x10000);
- .text : { *(.text .text.*) } :text
- . = ALIGN(0x2000);
.boot.text :
{
. = ALIGN(0x2000);
@@ -33,6 +31,8 @@ SECTIONS
*(.boot.text)
boot_text_end = .;
} :btext
+ . = ALIGN(0x2000);
+ .text : { *(.text .text.*) } :text
/* RELRO DATA */
. = DATA_SEGMENT_ALIGN (0x10000, 0x2000);
diff --git a/libexec/ld.so/amd64/ld.script b/libexec/ld.so/amd64/ld.script
index 12bb242a63c..78da6e58c71 100644
--- a/libexec/ld.so/amd64/ld.script
+++ b/libexec/ld.so/amd64/ld.script
@@ -1,8 +1,8 @@
PHDRS
{
rodata PT_LOAD FILEHDR PHDRS FLAGS (4);
- text PT_LOAD FLAGS (1);
btext PT_LOAD FLAGS (0x08000005);
+ text PT_LOAD FLAGS (1);
data PT_LOAD;
random PT_OPENBSD_RANDOMIZE;
syscalls PT_OPENBSD_SYSCALLS;
diff --git a/libexec/ld.so/arm/ld.script b/libexec/ld.so/arm/ld.script
index 0d66e23cd51..5784d962a7f 100644
--- a/libexec/ld.so/arm/ld.script
+++ b/libexec/ld.so/arm/ld.script
@@ -1,8 +1,8 @@
PHDRS
{
rodata PT_LOAD FILEHDR PHDRS FLAGS (4);
- text PT_LOAD;
btext PT_LOAD FLAGS (0x08000005);
+ text PT_LOAD;
data PT_LOAD;
random PT_OPENBSD_RANDOMIZE;
syscalls PT_OPENBSD_SYSCALLS;
@@ -24,8 +24,6 @@ SECTIONS
/* TEXT */
. = ALIGN(0x10000);
- .text : { *(.text .text.*) } :text
- . = ALIGN(0x1000);
.boot.text :
{
. = ALIGN(0x1000);
@@ -34,6 +32,8 @@ SECTIONS
. = ALIGN(0x1000);
boot_text_end = .;
} :btext
+ . = ALIGN(0x1000);
+ .text : { *(.text .text.*) } :text
/* RELRO DATA */
. = DATA_SEGMENT_ALIGN (0x10000, 0x1000);
diff --git a/libexec/ld.so/hppa/ld.script b/libexec/ld.so/hppa/ld.script
index 163c667a7a8..6ea4aab5728 100644
--- a/libexec/ld.so/hppa/ld.script
+++ b/libexec/ld.so/hppa/ld.script
@@ -1,8 +1,8 @@
PHDRS
{
rodata PT_LOAD FILEHDR PHDRS FLAGS (4);
- text PT_LOAD FLAGS (1);
btext PT_LOAD FLAGS (0x08000005);
+ text PT_LOAD FLAGS (1);
pltgot PT_LOAD;
data PT_LOAD;
random PT_OPENBSD_RANDOMIZE;
@@ -24,8 +24,6 @@ SECTIONS
/* TEXT */
. = ALIGN(0x1000);
- .text : { *(.text .text.*) } :text
- . = ALIGN(0x1000);
.boot.text :
{
. = ALIGN(0x1000);
@@ -34,6 +32,8 @@ SECTIONS
. = ALIGN(0x1000);
boot_text_end = .;
} :btext
+ . = ALIGN(0x1000);
+ .text : { *(.text .text.*) } :text
/* PLT and GOT */
. = ALIGN(0x1000);
diff --git a/libexec/ld.so/i386/ld.script b/libexec/ld.so/i386/ld.script
index 555c3741ed9..dc8cca7a629 100644
--- a/libexec/ld.so/i386/ld.script
+++ b/libexec/ld.so/i386/ld.script
@@ -1,8 +1,8 @@
PHDRS
{
rodata PT_LOAD FILEHDR PHDRS FLAGS (4);
- text PT_LOAD FLAGS (1);
btext PT_LOAD FLAGS (0x08000005);
+ text PT_LOAD FLAGS (1);
data PT_LOAD;
random PT_OPENBSD_RANDOMIZE;
syscalls PT_OPENBSD_SYSCALLS;
diff --git a/libexec/ld.so/m88k/ld.script b/libexec/ld.so/m88k/ld.script
index 342524544b6..b5f405715ba 100644
--- a/libexec/ld.so/m88k/ld.script
+++ b/libexec/ld.so/m88k/ld.script
@@ -1,8 +1,8 @@
PHDRS
{
rodata PT_LOAD FILEHDR PHDRS FLAGS (4);
- text PT_LOAD;
btext PT_LOAD FLAGS (0x08000005);
+ text PT_LOAD;
data PT_LOAD;
random PT_OPENBSD_RANDOMIZE;
syscalls PT_OPENBSD_SYSCALLS;
diff --git a/libexec/ld.so/mips64/ld.script b/libexec/ld.so/mips64/ld.script
index a1392fb2342..db683960646 100644
--- a/libexec/ld.so/mips64/ld.script
+++ b/libexec/ld.so/mips64/ld.script
@@ -1,8 +1,8 @@
PHDRS
{
rodata PT_LOAD FILEHDR PHDRS FLAGS (4);
- text PT_LOAD FLAGS (1);
btext PT_LOAD FLAGS (0x08000005);
+ text PT_LOAD FLAGS (1);
data PT_LOAD;
random PT_OPENBSD_RANDOMIZE;
syscalls PT_OPENBSD_SYSCALLS;
diff --git a/libexec/ld.so/powerpc/ld.script b/libexec/ld.so/powerpc/ld.script
index afd66c5afd1..a3fbc0c340a 100644
--- a/libexec/ld.so/powerpc/ld.script
+++ b/libexec/ld.so/powerpc/ld.script
@@ -1,8 +1,8 @@
PHDRS
{
rodata PT_LOAD FILEHDR PHDRS FLAGS (4);
- text PT_LOAD FLAGS (1);
btext PT_LOAD FLAGS (0x08000005);
+ text PT_LOAD FLAGS (1);
data PT_LOAD;
random PT_OPENBSD_RANDOMIZE;
syscalls PT_OPENBSD_SYSCALLS;
diff --git a/libexec/ld.so/riscv64/ld.script b/libexec/ld.so/riscv64/ld.script
index 7050c4a995b..91e9dc4adeb 100644
--- a/libexec/ld.so/riscv64/ld.script
+++ b/libexec/ld.so/riscv64/ld.script
@@ -1,8 +1,8 @@
PHDRS
{
rodata PT_LOAD FILEHDR PHDRS FLAGS (4);
- text PT_LOAD FLAGS (1);
btext PT_LOAD FLAGS (0x08000005);
+ text PT_LOAD FLAGS (1);
data PT_LOAD;
random PT_OPENBSD_RANDOMIZE;
syscalls PT_OPENBSD_SYSCALLS;
@@ -23,8 +23,6 @@ SECTIONS
/* TEXT */
. = ALIGN(0x10000);
- .text : { *(.text .text.*) } :text
- . = ALIGN(0x1000);
.boot.text :
{
. = ALIGN(0x1000);
@@ -33,6 +31,8 @@ SECTIONS
. = ALIGN(0x1000);
boot_text_end = .;
} :btext
+ . = ALIGN(0x1000);
+ .text : { *(.text .text.*) } :text
/* RELRO DATA */
. = DATA_SEGMENT_ALIGN (0x10000, 0x1000);
diff --git a/libexec/ld.so/sh/ld.script b/libexec/ld.so/sh/ld.script
index d5a87d7e848..a393c8f931d 100644
--- a/libexec/ld.so/sh/ld.script
+++ b/libexec/ld.so/sh/ld.script
@@ -1,8 +1,8 @@
PHDRS
{
rodata PT_LOAD FILEHDR PHDRS FLAGS (4);
- text PT_LOAD FLAGS (5); /* architecturally required data islands */
btext PT_LOAD FLAGS (0x08000005);
+ text PT_LOAD FLAGS (5); /* architecturally required data islands */
data PT_LOAD;
random PT_OPENBSD_RANDOMIZE;
syscalls PT_OPENBSD_SYSCALLS;
@@ -23,14 +23,14 @@ SECTIONS
/* TEXT */
. = ALIGN (0x1000);
- .text : { *(.text .text.*) } :text =0xc3c3c3c3
- . = ALIGN (0x1000);
.boot.text :
{
boot_text_start = .;
*(.boot.text)
boot_text_end = .;
} :btext
+ . = ALIGN (0x1000);
+ .text : { *(.text .text.*) } :text =0xc3c3c3c3
/* RELRO DATA */
. = DATA_SEGMENT_ALIGN (0x10000, 0x1000);
diff --git a/libexec/ld.so/sparc64/ld.script b/libexec/ld.so/sparc64/ld.script
index e7b0c06c94e..77873fa40d0 100644
--- a/libexec/ld.so/sparc64/ld.script
+++ b/libexec/ld.so/sparc64/ld.script
@@ -1,8 +1,8 @@
PHDRS
{
rodata PT_LOAD FILEHDR PHDRS FLAGS (4);
- text PT_LOAD FLAGS (1);
btext PT_LOAD FLAGS (0x08000005);
+ text PT_LOAD FLAGS (1);
data PT_LOAD;
random PT_OPENBSD_RANDOMIZE;
syscalls PT_OPENBSD_SYSCALLS;