Commit 0c918e75 authored by Kees Cook's avatar Kees Cook Committed by Ingo Molnar

arm/build: Assert for unwanted sections

In preparation for warning on orphan sections, enforce
expected-to-be-zero-sized sections (since discarding them might hide
problems with them suddenly gaining unexpected entries).
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
Cc: Russell King <linux@armlinux.org.uk>
Link: https://lore.kernel.org/r/20200821194310.3089815-19-keescook@chromium.org
parent 512dd2ee
...@@ -52,6 +52,17 @@ ...@@ -52,6 +52,17 @@
ARM_MMU_DISCARD(*(__ex_table)) \ ARM_MMU_DISCARD(*(__ex_table)) \
COMMON_DISCARDS COMMON_DISCARDS
/*
* Sections that should stay zero sized, which is safer to explicitly
* check instead of blindly discarding.
*/
#define ARM_ASSERTS \
.plt : { \
*(.iplt) *(.rel.iplt) *(.iplt) *(.igot.plt) \
} \
ASSERT(SIZEOF(.plt) == 0, \
"Unexpected run-time procedure linkages detected!")
#define ARM_DETAILS \ #define ARM_DETAILS \
ELF_DETAILS \ ELF_DETAILS \
.ARM.attributes 0 : { *(.ARM.attributes) } .ARM.attributes 0 : { *(.ARM.attributes) }
......
...@@ -152,6 +152,8 @@ SECTIONS ...@@ -152,6 +152,8 @@ SECTIONS
STABS_DEBUG STABS_DEBUG
DWARF_DEBUG DWARF_DEBUG
ARM_DETAILS ARM_DETAILS
ARM_ASSERTS
} }
/* /*
......
...@@ -151,6 +151,8 @@ SECTIONS ...@@ -151,6 +151,8 @@ SECTIONS
STABS_DEBUG STABS_DEBUG
DWARF_DEBUG DWARF_DEBUG
ARM_DETAILS ARM_DETAILS
ARM_ASSERTS
} }
#ifdef CONFIG_STRICT_KERNEL_RWX #ifdef CONFIG_STRICT_KERNEL_RWX
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment