Messages in this thread |  | | From | aprasad@in ... | Date | Wed, 11 Oct 2000 19:08:19 +0530 | Subject | Re: executing function in kernel whose name is known |
| |
> >> >> >> i know the name of a function which is stored in some string in a kernel >> >> module, is there any way to execute that function. >> >> That function is implemented in a module and has been exported. >> >> thanks, >> >> anil > >> >you mean execute from userspace? No. >> >You mean execute from kernel space? Yes, but you would need to ensure the >> >module cannot be unloaded (by incrementing its module reference >> >counter) while the function is invoked. >> >Tigran >> >> module having that function won't be unloaded. but my problem is i know >> only name (a string containing name of the function) but not function >> pointer. could you please elaborate on how to do this?? >>
>Indeed, there is a function called get_module_symbol() (in >kernel/module.c) which gets the address of a symbol in the given module. >Actually, this doesn't even require kdb -- it is in the plain vanilla >kernel and is even exported to modules...
thanks Tigran, i got it working by using get_module_symbol();
its something like
void(*f)(int)
(void*)f = get_module_symbol(NULL, "name of the function");
.. now you have the funtion pointer you can call as you like
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org Please read the FAQ at http://www.tux.org/lkml/
|  |