ptrace_init_task(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’« ptrace_init_task β€” like, the Kernel API Manual page, bestie ✨

Okay so this is ptrace_init_task(9) from the Kernel API Manual, and honestly? It's giving "small function, big responsibilities" πŸŽ€ Stick with me and you'll have it down fr fr.


🌸 NAME 🌸

ptrace_init_task β€” sets up the ptrace state for a brand-new child task, no cap πŸ’…


✨ SYNOPSIS ✨

void ptrace_init_task (struct task_struct *child , bool ptrace );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • child β€” the new child task in question, the little main character πŸ‘Ά
  • ptrace β€” a bool, and it's true if the child should be ptrace'd by the parent's tracer πŸ”

πŸ’œ DESCRIPTION πŸ’œ

So here's the vibe: this gets called immediately after child has been added to its parent's children list. Like, right after. Not before, not later. Timing is everything, bestie ⏰

About that ptrace flag β€” false is the normal, everyday case, and true means "yep, ptrace this child." That's the whole deal πŸ€·β€β™€οΈ

🚨 Locking lore, pay attention: this is called with current's siglock and write_lock_irq(tasklist_lock) held. Both of them. Simultaneously. Do not come in here unlocked, that's not the move πŸ˜­πŸ”’

πŸ”₯ SEE ALSO πŸ”₯

Kernel file ./include/linux/ptrace.h, plus the whole friend group:


And that's the whole page, periodt 🫢 This little gem lives in ./include/linux, dated October 2026 β€” go tell your friends, iykyk πŸ’–βœ¨

πŸ“¦ where this page comes from