From 71918e8f61597def8a0205b9b259f791777bbdc9 Mon Sep 17 00:00:00 2001 From: emaste Date: Wed, 28 Mar 2018 16:58:24 +0000 Subject: MFC r315522: use INT3 instead of NOP for x86 binary padding We should never end up executing the inter-function padding, so we are better off faulting than silently carrying on to whatever function happens to be next. Note that LLD does this by default. Sponsored by: The FreeBSD Foundation --- contrib/binutils/ld/emulparams/elf_i386.sh | 2 +- contrib/binutils/ld/emulparams/elf_x86_64.sh | 2 +- sys/conf/ldscript.amd64 | 6 +++--- sys/conf/ldscript.i386 | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/contrib/binutils/ld/emulparams/elf_i386.sh b/contrib/binutils/ld/emulparams/elf_i386.sh index bdeaebb..b899444 100644 --- a/contrib/binutils/ld/emulparams/elf_i386.sh +++ b/contrib/binutils/ld/emulparams/elf_i386.sh @@ -6,7 +6,7 @@ COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)" NONPAGED_TEXT_START_ADDR=0x08048000 ARCH=i386 MACHINE= -NOP=0x90909090 +NOP=0xCCCCCCCC TEMPLATE_NAME=elf32 GENERATE_SHLIB_SCRIPT=yes GENERATE_PIE_SCRIPT=yes diff --git a/contrib/binutils/ld/emulparams/elf_x86_64.sh b/contrib/binutils/ld/emulparams/elf_x86_64.sh index 449ccc9..08ad514 100644 --- a/contrib/binutils/ld/emulparams/elf_x86_64.sh +++ b/contrib/binutils/ld/emulparams/elf_x86_64.sh @@ -7,7 +7,7 @@ COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)" NONPAGED_TEXT_START_ADDR=0x400000 ARCH="i386:x86-64" MACHINE= -NOP=0x90909090 +NOP=0xCCCCCCCC TEMPLATE_NAME=elf32 GENERATE_SHLIB_SCRIPT=yes GENERATE_PIE_SCRIPT=yes diff --git a/sys/conf/ldscript.amd64 b/sys/conf/ldscript.amd64 index 838a3c4..43fde20 100644 --- a/sys/conf/ldscript.amd64 +++ b/sys/conf/ldscript.amd64 @@ -56,7 +56,7 @@ SECTIONS .init : { KEEP (*(.init)) - } =0x90909090 + } =0xCCCCCCCC .plt : { *(.plt) } .text : { @@ -64,11 +64,11 @@ SECTIONS KEEP (*(.text.*personality*)) /* .gnu.warning sections are handled specially by elf32.em. */ *(.gnu.warning) - } =0x90909090 + } =0xCCCCCCCC .fini : { KEEP (*(.fini)) - } =0x90909090 + } =0xCCCCCCCC PROVIDE (__etext = .); PROVIDE (_etext = .); PROVIDE (etext = .); diff --git a/sys/conf/ldscript.i386 b/sys/conf/ldscript.i386 index 01b056c..8d0953b 100644 --- a/sys/conf/ldscript.i386 +++ b/sys/conf/ldscript.i386 @@ -44,7 +44,7 @@ SECTIONS .init : { KEEP (*(.init)) - } =0x90909090 + } =0xCCCCCCCC .plt : { *(.plt) } .text : { @@ -52,11 +52,11 @@ SECTIONS KEEP (*(.text.*personality*)) /* .gnu.warning sections are handled specially by elf32.em. */ *(.gnu.warning) - } =0x90909090 + } =0xCCCCCCCC .fini : { KEEP (*(.fini)) - } =0x90909090 + } =0xCCCCCCCC PROVIDE (__etext = .); PROVIDE (_etext = .); PROVIDE (etext = .); -- cgit v1.1