qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paul Brook <paul@codesourcery.com>
To: qemu-devel@nongnu.org
Cc: Stuart Anderson <anderson@netsweng.com>
Subject: Re: [Qemu-devel] RFC: [0/11] EFAULT patch
Date: Wed, 19 Sep 2007 16:22:38 +0100	[thread overview]
Message-ID: <200709191622.39315.paul@codesourcery.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0709190725590.20150@trantor.stuart.netsweng.com>

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	other threads:[~2007-09-19 15:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-19  0:59 [Qemu-devel] RFC: [0/11] EFAULT patch Stuart Anderson
2007-09-19  2:05 ` J. Mayer
2007-09-19 11:30   ` Stuart Anderson
2007-09-19 15:22     ` Paul Brook [this message]
2007-09-19 19:00   ` Stuart Anderson
2007-09-19 19:26     ` J. Mayer
2007-09-19 20:00     ` Paul Brook
2007-09-19 20:44       ` Stuart Anderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200709191622.39315.paul@codesourcery.com \
    --to=paul@codesourcery.com \
    --cc=anderson@netsweng.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).