From: "Jan-Simon Möller" <dl9pf@gmx.de>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [Patch] linux-user/syscall.c - don't add GUEST_BASE to NULL pointer
Date: Fri, 28 Aug 2009 15:20:59 +0200 [thread overview]
Message-ID: <200908281520.59454.dl9pf@gmx.de> (raw)
In-Reply-To: <20090826134043.GB7862@kos.to>
Am Mittwoch 26 August 2009 15:40:43 schrieb Riku Voipio:
> On Wed, Aug 26, 2009 at 01:37:48AM +0200, Jan-Simon Möller wrote:
> > Thinking a bit more about this, I wonder if g2h(x) shouldn't itself
> > always return NULL on x = NULL ?
>
> I agree this seems like a a better idea than modifying the users of g2h.
>
> > Something like:
> >
> > Signed-off-by: Jan-Simon Möller <dl9pf@gmx.de>
> >
> > diff --git a/cpu-all.h b/cpu-all.h
> > index 1a6a812..631f678 100644
> > --- a/cpu-all.h
> > +++ b/cpu-all.h
> > @@ -633,7 +633,7 @@ extern int have_guest_base;
> > #endif
> >
> > /* All direct uses of g2h and h2g need to go away for usermode softmmu.
> > */ -#define g2h(x) ((void *)((unsigned long)(x) + GUEST_BASE))
> > +#define g2h(x) ( !x ? NULL:((void *)((unsigned long)(x) + GUEST_BASE)))
> > #define h2g(x) ({ \
> > unsigned long __ret = (unsigned long)(x) - GUEST_BASE; \
> > /* Check if given address fits target address space */ \
> >
> >
Take the first patch for syscall.c / mount .
Unfortunately, the above one has side-effects where functions rely on a
shifted NULL pointer ...
Best,
Jan-Simon
prev parent reply other threads:[~2009-08-28 13:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-25 22:02 [Qemu-devel] [Patch] linux-user/syscall.c - don't add GUEST_BASE to NULL pointer Jan-Simon Möller
2009-08-25 23:37 ` Jan-Simon Möller
2009-08-26 13:40 ` Riku Voipio
2009-08-26 19:58 ` Jan-Simon Möller
2009-08-28 13:20 ` Jan-Simon Möller [this message]
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=200908281520.59454.dl9pf@gmx.de \
--to=dl9pf@gmx.de \
--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 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.