function::module_name - Linux
Overview
The function::module_name
command redefines the specified function in a kernel module with a provided function pointer. This is useful for overriding existing function pointers or implementing new functions in kernel modules.
Syntax
function::module_name [options] <module_name> <function_name> <symbol_address>
Options/Flags
- -s, –start: The start address of the function in the kernel module.
- -e, –end: The end address of the function in the kernel module.
- -f, –function: The function pointer to be assigned.
- -v, –verbose: Enable verbose output for debugging purposes.
Examples
Overriding an existing function:
function::module_name i915_load use_bo 0x12345678
This redefines the use_bo
function in the i915
module with the function pointer at address 0x12345678
.
Implementing a new function:
function::module_name my_module my_function 0x12345678
This defines a new function named my_function
in the my_module
module with the function pointer at address 0x12345678
.
Common Issues
Incorrectly specifying the symbol_address
can lead to undefined behavior. Ensure that the provided address points to a valid function in the kernel module.
Integration
Functions redefined with function::module_name
can be used in conjunction with other Linux commands and tools that interact with kernel modules. For example, the modprobe
command can be used to load the module containing the redefined function.
Related Commands
modprobe
: Loads a kernel module into the kernel.modinfo
: Displays information about a kernel module.kprobe
: Places a software breakpoint on a function in the kernel.