um: move init text between __init_begin/end

Today only the init data is there, which means any
backtrace (or other pointer printing) involving an
__init function can't print its name.

Move the initdata and include the init text between
the markers so this works.

This also enables unmapping the initdata since it's
no longer part of the overall data (which kmemleak
scans, so it would crash otherwise).

Link: https://patch.msgid.link/20260924084946.2bfe0f25e6e2.I021d3a909687794eb2c3435fdfcb7f67e3ec4ba1@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
Johannes Berg 2026-09-24 08:49:44 +02:00
parent 82ddd2bd76
commit 8966ed0b2d
2 changed files with 8 additions and 8 deletions

View File

@ -20,8 +20,12 @@ SECTIONS
__binary_start = .;
. = ALIGN(4096); /* Init code and data */
_text = .;
__init_begin = .;
INIT_TEXT_SECTION(PAGE_SIZE)
init.data : { INIT_DATA }
__init_end = .;
. = ALIGN(PAGE_SIZE);
/* Read-only sections, merged into text segment: */
@ -98,10 +102,6 @@ SECTIONS
#include <asm/common.lds.S>
__init_begin = .;
init.data : { INIT_DATA }
__init_end = .;
/* Ensure the __preinit_array_start label is properly aligned. We
could instead move the label definition inside the section, but
the linker would then create the section even if it turns out to

View File

@ -28,8 +28,12 @@ SECTIONS
. = ALIGN(PAGE_SIZE);
_text = .;
__init_begin = .;
INIT_TEXT_SECTION(0)
init.data : { INIT_DATA }
__init_end = .;
.text :
{
_stext = .;
@ -70,10 +74,6 @@ SECTIONS
#include <asm/common.lds.S>
__init_begin = .;
init.data : { INIT_DATA }
__init_end = .;
.data :
{
INIT_TASK_DATA(KERNEL_STACK_SIZE)