Patch "x86/boot: Ignore relocations in .notes sections in walk_relocs() too" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    x86/boot: Ignore relocations in .notes sections in walk_relocs() too

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     x86-boot-ignore-relocations-in-.notes-sections-in-wa.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 64b8a38e45b6e8f1770648e40d18a0f340274739
Author: Guixiong Wei <weiguixiong@xxxxxxxxxxxxx>
Date:   Sun Mar 17 23:05:47 2024 +0800

    x86/boot: Ignore relocations in .notes sections in walk_relocs() too
    
    [ Upstream commit 76e9762d66373354b45c33b60e9a53ef2a3c5ff2 ]
    
    Commit:
    
      aaa8736370db ("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: aaa8736370db ("x86, relocs: Ignore relocations in .notes section")
    Fixes: 5ead97c84fa7 ("xen: Core Xen implementation")
    Fixes: da1a679cde9b ("Add /sys/kernel/notes")
    Signed-off-by: Guixiong Wei <weiguixiong@xxxxxxxxxxxxx>
    Signed-off-by: Ingo Molnar <mingo@xxxxxxxxxx>
    Reviewed-by: Kees Cook <keescook@xxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20240317150547.24910-1-weiguixiong@xxxxxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/x86/tools/relocs.c b/arch/x86/tools/relocs.c
index 3167228ca1746..d7549953bb797 100644
--- a/arch/x86/tools/relocs.c
+++ b/arch/x86/tools/relocs.c
@@ -692,6 +692,15 @@ static void walk_relocs(int (*process)(struct section *sec, Elf_Rel *rel,
 		if (!(sec_applies->shdr.sh_flags & SHF_ALLOC)) {
 			continue;
 		}
+
+		/*
+		 * Do not perform relocations in .notes sections; any
+		 * values there are meant for pre-boot consumption (e.g.
+		 * startup_xen).
+		 */
+		if (sec_applies->shdr.sh_type == SHT_NOTE)
+			continue;
+
 		sh_symtab = sec_symtab->symtab;
 		sym_strtab = sec_symtab->link->strtab;
 		for (j = 0; j < sec->shdr.sh_size/sizeof(Elf_Rel); j++) {




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux