[GIT PULL] x86 fix

Ingo Molnar posted 1 patch 1 year ago
There is a newer version of this series
arch/x86/tools/relocs.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
[GIT PULL] x86 fix
Posted by Ingo Molnar 1 year ago
Linus,

Please pull the latest x86/urgent Git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-urgent-2025-01-27

   # HEAD: fb1102a09a3b6710ac1e033690f0283696dc94dc Revert "x86/boot: Reject absolute references in .head.text"

Fix a build regression on certain config and build environment
combinations that generate absolute references to symbols.

 Thanks,

	Ingo

------------------>
Ingo Molnar (1):
      Revert "x86/boot: Reject absolute references in .head.text"


 arch/x86/tools/relocs.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/arch/x86/tools/relocs.c b/arch/x86/tools/relocs.c
index e937be979ec8..27441e5863b2 100644
--- a/arch/x86/tools/relocs.c
+++ b/arch/x86/tools/relocs.c
@@ -841,10 +841,10 @@ static int is_percpu_sym(ElfW(Sym) *sym, const char *symname)
 static int do_reloc64(struct section *sec, Elf_Rel *rel, ElfW(Sym) *sym,
 		      const char *symname)
 {
-	int headtext = !strcmp(sec_name(sec->shdr.sh_info), ".head.text");
 	unsigned r_type = ELF64_R_TYPE(rel->r_info);
 	ElfW(Addr) offset = rel->r_offset;
 	int shn_abs = (sym->st_shndx == SHN_ABS) && !is_reloc(S_REL, symname);
+
 	if (sym->st_shndx == SHN_UNDEF)
 		return 0;
 
@@ -900,12 +900,6 @@ static int do_reloc64(struct section *sec, Elf_Rel *rel, ElfW(Sym) *sym,
 			break;
 		}
 
-		if (headtext) {
-			die("Absolute reference to symbol '%s' not permitted in .head.text\n",
-			    symname);
-			break;
-		}
-
 		/*
 		 * Relocation offsets for 64 bit kernels are output
 		 * as 32 bits and sign extended back to 64 bits when
Re: [GIT PULL] x86 fix
Posted by Linus Torvalds 1 year ago
On Mon, 27 Jan 2025 at 07:54, Ingo Molnar <mingo@kernel.org> wrote:
>
> Fix a build regression on certain config and build environment
> combinations that generate absolute references to symbols.

I'll hold off on this, because it looks like Ard is very close to have
this fixed (and also made it non-fatal in the process).

               Linus
[GIT PULL] x86 fix
Posted by Ingo Molnar 1 year ago

* Linus Torvalds <torvalds@linux-foundation.org> wrote:

> On Mon, 27 Jan 2025 at 07:54, Ingo Molnar <mingo@kernel.org> wrote:
> >
> > Fix a build regression on certain config and build environment
> > combinations that generate absolute references to symbols.
> 
> I'll hold off on this, because it looks like Ard is very close to 
> have this fixed (and also made it non-fatal in the process).

Makes sense - meanwhile while Ard is iterating his build-warning patch 
here's the SEV fix that should address the build failure you've 
reported.

Please pull the latest x86/urgent Git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-urgent-2025-01-28

   # HEAD: 1105ab42a84bc11c62597005f78ccad2434fbd66 x86/sev: Disable jump tables in SEV startup code

Fix a build regression on certain config and build environment
combinations that generate absolute references to symbols.

 Thanks,

	Ingo

------------------>
Ard Biesheuvel (1):
      x86/sev: Disable jump tables in SEV startup code


 arch/x86/coco/sev/Makefile | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/x86/coco/sev/Makefile b/arch/x86/coco/sev/Makefile
index 08de37559307..dcb06dc8b5ae 100644
--- a/arch/x86/coco/sev/Makefile
+++ b/arch/x86/coco/sev/Makefile
@@ -2,6 +2,10 @@
 
 obj-y += core.o
 
+# jump tables are emitted using absolute references in non-PIC code
+# so they cannot be used in the early SEV startup code
+CFLAGS_core.o += -fno-jump-tables
+
 ifdef CONFIG_FUNCTION_TRACER
 CFLAGS_REMOVE_core.o = -pg
 endif
Re: [GIT PULL] x86 fix
Posted by pr-tracker-bot@kernel.org 1 year ago
The pull request you sent on Tue, 28 Jan 2025 23:19:45 +0100:

> git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-urgent-2025-01-28

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/05dbaf8dd8bf537d4b4eb3115ab42a5fb40ff1f5

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html
Re: [GIT PULL] x86 fix
Posted by Ingo Molnar 1 year ago
* Ingo Molnar <mingo@kernel.org> wrote:

> 
> * Linus Torvalds <torvalds@linux-foundation.org> wrote:
> 
> > On Mon, 27 Jan 2025 at 07:54, Ingo Molnar <mingo@kernel.org> wrote:
> > >
> > > Fix a build regression on certain config and build environment
> > > combinations that generate absolute references to symbols.
> > 
> > I'll hold off on this, because it looks like Ard is very close to 
> > have this fixed (and also made it non-fatal in the process).
> 
> Makes sense - meanwhile while Ard is iterating his build-warning patch 
> here's the SEV fix that should address the build failure you've 
> reported.
> 
> Please pull the latest x86/urgent Git tree from:
> 
>    git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-urgent-2025-01-28
> 
>    # HEAD: 1105ab42a84bc11c62597005f78ccad2434fbd66 x86/sev: Disable jump tables in SEV startup code
> 
> Fix a build regression on certain config and build environment
> combinations that generate absolute references to symbols.

Erm, I phrased this poorly: the primary fix is that of a potential 
early boot crash in SEV-SNP guests - the wider build error was the 
canary that highlighted the SEV boot code bug that was benign in your 
specific environment.

Thanks,

	Ingo