register_ftrace_direct(9)
πΈ register_ftrace_direct(9) β like, the kernel API manual, bestie πΈ
okay so real talk, this is a page straight out of the Kernel API Manual (register_ftrace_direct(9), section 9, kernel vibes only) and it's genuinely one of those "small function, huge consequences" situations. sit down, grab a lil drink π, and let's get into it.
β¨ SYNOPSIS β¨
int register_ftrace_direct (struct ftrace_ops *ops , unsigned long addr
);
like yes that's the whole signature, she's cute, she's compact π
π ARGUMENTS π
opsβ the address of thestruct ftrace_opsobject. that's your lil registry of which functions we're messing with π«Άaddrβ the address of the trampoline that gets called at theopsfunctions. the destination of the jump, iykyk
π¦ DESCRIPTION π¦
so what this actually does: it hooks up direct calls to addr from the nop locations of the functions registered in ops β and those functions get registered via the ftrace_set_filter_ip function, no cap.
the way that this works is lowkey important though: the location it calls (addr) must be able to handle a direct call. not optional, not a suggestion, it's giving requirement β¨. and it has to save the parameters of the function being traced, and restore them (or inject new ones if needed π³) before returning. that's the whole deal. miss that and it's a whole situation.
π₯ RETURN π₯
0β success, we ate π-EINVALβ theopsobject was already registered with this call, or there are no functions in theopsobject. either way, invalid, periodt.-EBUSYβ another direct function is already attached. and bestie, there can be only one. that's the rule.-ENODEVβipdoes not point to a ftrace nop location (or it's not supported). wrong address, wrong vibe π-ENOMEMβ there was an allocation failure. the memory said no π
π SEE ALSO π
okay this list is LONG and honestly iconic for it. first up, the source file:
- Kernel file
./kernel/trace/ftrace.c
and then the whole friend group (all section 9, all linked):
ftrace_lookup_ip(9)ftrace_free_filter(9)ftrace_hash_move(9)ftrace_location_range(9)ftrace_location(9)ftrace_text_reserved(9)ftrace_bug(9)ftrace_update_record(9)ftrace_test_record(9)ftrace_get_addr_new(9)ftrace_get_addr_curr(9)ftrace_rec_iter_start(9)ftrace_rec_iter_next(9)ftrace_rec_iter_record(9)ftrace_run_stop_machine(9)arch_ftrace_update_code(9)ftrace_startup_subops(9)ftrace_shutdown_subops(9)ftrace_regex_open(9)allocate_ftrace_func_mapper(9)ftrace_func_mapper_find_ip(9)ftrace_func_mapper_add_ip(9)ftrace_func_mapper_remove_ip(9)free_ftrace_func_mapper(9)unregister_ftrace_direct(9)modify_ftrace_direct_nolock(9)modify_ftrace_direct(9)hash_add(9)update_ftrace_direct_add(9)hash_sub(9)update_ftrace_direct_del(9)update_ftrace_direct_mod(9)ftrace_set_filter_ip(9)ftrace_set_filter_ips(9)ftrace_ops_set_global_filter(9)ftrace_set_filter(9)ftrace_set_notrace(9)ftrace_set_global_filter(9)ftrace_set_global_notrace(9)ftrace_ops_get_func(9)ftrace_kill(9)ftrace_is_dead(9)register_ftrace_function(9)unregister_ftrace_function(9)ftrace_lookup_symbols(9)
like. forty-five entries. she's thorough and honestly? obsessed π§
ngl this whole page lives under./kernel/trace, dated October 2026, and it's still signing off asregister_ftrace_direct(9)at the bottom. main character energy from start to finish π
and that's the page, bestie. go forth, register your direct calls responsibly, and remember: addr has to handle the call. no shortcuts, no vibes-based guessing πβ
π¦ 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