arch/x86/tools/relocs.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
* Linus Torvalds <torvalds@linux-foundation.org> wrote:
> On Tue, 21 Jan 2025 at 13:29, Ingo Molnar <mingo@kernel.org> wrote:
> >
> > - A series to remove the last remaining absolute symbol references from
> > .head.text, and enforce this at build time, by Ard Biesheuvel:
> > [...]
> > - Which build-time enforcement uncovered a handful of bugs of essentially
> > non-working code, and a wrokaround for a toolchain bug, fixed by
> > Ard Biesheuvel as well:
> >
> > - Fix spurious undefined reference when CONFIG_X86_5LEVEL=n, on GCC-12
> > - Disable UBSAN on SEV code that may execute very early
> > - Disable ftrace branch profiling in SEV startup code
>
> Bah. I only noticed this today, because I was on the road part of the
> week and didn't do my usual "build with clang".
>
> But this is broken with my normal clang config, and I get a very
> unhelpful error message:
>
> Absolute reference to symbol '.rodata' not permitted in .head.text
>
> and I have no idea why, or where it comes from. And that error
> message doesn't specify enough information for me to even *guess* at
> what's going on.
>
> And bisecting it obviously just points at faf0ed487415 ("x86/boot:
> Reject absolute references in .head.text"), since it's just a random
> new check for an old issue.
>
> New random rule, with new random error as a result, and totally opaque
> to anybody else than Ard.
>
> Useless crap, in other words.
>
> Why isn't the fix a revert? Because that error message is really bad.
> It needs to tell me where things went wrong, not just a "You're effed.
> Ha! Ha!".
>
> And to add insult to injury, all of this is done in-place on the
> vmlinux file, so when it all fails, make does
>
> make[2]: *** Deleting file 'vmlinux'
>
> and doesn't even leave behind anything to look at.
Sorry about that - I was really hoping we'd never see this arguably
maximally passive-aggressive message and build failure, as the patch
has lived in -next for 1.5 months, but here we go ...
> Anyway, that check needs to either
>
> (a) die a painful death very quickly
>
> (b) be made to actually print out useful information of WHERE the
> relocation comes from and WHERE it points to
I'd go for (a)+(b): I've queued up a revert which I'll send to you in a
few hours, so (b) can be done properly. Also feel free to queue up the
revert directly:
Acked-by: Ingo Molnar <mingo@kernel.org>
I'd even argue that (b) should first be a non-fatal and 100% helpful
message in a standard build warning format so that CI bots pick it up,
and then in a kernel release or two we can do (c) that does the hard
build failure ...
Thanks,
Ingo
===========================>
From: Ingo Molnar <mingo@kernel.org>
Date: Mon, 27 Jan 2025 11:08:14 +0100
Subject: [PATCH] Revert "x86/boot: Reject absolute references in .head.text"
This reverts commit faf0ed487415f76fe4acf7980ce360901f5e1698.
As Linus reported, the hard build failure is entirely unhelpful
in tracking down the bug:
Absolute reference to symbol '.rodata' not permitted in .head.text
... and to add insult to injury, the offending vmlinux gets deleted,
making it hard to figure out what's going on ...
So revert this until a (much) more developer-friendly version
is merged.
Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/CAHk-=wj7k9nvJn6cpa3-5Ciwn2RGyE605BMkjWE4MqnvC9E92A@mail.gmail.com
---
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
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
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
* 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
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
* 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
© 2016 - 2025 Red Hat, Inc.