[vbox-dev] Problems memory mapping files with shared folders on Linux guests.

Klaus Espenlaub klaus.espenlaub at oracle.com
Wed Apr 3 09:15:33 PDT 2013


Hi,

On 31.03.2013 12:57, Arya Vas Dev wrote:
> Hi people,
>
> I hope this is the correct place to post. I was told to post here by a
> forum moderator for the VirtualBox Linux Guests forum.

It is.

> This is one of my first posts, so I also hope this post is appropriate
> and not an already known issue.
>
> I am running VirtualBox 4.2.10 on a Windows 7 Home Premium x64 Guest. I
> am running the latest version of the guest add-ins.
>
> I am finding with my Ubuntu 11.10 i386 guest that 2 system calls fail
> with files on shared folders. Specifically the calls are:
>
> mmap (90) and mmap(192).
>
> Both calls return error code "EINTVAL" (-12 if I recall correctly).
>
> Everything under gdb, edb (another Linux debugger) and systrace looks right.
>
> Using the same code on the same files, in a directory local to the Linux
> installation, things work.
>
> Is it possible this is happening because the file are trying to be
> mapped including write access (PROT_READ+PROT_WRITE)?

https://www.virtualbox.org/browser/vbox/trunk/src/VBox/Additions/linux/sharedfolders/regops.c#L551 
clearly rejects any attempts of mapping with flag VM_SHARED, however as 
the shared folder implementation is far enough away from the system call 
interface I couldn't immediately tell the relationship to the syscall 
parameters. I guess PROT_WRITE translates to VM_SHARED.

Either way, write mapping is very hard to implement. Remember, there's 
(at least one) totally separate OS, the host, which might also have the 
same file mapped. Then VirtualBox would be suddenly responsible for 
keeping cross-OS mappings consistent. We don't even try to go there.

> If this is the case, will there ever be support for writable mem-mapped
> files on shared folders in Linux guests?

We have no plans currently to make this happen, because what you're 
looking at is only a tiny subset of the entire problem.

What should happen if there are several VMs with access to the same 
files through shared folders?

If you have good ideas how to get this resolved, please do let us know.

Klaus

> Thank you,
> AVD.79



More information about the vbox-dev mailing list