[PATCH 1/2] um: move init text between __init_begin/end

Johannes Berg johannes at sipsolutions.net
Wed Sep 23 23:49:44 PDT 2026


From: Johannes Berg <johannes.berg at intel.com>

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).

Signed-off-by: Johannes Berg <johannes.berg at intel.com>
---
 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 ad3cefeff2ac..875db0130d75 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 <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
diff --git a/arch/um/kernel/uml.lds.S b/arch/um/kernel/uml.lds.S
index 30aa24348d60..d161518d7195 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 <asm/common.lds.S>
 
-  __init_begin = .;
-  init.data : { INIT_DATA }
-  __init_end = .;
-
   .data    :
   {
     INIT_TASK_DATA(KERNEL_STACK_SIZE)
-- 
2.55.0




More information about the linux-um mailing list