* [GIT PULL] x86/cleanups for v6.14 @ 2025-01-21 7:28 Ingo Molnar 2025-01-21 7:34 ` Ingo Molnar ` (2 more replies) 0 siblings, 3 replies; 16+ messages in thread From: Ingo Molnar @ 2025-01-21 7:28 UTC (permalink / raw) To: Linus Torvalds; +Cc: linux-kernel, the arch/x86 maintainers Linus, Please pull the latest x86/cleanups Git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-cleanups-2025-01-21 # HEAD: 0094014be0cd75273ef7f2934c17fb8cffd4db6e x86/ioapic: Remove a stray tab in the IO-APIC type string Miscellaneous x86 cleanups and typo fixes, and also the removal of the "disablelapic" boot parameter. Thanks, Ingo ------------------> Alan Song (1): x86/ioapic: Remove a stray tab in the IO-APIC type string Baoquan He (2): x86/ioremap: Simplify setup_data mapping variants x86/ioremap: Remove unused size parameter in remapping functions Borislav Petkov (AMD) (5): x86/boot/compressed: Remove unused header includes from kaslr.c Documentation: Merge x86-specific boot options doc into kernel-parameters.txt x86/apic: Remove "disablelapic" cmdline option Documentation/kernel-parameters: Fix a typo in kvm.enable_virt_at_load text x86/cpufeatures: Remove "AMD" from the comments to the AMD-specific leaf Raag Jadav (1): x86/cpu: Fix typo in x86_match_cpu()'s doc Documentation/admin-guide/kernel-parameters.rst | 3 - Documentation/admin-guide/kernel-parameters.txt | 239 +++++++++++++++- Documentation/arch/x86/x86_64/boot-options.rst | 312 --------------------- .../arch/x86/x86_64/fake-numa-for-cpusets.rst | 2 +- Documentation/arch/x86/x86_64/index.rst | 1 - arch/x86/Kconfig.debug | 2 +- arch/x86/boot/compressed/kaslr.c | 4 - arch/x86/include/asm/cpufeatures.h | 12 +- arch/x86/kernel/apic/apic.c | 9 +- arch/x86/kernel/apic/io_apic.c | 2 +- arch/x86/kernel/cpu/match.c | 2 +- arch/x86/kernel/cpu/topology.c | 2 +- arch/x86/kernel/pci-dma.c | 4 - arch/x86/mm/ioremap.c | 117 +++----- 14 files changed, 277 insertions(+), 434 deletions(-) delete mode 100644 Documentation/arch/x86/x86_64/boot-options.rst ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [GIT PULL] x86/cleanups for v6.14 2025-01-21 7:28 [GIT PULL] x86/cleanups for v6.14 Ingo Molnar @ 2025-01-21 7:34 ` Ingo Molnar 2025-01-21 11:31 ` Borislav Petkov 2025-01-21 19:40 ` pr-tracker-bot 2025-01-21 21:29 ` [GIT PULL] x86/boot enhancements " Ingo Molnar 2 siblings, 1 reply; 16+ messages in thread From: Ingo Molnar @ 2025-01-21 7:34 UTC (permalink / raw) To: Linus Torvalds; +Cc: linux-kernel, the arch/x86 maintainers * Ingo Molnar <mingo@kernel.org> wrote: > Linus, > > Please pull the latest x86/cleanups Git tree from: > > git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-cleanups-2025-01-21 > > # HEAD: 0094014be0cd75273ef7f2934c17fb8cffd4db6e x86/ioapic: Remove a stray tab in the IO-APIC type string > > Miscellaneous x86 cleanups and typo fixes, and also the removal > of the "disablelapic" boot parameter. Merge note: if you've pulled x86/sev from Boris already, then there will be a new conflict in arch/x86/include/asm/cpufeatures.h due to overlapping (but compatible) changes to the same lines of code. My conflict resolution is below, for reference. Thanks, Ingo =======================> Merge branch 'x86/cleanups' into tmp.tmp Conflicts: arch/x86/include/asm/cpufeatures.h Signed-off-by: Ingo Molnar <mingo@kernel.org> diff --cc arch/x86/include/asm/cpufeatures.h index 8b55685255d6,09e1e54676f4..9746e75a1866 --- a/arch/x86/include/asm/cpufeatures.h +++ b/arch/x86/include/asm/cpufeatures.h @@@ -443,18 -443,15 +443,18 @@@ #define X86_FEATURE_SPEC_CTRL_SSBD (18*32+31) /* Speculative Store Bypass Disable */ /* AMD-defined memory encryption features, CPUID level 0x8000001f (EAX), word 19 */ - #define X86_FEATURE_SME (19*32+ 0) /* "sme" AMD Secure Memory Encryption */ - #define X86_FEATURE_SEV (19*32+ 1) /* "sev" AMD Secure Encrypted Virtualization */ + #define X86_FEATURE_SME (19*32+ 0) /* "sme" Secure Memory Encryption */ + #define X86_FEATURE_SEV (19*32+ 1) /* "sev" Secure Encrypted Virtualization */ #define X86_FEATURE_VM_PAGE_FLUSH (19*32+ 2) /* VM Page Flush MSR is supported */ - #define X86_FEATURE_SEV_ES (19*32+ 3) /* "sev_es" AMD Secure Encrypted Virtualization - Encrypted State */ - #define X86_FEATURE_SEV_SNP (19*32+ 4) /* "sev_snp" AMD Secure Encrypted Virtualization - Secure Nested Paging */ + #define X86_FEATURE_SEV_ES (19*32+ 3) /* "sev_es" Secure Encrypted Virtualization - Encrypted State */ + #define X86_FEATURE_SEV_SNP (19*32+ 4) /* "sev_snp" Secure Encrypted Virtualization - Secure Nested Paging */ #define X86_FEATURE_V_TSC_AUX (19*32+ 9) /* Virtual TSC_AUX */ - #define X86_FEATURE_SME_COHERENT (19*32+10) /* AMD hardware-enforced cache coherency */ - #define X86_FEATURE_DEBUG_SWAP (19*32+14) /* "debug_swap" AMD SEV-ES full debug state swap support */ + #define X86_FEATURE_SME_COHERENT (19*32+10) /* hardware-enforced cache coherency */ + #define X86_FEATURE_DEBUG_SWAP (19*32+14) /* "debug_swap" SEV-ES full debug state swap support */ +#define X86_FEATURE_RMPREAD (19*32+21) /* RMPREAD instruction */ +#define X86_FEATURE_SEGMENTED_RMP (19*32+23) /* Segmented RMP support */ #define X86_FEATURE_SVSM (19*32+28) /* "svsm" SVSM present */ +#define X86_FEATURE_HV_INUSE_WR_ALLOWED (19*32+30) /* Allow Write to in-use hypervisor-owned pages */ /* AMD-defined Extended Feature 2 EAX, CPUID level 0x80000021 (EAX), word 20 */ #define X86_FEATURE_NO_NESTED_DATA_BP (20*32+ 0) /* No Nested Data Breakpoints */ ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [GIT PULL] x86/cleanups for v6.14 2025-01-21 7:34 ` Ingo Molnar @ 2025-01-21 11:31 ` Borislav Petkov 0 siblings, 0 replies; 16+ messages in thread From: Borislav Petkov @ 2025-01-21 11:31 UTC (permalink / raw) To: Ingo Molnar; +Cc: Linus Torvalds, linux-kernel, the arch/x86 maintainers On Tue, Jan 21, 2025 at 08:34:29AM +0100, Ingo Molnar wrote: > Merge note: if you've pulled x86/sev from Boris already, then there Right, FWIW, I try to merge the branches locally here in the same order we send them to Linus so that I can anticipate any merge conflicts. > will be a new conflict in arch/x86/include/asm/cpufeatures.h due to > overlapping (but compatible) changes to the same lines of code. > > My conflict resolution is below, for reference. And yes, I can confirm the same resolution I've been doing here too. Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [GIT PULL] x86/cleanups for v6.14 2025-01-21 7:28 [GIT PULL] x86/cleanups for v6.14 Ingo Molnar 2025-01-21 7:34 ` Ingo Molnar @ 2025-01-21 19:40 ` pr-tracker-bot 2025-01-21 21:29 ` [GIT PULL] x86/boot enhancements " Ingo Molnar 2 siblings, 0 replies; 16+ messages in thread From: pr-tracker-bot @ 2025-01-21 19:40 UTC (permalink / raw) To: Ingo Molnar; +Cc: Linus Torvalds, linux-kernel, the arch/x86 maintainers The pull request you sent on Tue, 21 Jan 2025 08:28:27 +0100: > git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-cleanups-2025-01-21 has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/858df1de2158bd7ab88d31b557592e990bacc0b5 Thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/prtracker.html ^ permalink raw reply [flat|nested] 16+ messages in thread
* [GIT PULL] x86/boot enhancements for v6.14 2025-01-21 7:28 [GIT PULL] x86/cleanups for v6.14 Ingo Molnar 2025-01-21 7:34 ` Ingo Molnar 2025-01-21 19:40 ` pr-tracker-bot @ 2025-01-21 21:29 ` Ingo Molnar 2025-01-24 14:06 ` pr-tracker-bot 2025-01-27 3:18 ` Linus Torvalds 2 siblings, 2 replies; 16+ messages in thread From: Ingo Molnar @ 2025-01-21 21:29 UTC (permalink / raw) To: Linus Torvalds Cc: linux-kernel, the arch/x86 maintainers, David Woodhouse, Ard Biesheuvel, Peter Zijlstra, H. Peter Anvin Linus, Please pull the latest x86/boot Git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-boot-2025-01-21 # HEAD: cf4ca80650908628bf1c0c29e3fd236b1915d789 x86/sev: Disable ftrace branch profiling in SEV startup code MERGE NOTE: there will be a new conflict when pulling this tree, due to overlapping additions to arch/x86/include/asm/sev-common.h. My resolution was to advance the Linux-internal enumeration of reason codes, in merge order: #define GHCB_TERM_SECURE_TSC 10 /* Secure TSC initialization failed */ #define GHCB_TERM_SVSM_CA_REMAP_FAIL 11 /* SVSM is present but CA could not be remapped */ x86/boot changes for v6.14: - A large and involved preparatory series to pave the way to add exception handling for relocate_kernel - which will be a debugging facility that has aided in the field to debug an exceptionally hard to debug early boot bug. Plus assorted cleanups and fixes that were discovered along the way, by David Woodhouse: - Clean up and document register use in relocate_kernel_64.S - Use named labels in swap_pages in relocate_kernel_64.S - Only swap pages for ::preserve_context mode - Allocate PGD for x86_64 transition page tables separately - Copy control page into place in machine_kexec_prepare() - Invoke copy of relocate_kernel() instead of the original - Move relocate_kernel to kernel .data section - Add data section to relocate_kernel - Drop page_list argument from relocate_kernel() - Eliminate writes through kernel mapping of relocate_kernel page - Clean up register usage in relocate_kernel() - Mark relocate_kernel page as ROX instead of RWX - Disable global pages before writing to control page - Ensure preserve_context flag is set on return to kernel - Use correct swap page in swap_pages function - Fix stack and handling of re-entry point for ::preserve_context - Mark machine_kexec() with __nocfi - Cope with relocate_kernel() not being at the start of the page - Use typedef for relocate_kernel_fn function prototype - Fix location of relocate_kernel with -ffunction-sections (fix by Nathan Chancellor) - A series to remove the last remaining absolute symbol references from .head.text, and enforce this at build time, by Ard Biesheuvel: - Avoid WARN()s and panic()s in early boot code - Don't hang but terminate on failure to remap SVSM CA - Determine VA/PA offset before entering C code - Avoid intentional absolute symbol references in .head.text - Disable UBSAN in early boot code - Move ENTRY_TEXT to the start of the image - Move .head.text into its own output section - Reject absolute references in .head.text - 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 - And miscellaneous cleanups: - kexec_core: Add and update comments regarding the KEXEC_JUMP flow (Rafael J. Wysocki) - x86/sysfs: Constify 'struct bin_attribute' (Thomas Weißschuh) Signed-off-by: Ingo Molnar <mingo@kernel.org> Ard Biesheuvel (11): x86/sev: Avoid WARN()s and panic()s in early boot code x86/boot/64: Determine VA/PA offset before entering C code x86/boot/64: Avoid intentional absolute symbol references in .head.text x86/boot: Disable UBSAN in early boot code x86/kernel: Move ENTRY_TEXT to the start of the image x86/boot: Move .head.text into its own output section x86/boot: Reject absolute references in .head.text x86/boot/64: Fix spurious undefined reference when CONFIG_X86_5LEVEL=n, on GCC-12 x86/sev: Disable UBSAN on SEV code that may execute very early x86/sev: Don't hang but terminate on failure to remap SVSM CA x86/sev: Disable ftrace branch profiling in SEV startup code David Woodhouse (19): x86/kexec: Clean up and document register use in relocate_kernel_64.S x86/kexec: Use named labels in swap_pages in relocate_kernel_64.S x86/kexec: Only swap pages for ::preserve_context mode x86/kexec: Allocate PGD for x86_64 transition page tables separately x86/kexec: Copy control page into place in machine_kexec_prepare() x86/kexec: Invoke copy of relocate_kernel() instead of the original x86/kexec: Move relocate_kernel to kernel .data section x86/kexec: Add data section to relocate_kernel x86/kexec: Drop page_list argument from relocate_kernel() x86/kexec: Eliminate writes through kernel mapping of relocate_kernel page x86/kexec: Clean up register usage in relocate_kernel() x86/kexec: Mark relocate_kernel page as ROX instead of RWX x86/kexec: Disable global pages before writing to control page x86/kexec: Ensure preserve_context flag is set on return to kernel x86/kexec: Use correct swap page in swap_pages function x86/kexec: Fix stack and handling of re-entry point for ::preserve_context x86/kexec: Mark machine_kexec() with __nocfi x86/kexec: Cope with relocate_kernel() not being at the start of the page x86/kexec: Use typedef for relocate_kernel_fn function prototype Ingo Molnar (1): Merge branch 'x86/urgent' into x86/boot, to pick up dependent fixes Nathan Chancellor (1): x86/kexec: Fix location of relocate_kernel with -ffunction-sections Rafael J. Wysocki (1): kexec_core: Add and update comments regarding the KEXEC_JUMP flow Thomas Weißschuh (1): x86/sysfs: Constify 'struct bin_attribute' arch/x86/coco/sev/Makefile | 3 + arch/x86/coco/sev/core.c | 15 ++- arch/x86/coco/sev/shared.c | 16 +-- arch/x86/include/asm/init.h | 2 +- arch/x86/include/asm/kexec.h | 54 +++++----- arch/x86/include/asm/sections.h | 1 + arch/x86/include/asm/setup.h | 2 +- arch/x86/include/asm/sev-common.h | 1 + arch/x86/kernel/callthunks.c | 6 ++ arch/x86/kernel/head64.c | 40 +++++--- arch/x86/kernel/head_64.S | 12 ++- arch/x86/kernel/ksysfs.c | 18 ++-- arch/x86/kernel/machine_kexec_32.c | 7 +- arch/x86/kernel/machine_kexec_64.c | 95 ++++++++++------- arch/x86/kernel/relocate_kernel_64.S | 193 +++++++++++++++++++---------------- arch/x86/kernel/vmlinux.lds.S | 45 +++++--- arch/x86/tools/relocs.c | 8 +- kernel/kexec_core.c | 23 +++-- 18 files changed, 317 insertions(+), 224 deletions(-) ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [GIT PULL] x86/boot enhancements for v6.14 2025-01-21 21:29 ` [GIT PULL] x86/boot enhancements " Ingo Molnar @ 2025-01-24 14:06 ` pr-tracker-bot 2025-01-27 3:18 ` Linus Torvalds 1 sibling, 0 replies; 16+ messages in thread From: pr-tracker-bot @ 2025-01-24 14:06 UTC (permalink / raw) To: Ingo Molnar Cc: Linus Torvalds, linux-kernel, the arch/x86 maintainers, David Woodhouse, Ard Biesheuvel, Peter Zijlstra, H. Peter Anvin The pull request you sent on Tue, 21 Jan 2025 22:29:29 +0100: > git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-boot-2025-01-21 has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/5b7f7234ff18a5f48e0d36c417a0d07c7fdfc61a Thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/prtracker.html ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [GIT PULL] x86/boot enhancements for v6.14 2025-01-21 21:29 ` [GIT PULL] x86/boot enhancements " Ingo Molnar 2025-01-24 14:06 ` pr-tracker-bot @ 2025-01-27 3:18 ` Linus Torvalds 2025-01-27 10:20 ` [PATCH] Revert "x86/boot: Reject absolute references in .head.text Ingo Molnar ` (2 more replies) 1 sibling, 3 replies; 16+ messages in thread From: Linus Torvalds @ 2025-01-27 3:18 UTC (permalink / raw) To: Ingo Molnar, Ard Biesheuvel Cc: linux-kernel, the arch/x86 maintainers, David Woodhouse, Peter Zijlstra, H. Peter Anvin 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. So I really think this was all horribly badly done. Anyway, not know what the right thing to do is, I hacked up the makefiles to squirrel off a copy of the vmlinux file, and did objdump --no-addresses --no-show-raw-insn \ -j .head.text --disassemble \ -rR ORIGINAL | less -S and sure enough, it shows things like this: <snp_cpuid>: push %rbp push %r15 push %r14 push %rbx sub $0x18,%rsp lea 0x5ac8fb(%rip),%r8 # <cpuid_table_copy> R_X86_64_PC32 .rodata+0x4f1758 mov (%r8),%eax test %eax,%eax .. lea 0x5ac841(%rip),%rax # <cpuid_std_range_max> R_X86_64_PC32 .rodata+0x4f174c .. jmp *-0x7dfffe90(,%r9,8) R_X86_64_32S .rodata+0x170 .. and <snp_init>: push %rbp push %r15 push %r14 push %r12 .. mov %rax,0x5ac3bb(%rip) # <secrets_pa> R_X86_64_PC32 .rodata+0x4f173c mov 0x18(%r15),%rsi test %rsi,%rsi .. and <pvalidate_4k_page>: push %rbx sub $0x60,%rsp lea 0x5ac0c4(%rip),%rax # <snp_vmpl> .. test $0x4,%cl jne <pvalidate_4k_page+0xad> lea 0x5ac068(%rip),%rax # <boot_svsm_caa> R_X86_64_PC32 .rodata+0x4f1744 mov (%rax),%rax jmp <pvalidate_4k_page+0xb8> .. so those relocs to rodata most definitely exist. 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 because the current implementation of that check is not acceptable. The next time I have to play makefile games and then do objdump by hand to figure out what the %^$% the build is complaining about, I'm just reverting it outright and not writing this long explanation of the problem. Linus ^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH] Revert "x86/boot: Reject absolute references in .head.text 2025-01-27 3:18 ` Linus Torvalds @ 2025-01-27 10:20 ` Ingo Molnar 2025-01-27 15:54 ` [GIT PULL] x86 fix Ingo Molnar 2025-01-27 10:25 ` [tip: x86/urgent] Revert "x86/boot: Reject absolute references in .head.text" tip-bot2 for Ingo Molnar 2025-01-27 11:12 ` [GIT PULL] x86/boot enhancements for v6.14 Ard Biesheuvel 2 siblings, 1 reply; 16+ messages in thread From: Ingo Molnar @ 2025-01-27 10:20 UTC (permalink / raw) To: Linus Torvalds Cc: Ard Biesheuvel, linux-kernel, the arch/x86 maintainers, David Woodhouse, Peter Zijlstra, H. Peter Anvin * 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 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [GIT PULL] x86 fix 2025-01-27 10:20 ` [PATCH] Revert "x86/boot: Reject absolute references in .head.text Ingo Molnar @ 2025-01-27 15:54 ` Ingo Molnar 2025-01-27 17:10 ` Linus Torvalds 0 siblings, 1 reply; 16+ messages in thread From: Ingo Molnar @ 2025-01-27 15:54 UTC (permalink / raw) To: Linus Torvalds Cc: Ard Biesheuvel, linux-kernel, the arch/x86 maintainers, David Woodhouse, Peter Zijlstra, H. Peter Anvin 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 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [GIT PULL] x86 fix 2025-01-27 15:54 ` [GIT PULL] x86 fix Ingo Molnar @ 2025-01-27 17:10 ` Linus Torvalds 2025-01-28 22:19 ` Ingo Molnar 0 siblings, 1 reply; 16+ messages in thread From: Linus Torvalds @ 2025-01-27 17:10 UTC (permalink / raw) To: Ingo Molnar Cc: Ard Biesheuvel, linux-kernel, the arch/x86 maintainers, David Woodhouse, Peter Zijlstra, H. Peter Anvin 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 ^ permalink raw reply [flat|nested] 16+ messages in thread
* [GIT PULL] x86 fix 2025-01-27 17:10 ` Linus Torvalds @ 2025-01-28 22:19 ` Ingo Molnar 2025-01-28 22:22 ` Ingo Molnar 2025-01-28 22:39 ` pr-tracker-bot 0 siblings, 2 replies; 16+ messages in thread From: Ingo Molnar @ 2025-01-28 22:19 UTC (permalink / raw) To: Linus Torvalds Cc: Ard Biesheuvel, linux-kernel, the arch/x86 maintainers, David Woodhouse, Peter Zijlstra, H. Peter Anvin * 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 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [GIT PULL] x86 fix 2025-01-28 22:19 ` Ingo Molnar @ 2025-01-28 22:22 ` Ingo Molnar 2025-01-28 22:39 ` pr-tracker-bot 1 sibling, 0 replies; 16+ messages in thread From: Ingo Molnar @ 2025-01-28 22:22 UTC (permalink / raw) To: Linus Torvalds Cc: Ard Biesheuvel, linux-kernel, the arch/x86 maintainers, David Woodhouse, Peter Zijlstra, H. Peter Anvin * 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 ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [GIT PULL] x86 fix 2025-01-28 22:19 ` Ingo Molnar 2025-01-28 22:22 ` Ingo Molnar @ 2025-01-28 22:39 ` pr-tracker-bot 1 sibling, 0 replies; 16+ messages in thread From: pr-tracker-bot @ 2025-01-28 22:39 UTC (permalink / raw) To: Ingo Molnar Cc: Linus Torvalds, Ard Biesheuvel, linux-kernel, the arch/x86 maintainers, David Woodhouse, Peter Zijlstra, H. Peter Anvin 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 ^ permalink raw reply [flat|nested] 16+ messages in thread
* [tip: x86/urgent] Revert "x86/boot: Reject absolute references in .head.text" 2025-01-27 3:18 ` Linus Torvalds 2025-01-27 10:20 ` [PATCH] Revert "x86/boot: Reject absolute references in .head.text Ingo Molnar @ 2025-01-27 10:25 ` tip-bot2 for Ingo Molnar 2025-01-27 11:12 ` [GIT PULL] x86/boot enhancements for v6.14 Ard Biesheuvel 2 siblings, 0 replies; 16+ messages in thread From: tip-bot2 for Ingo Molnar @ 2025-01-27 10:25 UTC (permalink / raw) To: linux-tip-commits Cc: Linus Torvalds, Ard Biesheuvel, Ingo Molnar, x86, linux-kernel The following commit has been merged into the x86/urgent branch of tip: Commit-ID: fb1102a09a3b6710ac1e033690f0283696dc94dc Gitweb: https://git.kernel.org/tip/fb1102a09a3b6710ac1e033690f0283696dc94dc Author: Ingo Molnar <mingo@kernel.org> AuthorDate: Mon, 27 Jan 2025 11:08:14 +01:00 Committer: Ingo Molnar <mingo@kernel.org> CommitterDate: Mon, 27 Jan 2025 11:08:14 +01:00 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 e937be9..27441e5 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 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [GIT PULL] x86/boot enhancements for v6.14 2025-01-27 3:18 ` Linus Torvalds 2025-01-27 10:20 ` [PATCH] Revert "x86/boot: Reject absolute references in .head.text Ingo Molnar 2025-01-27 10:25 ` [tip: x86/urgent] Revert "x86/boot: Reject absolute references in .head.text" tip-bot2 for Ingo Molnar @ 2025-01-27 11:12 ` Ard Biesheuvel 2025-01-27 15:51 ` Ingo Molnar 2 siblings, 1 reply; 16+ messages in thread From: Ard Biesheuvel @ 2025-01-27 11:12 UTC (permalink / raw) To: Linus Torvalds, Nathan Chancellor Cc: Ingo Molnar, linux-kernel, the arch/x86 maintainers, David Woodhouse, Peter Zijlstra, H. Peter Anvin (cc Nathan) On Mon, 27 Jan 2025 at 04:19, 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 > Agreed. I'll change this to section+addend if the symbol is STT_SECTION, and provide the offset into .head.text as well. ... > Anyway, not know what the right thing to do is, I hacked up the > makefiles to squirrel off a copy of the vmlinux file, and did > > objdump --no-addresses --no-show-raw-insn \ > -j .head.text --disassemble \ > -rR ORIGINAL | less -S > > and sure enough, it shows things like this: > > <snp_cpuid>: > push %rbp > push %r15 > push %r14 > push %rbx > sub $0x18,%rsp > lea 0x5ac8fb(%rip),%r8 # <cpuid_table_copy> > R_X86_64_PC32 .rodata+0x4f1758 > mov (%r8),%eax > test %eax,%eax > .. > lea 0x5ac841(%rip),%rax # <cpuid_std_range_max> > R_X86_64_PC32 .rodata+0x4f174c > .. > jmp *-0x7dfffe90(,%r9,8) > R_X86_64_32S .rodata+0x170 So this should be the culprit - all the other references are RIP-relative so those are fine. I guess you are disabling retpolines and IBT in your Clang config? This looks like the switch() in snp_cpuid_postprocess() being emitted as a jump table. This is another example of a pattern that is simply broken and guaranteed to fail when booting this kernel as a SEV-SNP guest. So I hope we agree that these issues should be detected at build time, and it is only the quality of the diagnostic message that you are objecting to? > 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 > > because the current implementation of that check is not acceptable. > > The next time I have to play makefile games and then do objdump by > hand to figure out what the %^$% the build is complaining about, I'm > just reverting it outright and not writing this long explanation of > the problem. > Understood. ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [GIT PULL] x86/boot enhancements for v6.14 2025-01-27 11:12 ` [GIT PULL] x86/boot enhancements for v6.14 Ard Biesheuvel @ 2025-01-27 15:51 ` Ingo Molnar 0 siblings, 0 replies; 16+ messages in thread From: Ingo Molnar @ 2025-01-27 15:51 UTC (permalink / raw) To: Ard Biesheuvel Cc: Linus Torvalds, Nathan Chancellor, linux-kernel, the arch/x86 maintainers, David Woodhouse, Peter Zijlstra, H. Peter Anvin * Ard Biesheuvel <ardb@kernel.org> wrote: > This is another example of a pattern that is simply broken and > guaranteed to fail when booting this kernel as a SEV-SNP guest. So I > hope we agree that these issues should be detected at build time, and > it is only the quality of the diagnostic message that you are > objecting to? And I believe the fact that they are fatal messages is a problem - we should initially just emit (informative) warnings. Note that in the above case 'SEV-SNP guest' is basically support for a niche usecase built into the kernel image, and in the vast majority of cases the kernel will boot and work just fine. We should not fail the build for breakage in a niche usecase, at least initially. Thanks, Ingo ^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2025-01-28 22:38 UTC | newest] Thread overview: 16+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-01-21 7:28 [GIT PULL] x86/cleanups for v6.14 Ingo Molnar 2025-01-21 7:34 ` Ingo Molnar 2025-01-21 11:31 ` Borislav Petkov 2025-01-21 19:40 ` pr-tracker-bot 2025-01-21 21:29 ` [GIT PULL] x86/boot enhancements " Ingo Molnar 2025-01-24 14:06 ` pr-tracker-bot 2025-01-27 3:18 ` Linus Torvalds 2025-01-27 10:20 ` [PATCH] Revert "x86/boot: Reject absolute references in .head.text Ingo Molnar 2025-01-27 15:54 ` [GIT PULL] x86 fix Ingo Molnar 2025-01-27 17:10 ` Linus Torvalds 2025-01-28 22:19 ` Ingo Molnar 2025-01-28 22:22 ` Ingo Molnar 2025-01-28 22:39 ` pr-tracker-bot 2025-01-27 10:25 ` [tip: x86/urgent] Revert "x86/boot: Reject absolute references in .head.text" tip-bot2 for Ingo Molnar 2025-01-27 11:12 ` [GIT PULL] x86/boot enhancements for v6.14 Ard Biesheuvel 2025-01-27 15:51 ` Ingo Molnar
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).