I know this might be counter-intuitive and completely in the opposite direc=
tion of what people use UML for, but I have a question regarding accessing =
host's files from within UML (from the UML kernel, not user). Having said t=
hat, this is what I want:
I want to write a kernel module that I load from inside a running UML using=
insmod that will be able to call functions like mmap(), ftok() etc. Here i=
s the important part: these functions should use the *host's* kernel, not t=
he UML's. This is because I want to do some IPC with another regular proces=
s that is running on the host. Here is the summary of what I want to do: th=
e host is running one regular process and UML, and from within the UML's ke=
rnel, I want to access the host's resources (like shared files and such).
If I compile a program from within UML and use the function mmap(), it will=
link to mmap() implementation that is virtualized by UML. Instead, I want =
the real mmap() function (the host's mmap() function). Obviously because of=
UML's design this shouldn't be possible from the user-space within UML... =
I am aware of that, which is why I said that my UML kernel module will have=
this functionality of doing IPC with another process running on the host.
Is there an easy way of translating functions like mmap() and accessing the=
host's files as a kernel module in UML? Maybe there are functions with nam=
es like host_mmap() or something like that, that can only be invoked from t=
he kernel of the UML?
If not, I was thinking of doing it this way: implement my own system call w=
rappers for each of the functions that I want like mmap(), ftok(), fopen(),=
etc and compile UML. Then from inside the UML, I can call these functions =
and they will call the host's mmap(), ftok(), fopen(). First of all, will t=
his work? Secondly, a problem I foresee is that any process from inside the=
UML can call these system calls (but I only want my own kernel module to b=
e able to do that... not any random user-level process).
If you have a better implementation that is easier/faster/effective, please=
let me know. Goal is for a module in UML's kernel to be able to have acces=
s to host's functions and files like fopen(), etc. and do IPC with other pr=
ocesses running on the host.
Boo!=A0Scare away worms, viruses and so much more! Try Windows Live OneCare=