aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Davidson <md@google.com>2013-10-10 21:39:54 -0400
committerH. Peter Anvin <hpa@linux.intel.com>2013-10-13 06:11:57 -0400
commitd751c169e9a6f0f853346f1184881422bd10b3c2 (patch)
tree5accc76adaa004d6a7cbdd8d6efd2474fb3267eb
parentd0e639c9e06d44e713170031fe05fb60ebe680af (diff)
x86, relocs: Add more per-cpu gold special cases
The "gold" linker doesn't seem to put some additional per-cpu cases in the right place. Add these to the per-cpu check. Without this, the kASLR patch series fails to correctly apply relocations, and fails to boot. Signed-off-by: Michael Davidson <md@google.com> Signed-off-by: Kees Cook <keescook@chromium.org> Link: http://lkml.kernel.org/r/20131011013954.GA28902@www.outflux.net Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
-rw-r--r--arch/x86/tools/relocs.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/arch/x86/tools/relocs.c b/arch/x86/tools/relocs.c
index f7bab68a4b83..71a2533c90d3 100644
--- a/arch/x86/tools/relocs.c
+++ b/arch/x86/tools/relocs.c
@@ -722,15 +722,23 @@ static void percpu_init(void)
722 722
723/* 723/*
724 * Check to see if a symbol lies in the .data..percpu section. 724 * Check to see if a symbol lies in the .data..percpu section.
725 * For some as yet not understood reason the "__init_begin" 725 *
726 * symbol which immediately preceeds the .data..percpu section 726 * The linker incorrectly associates some symbols with the
727 * also shows up as it it were part of it so we do an explict 727 * .data..percpu section so we also need to check the symbol
728 * check for that symbol name and ignore it. 728 * name to make sure that we classify the symbol correctly.
729 *
730 * The GNU linker incorrectly associates:
731 * __init_begin
732 *
733 * The "gold" linker incorrectly associates:
734 * init_per_cpu__irq_stack_union
735 * init_per_cpu__gdt_page
729 */ 736 */
730static int is_percpu_sym(ElfW(Sym) *sym, const char *symname) 737static int is_percpu_sym(ElfW(Sym) *sym, const char *symname)
731{ 738{
732 return (sym->st_shndx == per_cpu_shndx) && 739 return (sym->st_shndx == per_cpu_shndx) &&
733 strcmp(symname, "__init_begin"); 740 strcmp(symname, "__init_begin") &&
741 strncmp(symname, "init_per_cpu_", 13);
734} 742}
735 743
736 744