From: kettenis Date: Sun, 27 Jun 2021 21:39:55 +0000 (+0000) Subject: Make sure __bss_start is aligned on an 8-byte boundary. This makes sure X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=8f9b2a9c085d9b3c9cd542c4ae072cd540cd99be;p=openbsd Make sure __bss_start is aligned on an 8-byte boundary. This makes sure zeroing out .bss doesn't overrun and overwrite the ELF symbol table. ok patrick@ --- diff --git a/sys/arch/arm64/conf/kern.ldscript b/sys/arch/arm64/conf/kern.ldscript index 786cee10d7b..f2d37646aca 100644 --- a/sys/arch/arm64/conf/kern.ldscript +++ b/sys/arch/arm64/conf/kern.ldscript @@ -1,4 +1,4 @@ -/* $OpenBSD: kern.ldscript,v 1.9 2019/11/09 20:07:00 guenther Exp $ */ +/* $OpenBSD: kern.ldscript,v 1.10 2021/06/27 21:39:55 kettenis Exp $ */ /* $NetBSD: ldscript.evbarm,v 1.2 2003/03/05 23:54:22 thorpej Exp $ */ OUTPUT_ARCH(aarch64) @@ -63,6 +63,7 @@ SECTIONS } :data PROVIDE (_edata = .); + . = ALIGN(8); PROVIDE (__bss_start = .); .sbss : { @@ -80,7 +81,7 @@ SECTIONS /* Align here to ensure that the .bss section occupies space up to _end. Align after .bss to ensure correct alignment even if the .bss section disappears because there are no input sections. */ - . = ALIGN(64 / 8); + . = ALIGN(8); } :data PROVIDE (_end = .); PROVIDE (end = .); diff --git a/sys/arch/riscv64/conf/kern.ldscript b/sys/arch/riscv64/conf/kern.ldscript index 0c03b6f609e..64c7897bfdb 100644 --- a/sys/arch/riscv64/conf/kern.ldscript +++ b/sys/arch/riscv64/conf/kern.ldscript @@ -1,4 +1,4 @@ -/* $OpenBSD: kern.ldscript,v 1.2 2021/05/12 01:20:52 jsg Exp $ */ +/* $OpenBSD: kern.ldscript,v 1.3 2021/06/27 21:39:55 kettenis Exp $ */ OUTPUT_ARCH(riscv64) @@ -58,6 +58,7 @@ SECTIONS } :data PROVIDE (_edata = .); + . = ALIGN(8); PROVIDE (__bss_start = .); .sbss : { @@ -75,7 +76,7 @@ SECTIONS /* Align here to ensure that the .bss section occupies space up to _end. Align after .bss to ensure correct alignment even if the .bss section disappears because there are no input sections. */ - . = ALIGN(64 / 8); + . = ALIGN(8); } :data PROVIDE (_end = .); PROVIDE (end = .);