All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86, relocs: Ignore relocations in .notes section on walk_relocs
@ 2024-03-17 15:05 Guixiong Wei
  2024-03-18 21:40 ` Kees Cook
  2024-03-22  8:56 ` [tip: x86/boot] x86/boot: Ignore relocations in .notes sections in walk_relocs() too tip-bot2 for Guixiong Wei
  0 siblings, 2 replies; 14+ messages in thread
From: Guixiong Wei @ 2024-03-17 15:05 UTC (permalink / raw)
  To: keescook, tglx
  Cc: jgross, mingo, bp, dave.hansen, x86, hpa, peterz, gregkh,
	tony.luck, adobriyan, linux-kernel, linux-hardening, weiguixiong

The commit aaa8736370db ("x86, relocs: Ignore relocations in
.notes section") only ignore .note section on print_absolute_relocs,
but it also need to add on walk_relocs to avoid relocations in .note
section.

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@bytedance.com>
---
 arch/x86/tools/relocs.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/arch/x86/tools/relocs.c b/arch/x86/tools/relocs.c
index b029fb81ebee..33844b33b8b9 100644
--- a/arch/x86/tools/relocs.c
+++ b/arch/x86/tools/relocs.c
@@ -746,6 +746,16 @@ 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 section; 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++) {
-- 
2.24.3 (Apple Git-128)


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2024-03-25 20:23 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-17 15:05 [PATCH] x86, relocs: Ignore relocations in .notes section on walk_relocs Guixiong Wei
2024-03-18 21:40 ` Kees Cook
2024-03-18 21:56   ` Borislav Petkov
2024-03-18 23:45     ` Kees Cook
2024-03-19  8:16       ` Borislav Petkov
2024-03-19 16:56         ` Kees Cook
2024-03-22 19:46           ` Borislav Petkov
2024-03-22 23:40             ` Kees Cook
2024-03-23 10:38               ` Borislav Petkov
2024-03-25 20:23                 ` Kees Cook
2024-03-22  8:45   ` Ingo Molnar
2024-03-22 23:41     ` Kees Cook
2024-03-24  3:57       ` [PATCH] x86/build: Clean up arch/x86/tools/relocs.c a bit Ingo Molnar
2024-03-22  8:56 ` [tip: x86/boot] x86/boot: Ignore relocations in .notes sections in walk_relocs() too tip-bot2 for Guixiong Wei

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.