mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 08:04:49 +01:00
Commit3e86e4d74c("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]. Commitddc6cbef3e("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 commitd50f210913("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>
156 lines
3 KiB
ArmAsm
156 lines
3 KiB
ArmAsm
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
|
|
*/
|
|
|
|
#include <asm-generic/vmlinux.lds.h>
|
|
#include <asm/cache.h>
|
|
#include <asm/page.h>
|
|
#include <asm/thread_info.h>
|
|
|
|
OUTPUT_ARCH(arc)
|
|
ENTRY(res_service)
|
|
|
|
#ifdef CONFIG_CPU_BIG_ENDIAN
|
|
jiffies = jiffies_64 + 4;
|
|
#else
|
|
jiffies = jiffies_64;
|
|
#endif
|
|
|
|
SECTIONS
|
|
{
|
|
/*
|
|
* ICCM starts at 0x8000_0000. So if kernel is relocated to some other
|
|
* address, make sure peripheral at 0x8z doesn't clash with ICCM
|
|
* Essentially vector is also in ICCM.
|
|
*/
|
|
|
|
. = CONFIG_LINUX_LINK_BASE;
|
|
|
|
_int_vec_base_lds = .;
|
|
.vector : {
|
|
*(.vector)
|
|
. = ALIGN(PAGE_SIZE);
|
|
}
|
|
|
|
#ifdef CONFIG_ARC_HAS_ICCM
|
|
.text.arcfp : {
|
|
*(.text.arcfp)
|
|
. = ALIGN(CONFIG_ARC_ICCM_SZ * 1024);
|
|
}
|
|
#endif
|
|
|
|
/*
|
|
* The reason for having a separate subsection .init.ramfs is to
|
|
* prevent objdump from including it in kernel dumps
|
|
*
|
|
* Reason for having .init.ramfs above .init is to make sure that the
|
|
* binary blob is tucked away to one side, reducing the displacement
|
|
* between .init.text and .text, avoiding any possible relocation
|
|
* errors because of calls from .init.text to .text
|
|
* Yes such calls do exist. e.g.
|
|
* decompress_inflate.c:gunzip( ) -> zlib_inflate_workspace( )
|
|
*/
|
|
|
|
__init_begin = .;
|
|
|
|
.init.ramfs : { INIT_RAM_FS }
|
|
|
|
. = ALIGN(PAGE_SIZE);
|
|
|
|
HEAD_TEXT_SECTION
|
|
INIT_TEXT_SECTION(L1_CACHE_BYTES)
|
|
|
|
/* INIT_DATA_SECTION open-coded: special INIT_RAM_FS handling */
|
|
.init.data : {
|
|
INIT_DATA
|
|
INIT_SETUP(L1_CACHE_BYTES)
|
|
INIT_CALLS
|
|
CON_INITCALL
|
|
}
|
|
|
|
.init.arch.info : {
|
|
__arch_info_begin = .;
|
|
*(.arch.info.init)
|
|
__arch_info_end = .;
|
|
}
|
|
|
|
PERCPU_SECTION(L1_CACHE_BYTES)
|
|
|
|
. = ALIGN(PAGE_SIZE);
|
|
__init_end = .;
|
|
|
|
.text : {
|
|
_text = .;
|
|
_stext = .;
|
|
TEXT_TEXT
|
|
SCHED_TEXT
|
|
LOCK_TEXT
|
|
KPROBES_TEXT
|
|
IRQENTRY_TEXT
|
|
SOFTIRQENTRY_TEXT
|
|
*(.fixup)
|
|
*(.gnu.warning)
|
|
}
|
|
EXCEPTION_TABLE(L1_CACHE_BYTES)
|
|
_etext = .;
|
|
|
|
_sdata = .;
|
|
RO_DATA(PAGE_SIZE)
|
|
|
|
/*
|
|
* 1. this is .data essentially
|
|
* 2. THREAD_SIZE for init.task, must be kernel-stk sz aligned
|
|
*/
|
|
RW_DATA(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE)
|
|
|
|
_edata = .;
|
|
|
|
BSS_SECTION(4, 4, 4)
|
|
|
|
#ifdef CONFIG_ARC_DW2_UNWIND
|
|
. = ALIGN(PAGE_SIZE);
|
|
.eh_frame : {
|
|
__start_unwind = .;
|
|
*(.eh_frame)
|
|
__end_unwind = .;
|
|
}
|
|
#else
|
|
/DISCARD/ : { *(.eh_frame) }
|
|
#endif
|
|
|
|
. = ALIGN(PAGE_SIZE);
|
|
_end = . ;
|
|
|
|
STABS_DEBUG
|
|
MODINFO
|
|
ELF_DETAILS
|
|
DISCARDS
|
|
|
|
.arcextmap 0 : {
|
|
*(.gnu.linkonce.arcextmap.*)
|
|
*(.arcextmap.*)
|
|
}
|
|
|
|
#ifndef CONFIG_DEBUG_INFO
|
|
/DISCARD/ : { *(.debug_frame) }
|
|
/DISCARD/ : { *(.debug_aranges) }
|
|
/DISCARD/ : { *(.debug_pubnames) }
|
|
/DISCARD/ : { *(.debug_info) }
|
|
/DISCARD/ : { *(.debug_abbrev) }
|
|
/DISCARD/ : { *(.debug_line) }
|
|
/DISCARD/ : { *(.debug_str) }
|
|
/DISCARD/ : { *(.debug_loc) }
|
|
/DISCARD/ : { *(.debug_macinfo) }
|
|
/DISCARD/ : { *(.debug_ranges) }
|
|
#endif
|
|
|
|
#ifdef CONFIG_ARC_HAS_DCCM
|
|
. = CONFIG_ARC_DCCM_BASE;
|
|
__arc_dccm_base = .;
|
|
.data.arcfp : {
|
|
*(.data.arcfp)
|
|
}
|
|
. = ALIGN(CONFIG_ARC_DCCM_SZ * 1024);
|
|
#endif
|
|
}
|