Results 1 to 5 of 5
Hi,
I am trying to modify and execute the ELF loader program in the Linux kernel linux/fs/binfmt_elf.c . Though i tried compiling it using normal gcc -o binfmt_elf binfmt_elf.c , ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 01-12-2005 #1Just Joined!
- Join Date
- Sep 2004
- Posts
- 26
How to execute Linux kernel programs in User space
Hi,
I am trying to modify and execute the ELF loader program in the Linux kernel linux/fs/binfmt_elf.c . Though i tried compiling it using normal gcc -o binfmt_elf binfmt_elf.c , I could not successfully compile it.
Please tell me what needs to be done to be able to execute the program in user space or how to move to kernel space.
Regards,
Shivanu
- 01-12-2005 #2
what is the error when you try to compile?
- 01-13-2005 #3Linux User
- Join Date
- Oct 2004
- Location
- /dev/random
- Posts
- 404
binfmt_elf(binfmt_*) is(are) a module(s) - it doesn't have main(), so you cannot compile it the way you're trying.
If you want to create a user-space executable out of it, you'll have to redesign it significantly.The Unforgiven
Registered Linux User #358564
- 01-13-2005 #4Just Joined!
- Join Date
- Sep 2004
- Posts
- 26
Yes I understand that it is a kernel module and probably all binfmt_* are also kernel modules. So when i compile them in normal user space using gcc it gives an array of errors, right from errors in the header files to some dereferencing errors in the code of binfmt_elf.c itself.
So i guess that i will have to figure out a way to execute this in kernel mode. Anyway I can do that?
Thanks
Shivanu
- 01-13-2005 #5Linux User
- Join Date
- Oct 2004
- Location
- /dev/random
- Posts
- 404
Yes, of course you can execute that in the kernel.
In fact, it does get executed everytime you execute an ELF binary - whatever you compile in the modern linux distros.
You can find it out by putting printk() in the module somewhere which would output some message whenever an ELF binary is executed.The Unforgiven
Registered Linux User #358564


Reply With Quote
