ftrace_modify_call(9)
π ftrace_modify_call β Kernel API Manual (yes bestie, we're in the kernel now)
okay so real talk, this page is ftrace_modify_call(9) from the Kernel API Manual, and it's giving "surgery on a live function call" energy. buckle up π
β¨ NAME β¨
ftrace_modify_call β convert from one addr to another (no nop)
like, we're literally swapping out one call target for a different one. no nop shenanigans here, we're going straight from addr to addr π¦
πΈ SYNOPSIS πΈ
int ftrace_modify_call (struct dyn_ftrace *rec , unsigned long old_addr
, unsigned long addr );
three args, one int coming back at you. periodt.
π«Ά ARGUMENTS π«Ά
recβ the call site record (e.g.mcount/fentry). this is, like, the main character of the whole operation πold_addrβ the address that's expected to be currently called to. key word: expected πaddrβ the address to change to. this is where we're headed, bestie β¨
π₯ DESCRIPTION π₯
okay so listen. this is a very sensitive operation and great care needs to be taken by the arch. the arch has to do this properly, no cap. π
here's the whole ritual: the operation should carefully read the location, then check to see if what is read is indeed what we expect it to be, and then β only on success of the compare β it should write to the location. read, compare, then write. in that order. don't skip steps, i'm begging π
when using call ops, this gets called when the associated ops change β even when (addr == old_addr). yeah, even then. it still runs. iconic behavior honestly π
also: the code segment at rec->ip should be a caller to old_addr. that's the vibe check it has to pass π§
β οΈ now the part where you actually pay attention, bestie. Return must be: -0on success π --EFAULTon error reading the location --EINVALon a failed compare of the contents --EPERMon error writing to the location Any other value will be considered a failure. every last one. no exceptions, no "but it almost worked", nothing. fr fr π
π SEE ALSO π
Kernel file ./include/linux/ftrace.h
stack_tracer_disable(9)stack_tracer_enable(9)ftrace_get_symaddr(9)ftrace_make_nop(9)ftrace_need_init_nop(9)ftrace_init_nop(9)ftrace_make_call(9)
go read those too, iykyk π
and that's the whole page, bestie! this one lives over in ./include/linux and it's dated October 2026 πβ mwah, slay, go patch your kernel carefully π
π¦ 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