]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.4/x86-build-move-_etext-to-actual-end-of-.text.patch
drop rdma-cma-consider-scope_id-while-binding-to-ipv6-ll-.patch from 4.4, 4.9, and...
[thirdparty/kernel/stable-queue.git] / queue-4.4 / x86-build-move-_etext-to-actual-end-of-.text.patch
1 From 64b00a5c4d878b6ae2abaddea0111a82ce85ed04 Mon Sep 17 00:00:00 2001
2 From: Kees Cook <keescook@chromium.org>
3 Date: Tue, 23 Apr 2019 11:38:27 -0700
4 Subject: x86/build: Move _etext to actual end of .text
5
6 [ Upstream commit 392bef709659abea614abfe53cf228e7a59876a4 ]
7
8 When building x86 with Clang LTO and CFI, CFI jump regions are
9 automatically added to the end of the .text section late in linking. As a
10 result, the _etext position was being labelled before the appended jump
11 regions, causing confusion about where the boundaries of the executable
12 region actually are in the running kernel, and broke at least the fault
13 injection code. This moves the _etext mark to outside (and immediately
14 after) the .text area, as it already the case on other architectures
15 (e.g. arm64, arm).
16
17 Reported-and-tested-by: Sami Tolvanen <samitolvanen@google.com>
18 Signed-off-by: Kees Cook <keescook@chromium.org>
19 Cc: Borislav Petkov <bp@suse.de>
20 Cc: Linus Torvalds <torvalds@linux-foundation.org>
21 Cc: Peter Zijlstra <peterz@infradead.org>
22 Cc: Thomas Gleixner <tglx@linutronix.de>
23 Link: http://lkml.kernel.org/r/20190423183827.GA4012@beast
24 Signed-off-by: Ingo Molnar <mingo@kernel.org>
25 Signed-off-by: Sasha Levin <sashal@kernel.org>
26 ---
27 arch/x86/kernel/vmlinux.lds.S | 6 +++---
28 1 file changed, 3 insertions(+), 3 deletions(-)
29
30 diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
31 index 17e1e60b6b400..68dd72248919b 100644
32 --- a/arch/x86/kernel/vmlinux.lds.S
33 +++ b/arch/x86/kernel/vmlinux.lds.S
34 @@ -110,11 +110,11 @@ SECTIONS
35 *(.text.__x86.indirect_thunk)
36 __indirect_thunk_end = .;
37 #endif
38 -
39 - /* End of text section */
40 - _etext = .;
41 } :text = 0x9090
42
43 + /* End of text section */
44 + _etext = .;
45 +
46 NOTES :text :note
47
48 EXCEPTION_TABLE(16) :text = 0x9090
49 --
50 2.20.1
51