exit_to_user_mode(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ exit_to_user_mode β€” the manual page, but make it a vibe ✨

okay bestie, this one's a kernel API manual page (exit_to_user_mode(9)), and it's literally the "last looks in the mirror before you go out" function for the kernel. Let's get into it πŸ’…


🌸 NAME 🌸

exit_to_user_mode β€” the fixup-state-when-you're-bouncing-back-to-user-mode situation 🫢


πŸ¦‹ SYNOPSIS πŸ¦‹

void exit_to_user_mode (void );

πŸŽ€ ARGUMENTS πŸŽ€

  • void β€” no arguments. none. zero. it takes nothing and it's iconic for it ✨

πŸ‘‘ DESCRIPTION πŸ‘‘

so here's the tea: syscall/interrupt exit enables interrupts, but the kernel state is interrupts disabled when this gets invoked. and it also tells RCU about it, which is important, don't skip that part πŸ”₯

The steps, in order:

  1. Trace interrupts on state πŸ‘€
  2. Invoke context tracking if enabled to adjust RCU state πŸ”„
  3. Invoke architecture specific last minute exit code, e.g. speculation mitigations, etc.: arch_exit_to_user_mode 🧚
  4. Tell lockdep that interrupts are enabled πŸ”“

You invoke this from architecture specific code when syscall_exit_to_user_mode is not suitable as the last step before returning to userspace.

🚨 okay this part is important, no cap: it must be invoked with interrupts disabled, and the caller must be non-instrumentable. Also the caller has to invoke syscall_exit_to_user_mode_work before this. it's giving strict instructions, so follow them fr fr 😭

πŸ’– SEE ALSO πŸ’–


that's the whole page, bestie 🌈 it's from ./include/linux, dated October 2026, and it's the exit_to_user_mode(9) manual page β€” mwah, go slay your syscalls πŸ’‹πŸ‘‘

πŸ“¦ where this page comes from