linux/arch/riscv
Nathan Chancellor 861aa1be41 kbuild: Split .modinfo out from ELF_DETAILS
commit 8678591b47 upstream.

Commit 3e86e4d74c ("kbuild: keep .modinfo section in
vmlinux.unstripped") added .modinfo to ELF_DETAILS while removing it
from COMMON_DISCARDS, as it was needed in vmlinux.unstripped and
ELF_DETAILS was present in all architecture specific vmlinux linker
scripts. While this shuffle is fine for vmlinux, ELF_DETAILS and
COMMON_DISCARDS may be used by other linker scripts, such as the s390
and x86 compressed boot images, which may not expect to have a .modinfo
section. In certain circumstances, this could result in a bootloader
failing to load the compressed kernel [1].

Commit ddc6cbef3e ("s390/boot/vmlinux.lds.S: Ensure bzImage ends with
SecureBoot trailer") recently addressed this for the s390 bzImage but
the same bug remains for arm, parisc, and x86. The presence of .modinfo
in the x86 bzImage was the root cause of the issue worked around with
commit d50f210913 ("kbuild: align modinfo section for Secureboot
Authenticode EDK2 compat"). misc.c in arch/x86/boot/compressed includes
lib/decompress_unzstd.c, which in turn includes lib/xxhash.c and its
MODULE_LICENSE / MODULE_DESCRIPTION macros due to the STATIC definition.

Split .modinfo out from ELF_DETAILS into its own macro and handle it in
all vmlinux linker scripts. Discard .modinfo in the places where it was
previously being discarded from being in COMMON_DISCARDS, as it has
never been necessary in those uses.

Cc: stable@vger.kernel.org
Fixes: 3e86e4d74c ("kbuild: keep .modinfo section in vmlinux.unstripped")
Reported-by: Ed W <lists@wildgooses.com>
Closes: https://lore.kernel.org/587f25e0-a80e-46a5-9f01-87cb40cfa377@wildgooses.com/ [1]
Tested-by: Ed W <lists@wildgooses.com> # x86_64
Link: https://patch.msgid.link/20260225-separate-modinfo-from-elf-details-v1-1-387ced6baf4b@kernel.org
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2026-03-12 07:09:44 -04:00
..
boot riscv: boot: Always make Image from vmlinux, not vmlinux.unstripped 2026-01-17 16:35:12 +01:00
configs RISC-V updates for the v6.18 merge window (part two) 2025-10-04 10:36:22 -07:00
crypto lib/crypto: riscv: Depend on RISCV_EFFICIENT_VECTOR_UNALIGNED_ACCESS 2026-01-02 12:57:29 +01:00
errata riscv: errata: Fix the PAUSE Opcode for MIPS P8700 2025-09-19 10:33:56 -06:00
include riscv: Add intermediate cast to 'unsigned long' in __get_user_asm 2026-02-11 13:42:01 +01:00
kernel kbuild: Split .modinfo out from ELF_DETAILS 2026-03-12 07:09:44 -04:00
kvm RISC-V: KVM: Fix guest page fault within HLV* instructions 2025-12-18 14:03:12 +01:00
lib Crypto library updates for 6.17 2025-07-28 17:58:52 -07:00
mm riscv: ptdump: use seq_puts() in pt_dump_seq_puts() macro 2025-10-27 11:40:43 -06:00
net bpf-next-6.18 2025-09-30 17:58:11 -07:00
purgatory kcfi: Rename CONFIG_CFI_CLANG to CONFIG_CFI 2025-09-24 14:29:14 -07:00
tools riscv: Stop considering R_RISCV_NONE as bad relocations 2025-07-16 08:13:55 -07:00
Kbuild riscv: migrate to the generic rule for built-in DTB 2025-03-18 13:30:13 +00:00
Kconfig riscv: Fix CONFIG_AS_HAS_INSN for new .insn usage 2025-11-07 17:39:07 -07:00
Kconfig.debug riscv: Add tests for riscv module loading 2023-11-07 14:59:32 -08:00
Kconfig.errata riscv: errata: Fix the PAUSE Opcode for MIPS P8700 2025-09-19 10:33:56 -06:00
Kconfig.socs riscv: Add Kconfig option for ESWIN platforms 2025-09-25 08:29:05 +02:00
Kconfig.vendor riscv: Add xmipsexectl as a vendor extension 2025-09-18 20:36:00 -06:00
Makefile riscv: Remove redundant judgment for the default build target 2025-11-07 17:39:07 -07:00
Makefile.postlink kbuild: Create intermediate vmlinux build with relocations preserved 2025-03-17 00:29:50 +09:00