rethook_hook(9)
β¨ 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β thestruct pt_regsfor the function entry β¨mcountβtrueif this is called frommcount(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: thetrue/falsehere 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:
rethook_stop(9)rethook_free(9)rethook_alloc(9)rethook_recycle(9)rethook_try_get(9)rethook_find_ret_addr(9)
mwah π this cutie came from ./kernel/trace and is dated October 2026 β iconic, honestly π¦πΈ
π¦ 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