rethook_hook(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ NAME ✨

rethook_hook β€” hook the current function return, periodt πŸ’…

okay bestie, welcome to the Kernel API Manual entry for rethook_hook(9) β€” yes, we're doing kernel tracing lore today 🫢


🌈 SYNOPSIS 🌈

void rethook_hook (struct rethook_node *node , struct pt_regs *regs , bool mcount );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • node β€” the struct rethook node to hook the function return πŸŽ€
  • regs β€” the struct pt_regs for the function entry ✨
  • mcount β€” true if this is called from mcount(ftrace) context πŸ’–

πŸ’– DESCRIPTION πŸ’–

Hook the current running function return. This must be called at the function entry β€” or at least regs must be the registers of the function entry, bestie, don't play with me 😭

mcount is used for identifying the context. If this is called from an ftrace (mcount) callback, mcount must be set true. If this is called from the real function entry (e.g. kprobes), mcount must be set false. This is because the way to hook the function return depends on the context β€” different vibes, different hooking path, no cap πŸ”₯

lowkey important: the true/false here is not decor, it tells the function which context it's in πŸ’€

⭐ SEE ALSO ⭐

Kernel file ./kernel/trace/rethook.c is the source file to peek at πŸ‘‘ and the related pages are:


mwah πŸ’‹ this cutie came from ./kernel/trace and is dated October 2026 β€” iconic, honestly πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from