[PATCH] um: fix shutdown __inittext access

Hajime Tazaki thehajime at gmail.com
Mon Sep 28 01:11:36 PDT 2026


On Mon, 28 Sep 2026 16:39:35 +0900,
Johannes Berg wrote:
> 
> From: Johannes Berg <johannes.berg at intel.com>
> 
> Since first moving __init text into the right place in commit
> 8966ed0b2d48 ("um: move init text between __init_begin/end")
> and then making all init sections inaccessible, shutdown and
> reboot crash instead of working correctly, for the obvious
> reason that the functions are __init but run on the way out.
> 
> Removing the __init markers would work in some way, but that
> would bubble through a lot of functions.
> 
> Instead, mark the relevant functions __noreturn (including
> longjmp() since that's now needed so start_idle_thread() can
> be __noreturn), and split out the part of main() that's done
> on the way out into a new os_exit() function that's called
> directly.
> 
> Reported-by: Hajime Tazaki <thehajime at gmail.com>
> Closes: https://lore.kernel.org/linux-um/m24ifc4v6m.wl-thehajime@gmail.com/
> Fixes: a418ab8fddea ("um: mprotect() __init memory")
> Signed-off-by: Johannes Berg <johannes.berg at intel.com>

thanks, separating the exit path from __init code is much nicer.

Tested-by: Hajime Tazaki <thehajime at gmail.com>

-- Hajime



More information about the linux-um mailing list