I would like to know how a userspace program like modprobe can inject an executable file from userspace to kernel memory?
What kind of syscalls does it issue and what interfaces are provided by the kernel to make that possible? (detailed explanation please).


1 Answer 1


Loading a module is done using either one of init_module or finit_module. The first copies a module from a pointer, the second reads it from a file descriptor. Both support passing additional parameters to the module, and a couple of flags for the kernel.

Unloading a module is done using delete_module, which takes the name of the module to unload.

If you want to write code which does this, you might want to look into using libkmod instead; it’s part of kmod and available in all distributions.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .