Hello:

I know this might be counter-intuitive and completely in the opposite direction 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 that, 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 is the important part: these functions should use the *host's* kernel, not the UML's. This is because I want to do some IPC with another regular process that is running on the host. Here is the summary of what I want to do: the host is running one regular process and UML, and from within the UML's kernel, 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 names like host_mmap() or something like that, that can only be invoked from the kernel of the UML?

If not, I was thinking of doing it this way: implement my own system call wrappers 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 this 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 be 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 access to host's functions and files like fopen(), etc. and do IPC with other processes running on the host.

Regards,


Boo! Scare away worms, viruses and so much more! Try Windows Live OneCare! Try now!