aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-03-01 20:04:50 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-03-01 20:04:50 -0500
commit4977ab6e92e267afe9d8f78438c3db330ca8434c (patch)
tree484ebc1e13ba9375a59f83649faf706d4d5372c0
parent8f03cf50bc9443e92d6e54ac4d599357d6cb7cbb (diff)
parente390f9a9689a42f477a6073e2e7df530a4c1b740 (diff)
Merge branch 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull objtool relocation fixes from Ingo Molnar: "Two fixes related to the module loading regression introduced by the recent objtool changes" * 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: objtool, modules: Discard objtool annotation sections for modules objtool, compiler.h: Fix __unreachable section relocation size
-rw-r--r--arch/x86/kernel/vmlinux.lds.S2
-rw-r--r--include/linux/compiler-gcc.h4
-rw-r--r--include/linux/frame.h2
-rw-r--r--scripts/mod/modpost.c1
-rw-r--r--scripts/module-common.lds5
-rw-r--r--tools/objtool/builtin-check.c6
6 files changed, 11 insertions, 9 deletions
diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
index ad0118fbce90..c74ae9ce8dc4 100644
--- a/arch/x86/kernel/vmlinux.lds.S
+++ b/arch/x86/kernel/vmlinux.lds.S
@@ -345,8 +345,6 @@ SECTIONS
345 DISCARDS 345 DISCARDS
346 /DISCARD/ : { 346 /DISCARD/ : {
347 *(.eh_frame) 347 *(.eh_frame)
348 *(__func_stack_frame_non_standard)
349 *(__unreachable)
350 } 348 }
351} 349}
352 350
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 76e28c229805..0efef9cf014f 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -200,8 +200,8 @@
200#ifdef CONFIG_STACK_VALIDATION 200#ifdef CONFIG_STACK_VALIDATION
201#define annotate_unreachable() ({ \ 201#define annotate_unreachable() ({ \
202 asm("%c0:\t\n" \ 202 asm("%c0:\t\n" \
203 ".pushsection __unreachable, \"a\"\t\n" \ 203 ".pushsection .discard.unreachable\t\n" \
204 ".long %c0b\t\n" \ 204 ".long %c0b - .\t\n" \
205 ".popsection\t\n" : : "i" (__LINE__)); \ 205 ".popsection\t\n" : : "i" (__LINE__)); \
206}) 206})
207#else 207#else
diff --git a/include/linux/frame.h b/include/linux/frame.h
index e6baaba3f1ae..d772c61c31da 100644
--- a/include/linux/frame.h
+++ b/include/linux/frame.h
@@ -11,7 +11,7 @@
11 * For more information, see tools/objtool/Documentation/stack-validation.txt. 11 * For more information, see tools/objtool/Documentation/stack-validation.txt.
12 */ 12 */
13#define STACK_FRAME_NON_STANDARD(func) \ 13#define STACK_FRAME_NON_STANDARD(func) \
14 static void __used __section(__func_stack_frame_non_standard) \ 14 static void __used __section(.discard.func_stack_frame_non_standard) \
15 *__func_stack_frame_non_standard_##func = func 15 *__func_stack_frame_non_standard_##func = func
16 16
17#else /* !CONFIG_STACK_VALIDATION */ 17#else /* !CONFIG_STACK_VALIDATION */
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 4dedd0d3d3a7..30d752a4a6a6 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -854,6 +854,7 @@ static const char *const section_white_list[] =
854 ".cmem*", /* EZchip */ 854 ".cmem*", /* EZchip */
855 ".fmt_slot*", /* EZchip */ 855 ".fmt_slot*", /* EZchip */
856 ".gnu.lto*", 856 ".gnu.lto*",
857 ".discard.*",
857 NULL 858 NULL
858}; 859};
859 860
diff --git a/scripts/module-common.lds b/scripts/module-common.lds
index 73a2c7da0e55..cf7e52e4781b 100644
--- a/scripts/module-common.lds
+++ b/scripts/module-common.lds
@@ -4,7 +4,10 @@
4 * combine them automatically. 4 * combine them automatically.
5 */ 5 */
6SECTIONS { 6SECTIONS {
7 /DISCARD/ : { *(.discard) } 7 /DISCARD/ : {
8 *(.discard)
9 *(.discard.*)
10 }
8 11
9 __ksymtab 0 : { *(SORT(___ksymtab+*)) } 12 __ksymtab 0 : { *(SORT(___ksymtab+*)) }
10 __ksymtab_gpl 0 : { *(SORT(___ksymtab_gpl+*)) } 13 __ksymtab_gpl 0 : { *(SORT(___ksymtab_gpl+*)) }
diff --git a/tools/objtool/builtin-check.c b/tools/objtool/builtin-check.c
index 5fc52ee3264c..4cfdbb5b6967 100644
--- a/tools/objtool/builtin-check.c
+++ b/tools/objtool/builtin-check.c
@@ -339,13 +339,13 @@ static int add_dead_ends(struct objtool_file *file)
339 struct instruction *insn; 339 struct instruction *insn;
340 bool found; 340 bool found;
341 341
342 sec = find_section_by_name(file->elf, ".rela__unreachable"); 342 sec = find_section_by_name(file->elf, ".rela.discard.unreachable");
343 if (!sec) 343 if (!sec)
344 return 0; 344 return 0;
345 345
346 list_for_each_entry(rela, &sec->rela_list, list) { 346 list_for_each_entry(rela, &sec->rela_list, list) {
347 if (rela->sym->type != STT_SECTION) { 347 if (rela->sym->type != STT_SECTION) {
348 WARN("unexpected relocation symbol type in .rela__unreachable"); 348 WARN("unexpected relocation symbol type in %s", sec->name);
349 return -1; 349 return -1;
350 } 350 }
351 insn = find_insn(file, rela->sym->sec, rela->addend); 351 insn = find_insn(file, rela->sym->sec, rela->addend);
@@ -1272,7 +1272,7 @@ int cmd_check(int argc, const char **argv)
1272 1272
1273 INIT_LIST_HEAD(&file.insn_list); 1273 INIT_LIST_HEAD(&file.insn_list);
1274 hash_init(file.insn_hash); 1274 hash_init(file.insn_hash);
1275 file.whitelist = find_section_by_name(file.elf, "__func_stack_frame_non_standard"); 1275 file.whitelist = find_section_by_name(file.elf, ".discard.func_stack_frame_non_standard");
1276 file.rodata = find_section_by_name(file.elf, ".rodata"); 1276 file.rodata = find_section_by_name(file.elf, ".rodata");
1277 file.ignore_unreachables = false; 1277 file.ignore_unreachables = false;
1278 file.c_file = find_section_by_name(file.elf, ".comment"); 1278 file.c_file = find_section_by_name(file.elf, ".comment");