enter_from_user_mode(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… enter_from_user_mode(9) β€” like, the kernel API manual bestie ✨

okay so real talk, this is a page from the Kernel API Manual and it's about enter_from_user_mode, which honestly is giving "the bouncer at the club door between userland and kernel space" energy. Let's get into it 🫢


✨ NAME ✨

enter_from_user_mode β€” establish state when coming from user mode. that's it, that's the whole vibe check πŸ’«


πŸŽ€ SYNOPSIS πŸŽ€

void enter_from_user_mode (struct pt_regs *regs );

no cap, that's the entire signature. void return, one arg, we move πŸ’…


🌸 ARGUMENTS 🌸

  • regs β€” pointer to current's pt_regs. yes bestie, the current task's registers, get you a pointer that knows where it lives πŸ”₯

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the lore: when you enter a syscall or an interrupt, interrupts get disabled, right? but user mode is traced as if interrupts are enabled. and if NO_HZ_FULL is in play, RCU might lowkey be idle. messy, i know 😭

so this function does three things, in order, and you will respect the order:

  1. Tell lockdep that interrupts are disabled πŸ”’
  2. Invoke context tracking if enabled, so it can reactivate RCU πŸ”
  3. Trace the interrupts-off state πŸ‘€

and here's the part where you gotta pay attention, bestie:

Invoked from architecture-specific syscall entry code with interrupts disabled. The calling code has to be non-instrumentable. When the function returns, all state is correct and interrupts are still disabled. The subsequent functions can be instrumented.

like, it's giving "this door is one-way and you cannot decorate it." periodt. πŸ’€

also, this is the one you call when there's architecture-specific functionality to be done between establishing state and enabling interrupts. and heads up 🌟:

The caller must enable interrupts before invoking syscall_enter_from_user_mode_work.

don't skip that step, i'm literally begging πŸ™ˆ


πŸ‘‘ SEE ALSO πŸ‘‘

kernel file over at ./include/linux/irq-entry-common.h β€” go read it, it's the whole friend group fr fr 🧚

and the rest of the squad, alphabetically-ish, all present and accounted for:

like, the whole irqentry_* family reunion β€” iconic behavior honestly 🌈


and that's a wrap, bestie πŸŽ€ this page lives in ./include/linux, the October 2026 edition, and it's filed under enter_from_user_mode(9) β€” go forth and enable those interrupts after you're done, mwah πŸ’œβœ¨

πŸ“¦ where this page comes from