ftrace_make_nop(9)
π ftrace_make_nop(9) β the Kernel API Manual, but make it make sense
okay so bestie, welcome to ftrace_make_nop π this is a page straight out of the Kernel API Manual and it's lowkey one of those "tiny function, enormous responsibility" situations. it takes a call site and turns it into a nop. that's it. that's the whole vibe. but the way it has to happen is where the drama lives π
β¨ NAME β¨
ftrace_make_nop β convert code into nop π¦
β¨ SYNOPSIS β¨
int ftrace_make_nop (struct module *mod , struct dyn_ftrace *rec ,
unsigned long addr );
like yes, three args, no cap, it's giving "simple signature, serious business" π
β¨ ARGUMENTS β¨
modβ the module structure, but only if this is being called from module load initialization πΈ (so if you're not doing that, don't stress about it)recβ the call site record, e.g.mcount/fentryβ this is your lil receipt for the thing you're patchingaddrβ the address that the call site should be calling π
β¨ DESCRIPTION β¨
okay so this is a very sensitive operation π and the arch (yes, the architecture code) needs to take great care here. like, main character energy but in a "please don't break the kernel" way.
here's the ritual, in order, no skipping steps:
- carefully read the location π
- check to see if what was read is indeed what we expect it to be π§
- on success of the compare, write to the location βοΈ
the code segment at rec->ip should be a caller to addr π that's the whole premise, bestie.
and the return values? they are not optional, they're the vibe check:
0on success β slay π-EFAULTon error reading the location π-EINVALon a failed compare of the contents π-EPERMon error writing to the location π«
and literally any other value? considered a failure, periodt. no exceptions, no "well it kind of worked" π€
β¨ SEE ALSO β¨
Kernel file ./include/linux/ftrace.h, plus the whole friend group: stack_tracer_disable(9), stack_tracer_enable(9), ftrace_get_symaddr(9), ftrace_need_init_nop(9), ftrace_init_nop(9), ftrace_make_call(9), ftrace_modify_call(9) π go read them, iykyk π«Ά
and that's the page!! π sign-off time: this one lives in ./include/linux, dated October 2026, and it's filed under ftrace_make_nop(9) β mwah, go patch safely bestie ππ₯
π¦ 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