rethook_find_ret_addr(9)
π rethook_find_ret_addr β Kernel API Manual, bestie edition
Okay so we're deep in the kernel manual pages today and this one is literally called rethook_find_ret_addr from the Kernel API Manual, and it does exactly what it says on the tin: it finds the correct return address that a rethook went and modified. Let's get into it π«Ά
β¨ NAME β¨
rethook_find_ret_addr β find the correct return address modified by rethook
No cap, that's the whole vibe. It finds the real return address after a rethook has done its little makeover on it π
πΈ SYNOPSIS πΈ
unsigned long rethook_find_ret_addr (struct task_struct *tsk , unsigned
long frame , struct llist_node **cur );
Three args, one unsigned long coming back at you. Slay.
π ARGUMENTS π
tskβ the target task. The one we're snooping the return address for πframeβ a frame pointer. It's your little hint for locating the address.curβ a storage of the loop cursorllist_nodepointer, so the next call knows where to pick up. It's giving bookmark energy π
π¦ DESCRIPTION π¦
So here's the tea: this function finds the correct return address modified by a rethook on tsk, and it hands it back to you as an unsigned long. β¨
Now, the important bits β read these twice, bestie, because this is where people trip:
Thetskmust be'current'or a task which is not running. That's a hard requirement, not a suggestion π
frame is a hint to get the correct return address β which is compared with the rethook::frame field. And cur is a loop cursor for searching the kretprobe return addresses on the tsk.
And the bit everyone gets wrong, okay, listen:
The'*cur'should beNULLat the first call, but'cur'itself must NOT beNULL. Two very different things, don't mix them up π
Returns the found address value, or zero if not found. Zero = not found, periodt β
π₯ SEE ALSO π₯
- Kernel file
./kernel/trace/rethook.c rethook_stop(9)rethook_free(9)rethook_alloc(9)rethook_recycle(9)rethook_try_get(9)rethook_hook(9)
Go read the whole rethook friend group, they're all iconic π
Alright bestie, that's the page! This one lives in ./kernel/trace and it's the October 2026 edition of rethook_find_ret_addr(9) β go find those return addresses, iykyk ππ§β¨
π¦ 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