qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] RFC: [0/11] EFAULT patch


From: Paul Brook
Subject: Re: [Qemu-devel] RFC: [0/11] EFAULT patch
Date: Wed, 19 Sep 2007 16:22:38 +0100
User-agent: KMail/1.9.7

On Wednesday 19 September 2007, Stuart Anderson wrote:
> On Wed, 19 Sep 2007, J. Mayer wrote:
> > The idea is great but there seem to be a problem in those patches:
> > you directly cast syscall arguments, which are (or should be)
> > target_ulong to pointers in the host environment. You should to use the
> > g2h / h2g macros to get the pointer in the host memory from the offset
> > in the target address space.
>
> I was explicitly told to _not_ use these in this code.

g2h and h2g assume a single linear mapping from host to guest address space. 
They are internal implementation details of the lock/copy routines, and 
should not be used elsewhere.


> > This used to be handled by the lock_user functions and should be handled
> > in your patch too...
>
> It was handled by g2h() which was just a typecast hidden behind the
> macro.

It also does linear address offsetting.

Having the macro is important. It means that the translation from guest to 
host address space happens in precisely one place. The current code has been 
fairly carefully audited to make sure everything[1] uses that one definition. 

Please don't break this property. When we do change to a differnt mapping 
system (eg. enabling softmmu) it's trivial to prove that we've made all the 
changes necessary.

Paul

[1] Except some of the mmap code, which would need rewriting anyway.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]