Skip to content

Commit 76e9762

Browse files
guixiongweiIngo Molnar
authored andcommitted
x86/boot: Ignore relocations in .notes sections in walk_relocs() too
Commit: aaa8736 ("x86, relocs: Ignore relocations in .notes section") ... only started ignoring the .notes sections in print_absolute_relocs(), but the same logic should also by applied in walk_relocs() to avoid such relocations. [ mingo: Fixed various typos in the changelog, removed extra curly braces from the code. ] Fixes: aaa8736 ("x86, relocs: Ignore relocations in .notes section") Fixes: 5ead97c ("xen: Core Xen implementation") Fixes: da1a679 ("Add /sys/kernel/notes") Signed-off-by: Guixiong Wei <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Reviewed-by: Kees Cook <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 8f69cba commit 76e9762

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

arch/x86/tools/relocs.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -746,6 +746,15 @@ static void walk_relocs(int (*process)(struct section *sec, Elf_Rel *rel,
746746
if (!(sec_applies->shdr.sh_flags & SHF_ALLOC)) {
747747
continue;
748748
}
749+
750+
/*
751+
* Do not perform relocations in .notes sections; any
752+
* values there are meant for pre-boot consumption (e.g.
753+
* startup_xen).
754+
*/
755+
if (sec_applies->shdr.sh_type == SHT_NOTE)
756+
continue;
757+
749758
sh_symtab = sec_symtab->symtab;
750759
sym_strtab = sec_symtab->link->strtab;
751760
for (j = 0; j < sec->shdr.sh_size/sizeof(Elf_Rel); j++) {

0 commit comments

Comments
 (0)