ftrace_graph_get_ret_stack(9)
π ftrace_graph_get_ret_stack β a Kernel API Manual moment
okay so bestie, gather round, because we're diving into the Kernel API Manual and this one is genuinely iconic if you're into shadow stacks (and honestly? who isn't). It's ftrace_graph_get_ret_stack(9) and it's giving "small function, big responsibility" energy.
β¨ NAME β¨
ftrace_graph_get_ret_stack β return the entry of the shadow stack π«Ά
β¨ SYNOPSIS β¨
struct ftrace_ret_stack * ftrace_graph_get_ret_stack (struct task_struct
*task , int idx );
β¨ ARGUMENTS β¨
taskβ the task you wanna read the shadow stack from. like, which one of your little guys are we snooping on πidxβ index down the shadow stack. it's the "how far back are we going" number, no cap.
β¨ DESCRIPTION β¨
So here's the tea β: this returns the ret_struct on the task's shadow stack, at the call graph position idx, and idx starts at zero. Simple as that.
- if
idxis zero, you get the last savedret_stackentry. the freshest one. the most recent vibe. β¨ - if
idxis greater than zero, you get the correspondingret_stackfor the depth of saved return addresses. like going down the stack of history, one level at a time π¦
that's literally the whole thing. zero = most recent, bigger = deeper. iykyk π
π SEE ALSO π
- Kernel file
./kernel/trace/fgraph.c fgraph_reserve_data(9)fgraph_retrieve_data(9)fgraph_get_task_var(9)fgraph_retrieve_parent_data(9)ftrace_graph_stop(9)ftrace_graph_top_ret_addr(9)ftrace_graph_ret_addr(9)
and that's the whole page, bestie, go forth and read those shadow stacks π
sign-off vibes only: this little icon lives in ./kernel/trace and it's stamped October 2026 β periodt, that's the version and date, mwah ππ
π¦ 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