syscall_exit_to_user_mode(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 syscall_exit_to_user_mode(9) 🌸

okay so bestie, welcome to the Kernel API Manual page for syscall_exit_to_user_mode(9) β€” it's giving β€œhandle work before returning to user mode” and honestly it ate πŸ’…


πŸ’– NAME πŸ’–

syscall_exit_to_user_mode β€” handle work before returning to user mode. Short, sweet, and exactly what it says on the tin ✨

πŸ¦‹ SYNOPSIS πŸ¦‹

void syscall_exit_to_user_mode (struct pt_regs *regs );

πŸŽ€ ARGUMENTS πŸŽ€

  • regs β€” pointer to currents pt_regs 🫢 (yes, the page says β€œcurrents”, we're keeping that exact energy πŸ’€)

🌈 DESCRIPTION 🌈

okay so here's the tea: you invoke this function with interrupts enabled and regs fully valid. It returns with all the work handled and interrupts disabled, so the caller can immediately switch to user mode. It gets called from architecture specific syscall and ret from fork code, iykyk.

The call order is literally this, bestie β€” don't skip steps:

  1. One-time syscall exit work:
    • rseq syscall exit
    • audit
    • syscall tracing
    • ptrace (single stepping)
  2. Preparatory work:
    • Disable interrupts
    • Exit to user mode loop (common TIF handling). Invokes arch_exit_to_user_mode_work for architecture specific TIF work
    • Architecture specific one time work arch_exit_to_user_mode_prepare
    • Address limit and lockdep checks
  3. Final transition (lockdep, tracing, context tracking, RCU), i.e. the functionality in exit_to_user_mode.

So this function is a combination of syscall_exit_to_user_mode_work (1), disabling interrupts followed by syscall_exit_to_user_mode_prepare (2), and exit_to_user_mode (3). The page says this function is preferred unless there is a compelling architectural reason to invoke the functions separately. Iconic behavior, honestly πŸ‘‘

πŸ”₯ SEE ALSO πŸ”₯


xoxo, bestie 🫢 source/version: ./include/linux, dated October 2026 β€” catch you in the next manpage πŸ’–

πŸ“¦ where this page comes from