All of lore.kernel.org
 help / color / mirror / Atom feed
* [uml-devel] accessing host resources from inside the UML kernel
@ 2007-10-13  4:56 Ahmad Sharif
  2007-10-17 16:07 ` Jeff Dike
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Sharif @ 2007-10-13  4:56 UTC (permalink / raw)
  To: user-mode-linux-devel


[-- Attachment #1.1: Type: text/plain, Size: 2495 bytes --]

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!
http://onecare.live.com/standard/en-us/purchase/trial.aspx?s_cid=wl_hotmailnews

[-- Attachment #1.2: Type: text/html, Size: 2731 bytes --]

[-- Attachment #2: Type: text/plain, Size: 314 bytes --]

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/

[-- Attachment #3: Type: text/plain, Size: 194 bytes --]

_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [uml-devel] accessing host resources from inside the UML kernel
  2007-10-13  4:56 [uml-devel] accessing host resources from inside the UML kernel Ahmad Sharif
@ 2007-10-17 16:07 ` Jeff Dike
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Dike @ 2007-10-17 16:07 UTC (permalink / raw)
  To: madiyaan; +Cc: user-mode-linux-devel

On Sat, Oct 13, 2007 at 04:56:39AM +0000, Ahmad Sharif wrote:
> 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've long advocated taking a more flexible view about sharing
resources between UML and the host.

> 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 you write a kernel module and stick it into UML, any system calls
that it makes will operate on the host, not UML.  This is the
difference between UML kernel mode and user mode - userspace has its
system calls intercepted and run inside UML, while kernelspace has its
system calls run on the host.

> 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. 

A module will automatically do what you want.

				Jeff

-- 
Work email - jdike at linux dot intel dot com

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-10-17 16:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-13  4:56 [uml-devel] accessing host resources from inside the UML kernel Ahmad Sharif
2007-10-17 16:07 ` Jeff Dike

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.