Execute a program in kernel space in Linux

浪尽此生 提交于 2019-11-30 14:32:30

User programs don't execute in kernel space - that's what makes them user programs.

If you want to execute code in kernel space you have two options: build it in to the kernel, or load it with a kernel module.

You wrote in another question that you are a newcomer to kernel programming. Using KML is highly unconventional, and will be far more complicated that doing things in the standard way. That will make your learning that much more difficult. I would suggest that your best option is reevaluate why you want to run a user space app in kernel space and find way not to do it.

There may be a good reason to do such a thing, but it's not clear to me what that reason could be. One thing you should understand with kernel development is that just because something is possible, it's not necessarily something that should be done.

If you really want a cross platform solution, you'll have to write it yourself. The only architectures supported by KML are IA32 and AMD64.

Kernel programming is pretty much by definition platform specific, since kernels for different platforms are all different.

Take a look at FemtoLinux. Basically, it is a KML for embedded systems and embedded processors such as ARM and MIPS

call_usrmodehelper

firo

If you want to start a user program from kernel space, take a look at run_init_process(). It's the way kernel run the init program.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!