Skip to content

Commit 8678591

Browse files
committed
kbuild: Split .modinfo out from ELF_DETAILS
Commit 3e86e4d ("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 ddc6cbe ("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 d50f210 ("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: 3e86e4d ("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>
1 parent 6de23f8 commit 8678591

27 files changed

Lines changed: 29 additions & 2 deletions

File tree

arch/alpha/kernel/vmlinux.lds.S

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ SECTIONS
7171

7272
STABS_DEBUG
7373
DWARF_DEBUG
74+
MODINFO
7475
ELF_DETAILS
7576

7677
DISCARDS

arch/arc/kernel/vmlinux.lds.S

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ SECTIONS
123123
_end = . ;
124124

125125
STABS_DEBUG
126+
MODINFO
126127
ELF_DETAILS
127128
DISCARDS
128129

arch/arm/boot/compressed/vmlinux.lds.S

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ SECTIONS
2121
COMMON_DISCARDS
2222
*(.ARM.exidx*)
2323
*(.ARM.extab*)
24+
*(.modinfo)
2425
*(.note.*)
2526
*(.rel.*)
2627
*(.printk_index)

arch/arm/kernel/vmlinux-xip.lds.S

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ SECTIONS
154154

155155
STABS_DEBUG
156156
DWARF_DEBUG
157+
MODINFO
157158
ARM_DETAILS
158159

159160
ARM_ASSERTS

arch/arm/kernel/vmlinux.lds.S

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ SECTIONS
153153

154154
STABS_DEBUG
155155
DWARF_DEBUG
156+
MODINFO
156157
ARM_DETAILS
157158

158159
ARM_ASSERTS

arch/arm64/kernel/vmlinux.lds.S

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,7 @@ SECTIONS
349349

350350
STABS_DEBUG
351351
DWARF_DEBUG
352+
MODINFO
352353
ELF_DETAILS
353354

354355
HEAD_SYMBOLS

arch/csky/kernel/vmlinux.lds.S

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ SECTIONS
109109

110110
STABS_DEBUG
111111
DWARF_DEBUG
112+
MODINFO
112113
ELF_DETAILS
113114

114115
DISCARDS

arch/hexagon/kernel/vmlinux.lds.S

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ SECTIONS
6262

6363
STABS_DEBUG
6464
DWARF_DEBUG
65+
MODINFO
6566
ELF_DETAILS
6667
.hexagon.attributes 0 : { *(.hexagon.attributes) }
6768

arch/loongarch/kernel/vmlinux.lds.S

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ SECTIONS
147147

148148
STABS_DEBUG
149149
DWARF_DEBUG
150+
MODINFO
150151
ELF_DETAILS
151152

152153
#ifdef CONFIG_EFI_STUB

arch/m68k/kernel/vmlinux-nommu.lds

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ SECTIONS {
8585
_end = .;
8686

8787
STABS_DEBUG
88+
MODINFO
8889
ELF_DETAILS
8990

9091
/* Sections to be discarded */

0 commit comments

Comments
 (0)