arch_ptrace_stop(9)
π arch_ptrace_stop(9) β like, the Kernel API Manual but make it make sense β¨
okay bestie, welcome to the Kernel API Manual section 9, where we talk about the little arch hook that does its own thing right before your process gets stopped for ptrace π«Ά
πΈ NAME πΈ
arch_ptrace_stop β do the machine-specific little chores before stopping for ptrace, no cap π
β¨ SYNOPSIS β¨
arch_ptrace_stop
that's it. that's the whole vibe. no args, no returns listed, just vibes and architecture-specific business π
π¦ DESCRIPTION π¦
okay so picture this: arch_ptrace_stop_needed has just returned nonzero, and then this function gets called β and the key detail, the one you cannot forget, is that it's called with no locks held πβ¨
it is allowed to block β like, genuinely, e.g. for user memory access. it's giving "yes queen, take your time, the locks are not here" π
so the deal is: the arch can have machine-specific work that needs to be done before ptrace stops happen. that's the whole point of this hook β the generic code doesn't know your weird CPU business, so it hands the mic over π€
on ia64, the register backing store gets written back to user memory right here π β that's the iconic example, the main character of this manpage ngl.
and because this can be costly (it requires dropping the siglock, which is a whole thing π), we only do it when the arch actually requires it for this particular stop β as indicated by arch_ptrace_stop_needed. so like, a vibe check is done first, and only if it passes do we commit to the expensive behavior. periodt π
bestie don't just call this because it looks cute β it's gated behindarch_ptrace_stop_neededreturning nonzero for a reason. thesiglockdrop is real and it is not free π
π₯ SEE ALSO π₯
the kernel file is ./include/linux/ptrace.h β go read it, iykyk π and then all of these besties:
ptrace_may_access(9)ptrace_parent(9)ptrace_event_enabled(9)ptrace_event(9)ptrace_event_pid(9)ptrace_init_task(9)ptrace_release_task(9)arch_has_single_step(9)user_enable_single_step(9)user_disable_single_step(9)arch_has_block_step(9)user_enable_block_step(9)arch_ptrace_stop_needed(9)ptrace_report_syscall_permit_entry(9)ptrace_report_syscall_exit(9)
π and that's the whole page, bestie!! this one came from the ./include/linux source area, October 2026 version β so if you're reading this in some other timeline, check your local manpage first π mwah, slay, go read ptrace.h π
β¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms