summaryrefslogtreecommitdiff
path: root/arch/x86
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2019-04-23 21:38:27 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-05-31 16:48:17 +0300
commit87386764dac1e8dde46ad792e072bd8e8004ee00 (patch)
treeea96bd3141c95e1e6ec2054165d2c29cd9f5e084 /arch/x86
parent56df2dbea3893b4a8bf00f53ea0d2b87a31c5877 (diff)
downloadlinux-87386764dac1e8dde46ad792e072bd8e8004ee00.tar.xz
x86/build: Move _etext to actual end of .text
[ Upstream commit 392bef709659abea614abfe53cf228e7a59876a4 ] When building x86 with Clang LTO and CFI, CFI jump regions are automatically added to the end of the .text section late in linking. As a result, the _etext position was being labelled before the appended jump regions, causing confusion about where the boundaries of the executable region actually are in the running kernel, and broke at least the fault injection code. This moves the _etext mark to outside (and immediately after) the .text area, as it already the case on other architectures (e.g. arm64, arm). Reported-and-tested-by: Sami Tolvanen <samitolvanen@google.com> Signed-off-by: Kees Cook <keescook@chromium.org> Cc: Borislav Petkov <bp@suse.de> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/20190423183827.GA4012@beast Signed-off-by: Ingo Molnar <mingo@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/kernel/vmlinux.lds.S6
1 files changed, 3 insertions, 3 deletions
diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
index 55f04875293f..51b772f9d886 100644
--- a/arch/x86/kernel/vmlinux.lds.S
+++ b/arch/x86/kernel/vmlinux.lds.S
@@ -111,11 +111,11 @@ SECTIONS
*(.text.__x86.indirect_thunk)
__indirect_thunk_end = .;
#endif
-
- /* End of text section */
- _etext = .;
} :text = 0x9090
+ /* End of text section */
+ _etext = .;
+
NOTES :text :note
EXCEPTION_TABLE(16) :text = 0x9090