From 8966ed0b2d48f93016379e74f6b884b1003a9023 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Thu, 24 Sep 2026 08:49:44 +0200 Subject: [PATCH] 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 --- arch/um/kernel/dyn.lds.S | 8 ++++---- arch/um/kernel/uml.lds.S | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/arch/um/kernel/dyn.lds.S b/arch/um/kernel/dyn.lds.S index a6b20c7953d6..32b60272a4fa 100644 --- a/arch/um/kernel/dyn.lds.S +++ b/arch/um/kernel/dyn.lds.S @@ -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 - __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 diff --git a/arch/um/kernel/uml.lds.S b/arch/um/kernel/uml.lds.S index f7ec7e7f5981..7a6de1c74d6d 100644 --- a/arch/um/kernel/uml.lds.S +++ b/arch/um/kernel/uml.lds.S @@ -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 - __init_begin = .; - init.data : { INIT_DATA } - __init_end = .; - .data : { INIT_TASK_DATA(KERNEL_STACK_SIZE)