summaryrefslogtreecommitdiffstats
path: root/recipes-kernel/linux
diff options
context:
space:
mode:
authorNaveen Saini <naveen.kumar.saini@intel.com>2021-04-01 18:34:12 +0800
committerAnuj Mittal <anuj.mittal@intel.com>2021-04-02 15:14:11 +0800
commit6505192da7bd0486bfe0cbfaed736c3f1aaa443c (patch)
treed1278f715bb5af90e9dfa0a020fd38145c6486ea /recipes-kernel/linux
parented3c6fea1417a83317ca2471c30b159a6e63b6b6 (diff)
downloadmeta-intel-6505192da7bd0486bfe0cbfaed736c3f1aaa443c.tar.gz
linux-intel-rt/5.10: update to v5.10.21
Updates -rt patchset to -rt34. Updated kernel config to latest commit. Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com> Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
Diffstat (limited to 'recipes-kernel/linux')
-rw-r--r--recipes-kernel/linux/linux-intel-rt_5.10.bb8
-rw-r--r--recipes-kernel/linux/linux-intel/objtool-fix-segfault-with-clang.patch150
-rw-r--r--recipes-kernel/linux/linux-intel/x86-entry-Emit-a-symbol-for-register-restoring-thunk.patch125
3 files changed, 3 insertions, 280 deletions
diff --git a/recipes-kernel/linux/linux-intel-rt_5.10.bb b/recipes-kernel/linux/linux-intel-rt_5.10.bb
index 8e879bca..7d67fb0a 100644
--- a/recipes-kernel/linux/linux-intel-rt_5.10.bb
+++ b/recipes-kernel/linux/linux-intel-rt_5.10.bb
@@ -11,8 +11,6 @@ python () {
11 11
12LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46" 12LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46"
13SRC_URI_append = " file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-.patch \ 13SRC_URI_append = " file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-.patch \
14 file://objtool-fix-segfault-with-clang.patch \
15 file://x86-entry-Emit-a-symbol-for-register-restoring-thunk.patch \
16 " 14 "
17 15
18KBRANCH = "5.10/preempt-rt" 16KBRANCH = "5.10/preempt-rt"
@@ -20,8 +18,8 @@ KMETA_BRANCH = "yocto-5.10"
20 18
21DEPENDS += "elfutils-native openssl-native util-linux-native" 19DEPENDS += "elfutils-native openssl-native util-linux-native"
22 20
23LINUX_VERSION ?= "5.10.12" 21LINUX_VERSION ?= "5.10.21"
24SRCREV_machine ?= "67938f51cc0319dd29e5be856ace30fd0bfed1e6" 22SRCREV_machine ?= "774cd893ee3f4044305e0a7bf5090e32b72578b3"
25SRCREV_meta ?= "513e9332a0092795b3b29eec0030b462ae4c8b6e" 23SRCREV_meta ?= "eb09284047fec2f09d62068c338ae320c6681bd1"
26 24
27LINUX_KERNEL_TYPE = "preempt-rt" 25LINUX_KERNEL_TYPE = "preempt-rt"
diff --git a/recipes-kernel/linux/linux-intel/objtool-fix-segfault-with-clang.patch b/recipes-kernel/linux/linux-intel/objtool-fix-segfault-with-clang.patch
deleted file mode 100644
index f4b1374f..00000000
--- a/recipes-kernel/linux/linux-intel/objtool-fix-segfault-with-clang.patch
+++ /dev/null
@@ -1,150 +0,0 @@
1From 44f6a7c0755d8dd453c70557e11687bb080a6f21 Mon Sep 17 00:00:00 2001
2From: Josh Poimboeuf <jpoimboe@redhat.com>
3Date: Mon, 14 Dec 2020 16:04:20 -0600
4Subject: [PATCH] objtool: Fix seg fault with Clang non-section symbols
5
6The Clang assembler likes to strip section symbols, which means objtool
7can't reference some text code by its section. This confuses objtool
8greatly, causing it to seg fault.
9
10The fix is similar to what was done before, for ORC reloc generation:
11
12 e81e07244325 ("objtool: Support Clang non-section symbols in ORC generation")
13
14Factor out that code into a common helper and use it for static call
15reloc generation as well.
16
17Reported-by: Arnd Bergmann <arnd@kernel.org>
18Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
19Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
20Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
21Reviewed-by: Miroslav Benes <mbenes@suse.cz>
22Link: https://github.com/ClangBuiltLinux/linux/issues/1207
23Link: https://lkml.kernel.org/r/ba6b6c0f0dd5acbba66e403955a967d9fdd1726a.1607983452.git.jpoimboe@redhat.com
24
25Upstream-Status: Backport
26Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
27---
28 tools/objtool/check.c | 11 +++++++++--
29 tools/objtool/elf.c | 26 ++++++++++++++++++++++++++
30 tools/objtool/elf.h | 2 ++
31 tools/objtool/orc_gen.c | 29 +++++------------------------
32 4 files changed, 42 insertions(+), 26 deletions(-)
33
34diff --git a/tools/objtool/check.c b/tools/objtool/check.c
35index c6ab44543c92a..5f8d3eed78a18 100644
36--- a/tools/objtool/check.c
37+++ b/tools/objtool/check.c
38@@ -467,13 +467,20 @@ static int create_static_call_sections(struct objtool_file *file)
39
40 /* populate reloc for 'addr' */
41 reloc = malloc(sizeof(*reloc));
42+
43 if (!reloc) {
44 perror("malloc");
45 return -1;
46 }
47 memset(reloc, 0, sizeof(*reloc));
48- reloc->sym = insn->sec->sym;
49- reloc->addend = insn->offset;
50+
51+ insn_to_reloc_sym_addend(insn->sec, insn->offset, reloc);
52+ if (!reloc->sym) {
53+ WARN_FUNC("static call tramp: missing containing symbol",
54+ insn->sec, insn->offset);
55+ return -1;
56+ }
57+
58 reloc->type = R_X86_64_PC32;
59 reloc->offset = idx * sizeof(struct static_call_site);
60 reloc->sec = reloc_sec;
61diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c
62index 4e1d7460574b4..be89c741ba9a0 100644
63--- a/tools/objtool/elf.c
64+++ b/tools/objtool/elf.c
65@@ -262,6 +262,32 @@ struct reloc *find_reloc_by_dest(const struct elf *elf, struct section *sec, uns
66 return find_reloc_by_dest_range(elf, sec, offset, 1);
67 }
68
69+void insn_to_reloc_sym_addend(struct section *sec, unsigned long offset,
70+ struct reloc *reloc)
71+{
72+ if (sec->sym) {
73+ reloc->sym = sec->sym;
74+ reloc->addend = offset;
75+ return;
76+ }
77+
78+ /*
79+ * The Clang assembler strips section symbols, so we have to reference
80+ * the function symbol instead:
81+ */
82+ reloc->sym = find_symbol_containing(sec, offset);
83+ if (!reloc->sym) {
84+ /*
85+ * Hack alert. This happens when we need to reference the NOP
86+ * pad insn immediately after the function.
87+ */
88+ reloc->sym = find_symbol_containing(sec, offset - 1);
89+ }
90+
91+ if (reloc->sym)
92+ reloc->addend = offset - reloc->sym->offset;
93+}
94+
95 static int read_sections(struct elf *elf)
96 {
97 Elf_Scn *s = NULL;
98diff --git a/tools/objtool/elf.h b/tools/objtool/elf.h
99index 807f8c6700974..e6890cc70a25b 100644
100--- a/tools/objtool/elf.h
101+++ b/tools/objtool/elf.h
102@@ -140,6 +140,8 @@ struct reloc *find_reloc_by_dest(const struct elf *elf, struct section *sec, uns
103 struct reloc *find_reloc_by_dest_range(const struct elf *elf, struct section *sec,
104 unsigned long offset, unsigned int len);
105 struct symbol *find_func_containing(struct section *sec, unsigned long offset);
106+void insn_to_reloc_sym_addend(struct section *sec, unsigned long offset,
107+ struct reloc *reloc);
108 int elf_rebuild_reloc_section(struct elf *elf, struct section *sec);
109
110 #define for_each_sec(file, sec) \
111diff --git a/tools/objtool/orc_gen.c b/tools/objtool/orc_gen.c
112index 235663b96adc7..9ce68b385a1b8 100644
113--- a/tools/objtool/orc_gen.c
114+++ b/tools/objtool/orc_gen.c
115@@ -105,30 +105,11 @@ static int create_orc_entry(struct elf *elf, struct section *u_sec, struct secti
116 }
117 memset(reloc, 0, sizeof(*reloc));
118
119- if (insn_sec->sym) {
120- reloc->sym = insn_sec->sym;
121- reloc->addend = insn_off;
122- } else {
123- /*
124- * The Clang assembler doesn't produce section symbols, so we
125- * have to reference the function symbol instead:
126- */
127- reloc->sym = find_symbol_containing(insn_sec, insn_off);
128- if (!reloc->sym) {
129- /*
130- * Hack alert. This happens when we need to reference
131- * the NOP pad insn immediately after the function.
132- */
133- reloc->sym = find_symbol_containing(insn_sec,
134- insn_off - 1);
135- }
136- if (!reloc->sym) {
137- WARN("missing symbol for insn at offset 0x%lx\n",
138- insn_off);
139- return -1;
140- }
141-
142- reloc->addend = insn_off - reloc->sym->offset;
143+ insn_to_reloc_sym_addend(insn_sec, insn_off, reloc);
144+ if (!reloc->sym) {
145+ WARN("missing symbol for insn at offset 0x%lx",
146+ insn_off);
147+ return -1;
148 }
149
150 reloc->type = R_X86_64_PC32;
diff --git a/recipes-kernel/linux/linux-intel/x86-entry-Emit-a-symbol-for-register-restoring-thunk.patch b/recipes-kernel/linux/linux-intel/x86-entry-Emit-a-symbol-for-register-restoring-thunk.patch
deleted file mode 100644
index 3cd07c0a..00000000
--- a/recipes-kernel/linux/linux-intel/x86-entry-Emit-a-symbol-for-register-restoring-thunk.patch
+++ /dev/null
@@ -1,125 +0,0 @@
1From 5e6dca82bcaa49348f9e5fcb48df4881f6d6c4ae Mon Sep 17 00:00:00 2001
2From: Nick Desaulniers <ndesaulniers@google.com>
3Date: Tue, 12 Jan 2021 11:46:24 -0800
4Subject: [PATCH] x86/entry: Emit a symbol for register restoring thunk
5
6Arnd found a randconfig that produces the warning:
7
8 arch/x86/entry/thunk_64.o: warning: objtool: missing symbol for insn at
9 offset 0x3e
10
11when building with LLVM_IAS=1 (Clang's integrated assembler). Josh
12notes:
13
14 With the LLVM assembler not generating section symbols, objtool has no
15 way to reference this code when it generates ORC unwinder entries,
16 because this code is outside of any ELF function.
17
18 The limitation now being imposed by objtool is that all code must be
19 contained in an ELF symbol. And .L symbols don't create such symbols.
20
21 So basically, you can use an .L symbol *inside* a function or a code
22 segment, you just can't use the .L symbol to contain the code using a
23 SYM_*_START/END annotation pair.
24
25Fangrui notes that this optimization is helpful for reducing image size
26when compiling with -ffunction-sections and -fdata-sections. I have
27observed on the order of tens of thousands of symbols for the kernel
28images built with those flags.
29
30A patch has been authored against GNU binutils to match this behavior
31of not generating unused section symbols ([1]), so this will
32also become a problem for users of GNU binutils once they upgrade to 2.36.
33
34Omit the .L prefix on a label so that the assembler will emit an entry
35into the symbol table for the label, with STB_LOCAL binding. This
36enables objtool to generate proper unwind info here with LLVM_IAS=1 or
37GNU binutils 2.36+.
38
39 [ bp: Massage commit message. ]
40
41Reported-by: Arnd Bergmann <arnd@arndb.de>
42Suggested-by: Josh Poimboeuf <jpoimboe@redhat.com>
43Suggested-by: Borislav Petkov <bp@alien8.de>
44Suggested-by: Mark Brown <broonie@kernel.org>
45Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
46Signed-off-by: Borislav Petkov <bp@suse.de>
47Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
48Acked-by: Josh Poimboeuf <jpoimboe@redhat.com>
49Link: https://lkml.kernel.org/r/20210112194625.4181814-1-ndesaulniers@google.com
50Link: https://github.com/ClangBuiltLinux/linux/issues/1209
51Link: https://reviews.llvm.org/D93783
52Link: https://sourceware.org/binutils/docs/as/Symbol-Names.html
53Link: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=d1bcae833b32f1408485ce69f844dcd7ded093a8 [1]
54
55Upstream-Status: Backport
56Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
57---
58 Documentation/asm-annotations.rst | 5 +++++
59 arch/x86/entry/thunk_64.S | 8 ++++----
60 include/linux/linkage.h | 5 +++++
61 3 files changed, 14 insertions(+), 4 deletions(-)
62
63diff --git a/Documentation/asm-annotations.rst b/Documentation/asm-annotations.rst
64index 32ea57483378d..76424e0431f4b 100644
65--- a/Documentation/asm-annotations.rst
66+++ b/Documentation/asm-annotations.rst
67@@ -100,6 +100,11 @@ Instruction Macros
68 ~~~~~~~~~~~~~~~~~~
69 This section covers ``SYM_FUNC_*`` and ``SYM_CODE_*`` enumerated above.
70
71+``objtool`` requires that all code must be contained in an ELF symbol. Symbol
72+names that have a ``.L`` prefix do not emit symbol table entries. ``.L``
73+prefixed symbols can be used within a code region, but should be avoided for
74+denoting a range of code via ``SYM_*_START/END`` annotations.
75+
76 * ``SYM_FUNC_START`` and ``SYM_FUNC_START_LOCAL`` are supposed to be **the
77 most frequent markings**. They are used for functions with standard calling
78 conventions -- global and local. Like in C, they both align the functions to
79diff --git a/arch/x86/entry/thunk_64.S b/arch/x86/entry/thunk_64.S
80index ccd32877a3c41..c9a9fbf1655f3 100644
81--- a/arch/x86/entry/thunk_64.S
82+++ b/arch/x86/entry/thunk_64.S
83@@ -31,7 +31,7 @@ SYM_FUNC_START_NOALIGN(\name)
84 .endif
85
86 call \func
87- jmp .L_restore
88+ jmp __thunk_restore
89 SYM_FUNC_END(\name)
90 _ASM_NOKPROBE(\name)
91 .endm
92@@ -44,7 +44,7 @@ SYM_FUNC_END(\name)
93 #endif
94
95 #ifdef CONFIG_PREEMPTION
96-SYM_CODE_START_LOCAL_NOALIGN(.L_restore)
97+SYM_CODE_START_LOCAL_NOALIGN(__thunk_restore)
98 popq %r11
99 popq %r10
100 popq %r9
101@@ -56,6 +56,6 @@ SYM_CODE_START_LOCAL_NOALIGN(.L_restore)
102 popq %rdi
103 popq %rbp
104 ret
105- _ASM_NOKPROBE(.L_restore)
106-SYM_CODE_END(.L_restore)
107+ _ASM_NOKPROBE(__thunk_restore)
108+SYM_CODE_END(__thunk_restore)
109 #endif
110diff --git a/include/linux/linkage.h b/include/linux/linkage.h
111index 5bcfbd972e970..dbf8506decca0 100644
112--- a/include/linux/linkage.h
113+++ b/include/linux/linkage.h
114@@ -178,6 +178,11 @@
115 * Objtool generates debug info for both FUNC & CODE, but needs special
116 * annotations for each CODE's start (to describe the actual stack frame).
117 *
118+ * Objtool requires that all code must be contained in an ELF symbol. Symbol
119+ * names that have a .L prefix do not emit symbol table entries. .L
120+ * prefixed symbols can be used within a code region, but should be avoided for
121+ * denoting a range of code via ``SYM_*_START/END`` annotations.
122+ *
123 * ALIAS -- does not generate debug info -- the aliased function will
124 */
125