Files
Yannick Cote e431bc7e12 livepatch: Free klp_{object,func}_ext data after initialization
JIRA: https://redhat.atlassian.net/browse/RHEL-152193

commit b525fcaf0a76507f152d58c6f9e5ef67b3ff552c
Author: Petr Pavlu <petr.pavlu@suse.com>
Date:   Fri Jan 23 11:26:57 2026 +0100

    livepatch: Free klp_{object,func}_ext data after initialization

    The klp_object_ext and klp_func_ext data, which are stored in the
    __klp_objects and __klp_funcs sections, respectively, are not needed
    after they are used to create the actual klp_object and klp_func
    instances. This operation is implemented by the init function in
    scripts/livepatch/init.c.

    Prefix the two sections with ".init" so they are freed after the module
    is initializated.

    Signed-off-by: Petr Pavlu <petr.pavlu@suse.com>
    Acked-by: Joe Lawrence <joe.lawrence@redhat.com>
    Acked-by: Miroslav Benes <mbenes@suse.cz>
    Reviewed-by: Aaron Tomlin <atomlin@atomlin.com>
    Link: https://patch.msgid.link/20260123102825.3521961-3-petr.pavlu@suse.com
    Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>

Signed-off-by: Yannick Cote <ycote@redhat.com>
2026-05-12 13:54:26 +00:00

66 lines
1.5 KiB
ArmAsm

/*
* Common module linker script, always used when linking a module.
* Archs are free to supply their own linker scripts. ld will
* combine them automatically.
*/
#ifdef CONFIG_UNWIND_TABLES
#define DISCARD_EH_FRAME
#else
#define DISCARD_EH_FRAME *(.eh_frame)
#endif
#include <asm-generic/codetag.lds.h>
SECTIONS {
/DISCARD/ : {
*(.discard)
*(.discard.*)
*(.export_symbol)
}
__ksymtab 0 : { *(SORT(___ksymtab+*)) }
__ksymtab_gpl 0 : { *(SORT(___ksymtab_gpl+*)) }
__kcrctab 0 : { *(SORT(___kcrctab+*)) }
__kcrctab_gpl 0 : { *(SORT(___kcrctab_gpl+*)) }
.ctors 0 : ALIGN(8) { *(SORT(.ctors.*)) *(.ctors) }
.init_array 0 : ALIGN(8) { *(SORT(.init_array.*)) *(.init_array) }
.altinstructions 0 : ALIGN(8) { KEEP(*(.altinstructions)) }
__bug_table 0 : ALIGN(8) { KEEP(*(__bug_table)) }
__jump_table 0 : ALIGN(8) { KEEP(*(__jump_table)) }
__patchable_function_entries 0 : { *(__patchable_function_entries) }
.init.klp_funcs 0 : ALIGN(8) { KEEP(*(.init.klp_funcs)) }
.init.klp_objects 0 : ALIGN(8) { KEEP(*(.init.klp_objects)) }
#ifdef CONFIG_ARCH_USES_CFI_TRAPS
__kcfi_traps 0 : { KEEP(*(.kcfi_traps)) }
#endif
.text 0 : {
*(.text .text.[0-9a-zA-Z_]*)
}
.bss 0 : {
*(.bss .bss.[0-9a-zA-Z_]*)
*(.bss..L*)
}
.data 0 : {
*(.data .data.[0-9a-zA-Z_]*)
*(.data..L*)
}
.rodata 0 : {
*(.rodata .rodata.[0-9a-zA-Z_]*)
*(.rodata..L*)
}
MOD_SEPARATE_CODETAG_SECTIONS()
}
/* bring in arch-specific sections */
#include <asm/module.lds.h>