uprobe_register(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… uprobe_register(9) β€” like, the kernel API manual, but make it make sense

okay so bestie, buckle up β€” this one lives in the Kernel API Manual section 9 (the kernel-functions girlies), and it's literally called uprobe_register. Yes, it's a probe. Yes, you're registering it. We love a self-explanatory name. πŸŽ€


✨ NAME ✨

uprobe_register β€” register a probe πŸ¦‹


🌸 SYNOPSIS 🌸

struct uprobe * uprobe_register (struct inode *inode , loff_t offset ,
       loff_t ref_ctr_offset , struct uprobe_consumer *uc );

like, that's the whole vibe check right there πŸ’–


🫢 ARGUMENTS 🫢

  • inode β€” the file in which the probe has to be placed. that's the file, bestie, the actual one, the probee πŸ“
  • offset β€” offset from the start of the file. so like, where in the file. count from zero, not from your feelings πŸ’«
  • ref_ctr_offset β€” offset of SDT marker / reference counter. yes, both of those things, that's what it says, I don't make the rules 🎯
  • uc β€” information on howto handle the probe.. (the double period is canon, don't come for me 😭) like, your consumer, your instructions, your whole struct uprobe_consumer situation πŸ‘‘

πŸ’œ DESCRIPTION πŸ’œ

okay so here's the tea, and it's actually kind of elegant ngl ✨

Apart from the access refcount, uprobe_register takes a creation refcount (thro alloc_uprobe) if and only if this uprobe is getting inserted into the rbtree β€” that's the case where it's the first consumer for an inode:offset tuple 🌈. So like, first one in the door, you get the extra refcount. no cap.

and why do we care about this creation refcount? because it stops uprobe_unregister from freeing the uprobe even before the register operation is complete 😀πŸ”₯ β€” imagine being freed mid-registration, could not be me, embarrassing.

the creation refcount gets released when the last uc for the uprobe unregisters. last one out, lights off, refcount dropped πŸ’…

⚠️ real talk though: the caller of uprobe_register is required to keep inode (and the containing mount) referenced. like, hold onto it. don't let it go. this is not optional, this is a requirement, periodt πŸ‘‘

⭐ RETURN ⭐

pointer to the new uprobe on success πŸŽ‰ or an ERR_PTR on failure πŸ’€ (check it, bestie, always check it)


🧚 SEE ALSO 🧚

Kernel file ./kernel/events/uprobes.c πŸ’– and also these iconic siblings:


and that's the whole page, bestie 🫢 this one's from ./kernel/events, dated October 2026, and it's the uprobe_register(9) page β€” go forth and probe responsibly, mwah πŸ’‹πŸŽ€

πŸ“¦ where this page comes from