qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paul Brook <paul@codesourcery.com>
To: qemu-devel@nongnu.org
Cc: TJ <linux@tjworld.net>
Subject: Re: [Qemu-devel] RFC: x86_64 Best way to fix 'cast to pointer from integer of different size' problems?
Date: Sat, 3 Nov 2007 18:52:18 +0100	[thread overview]
Message-ID: <200711031752.20135.paul@codesourcery.com> (raw)
In-Reply-To: <1194110810.13889.25.camel@hephaestion>

On Saturday 03 November 2007, TJ wrote:
> I'm building on x86_64 GNU/Linux. There are *lots* of (1053) compiler
> warnings of the class:
>
> warning: cast to pointer from integer of different size

There are at due to the recent EFAULT/access_ok changes. There should be (and 
used to be) a clear separation between host and target addresses. The EFAULT 
changes have broken this. Before these ghanges it wa trivial to remap the 
target address space (e.g. place it at a high address on a 64-bit host), or 
even enabling softmmu. I'm fairly sure that wouldn't work if you tried it 
now.

> Fixing it looks to require a variety of fixes, from simple explicit
> casts in-line, to some complicated review of multiple levels of macros
> to decide where best to apply a fix.

Adding a cast is never the right thing to do. There should *always* be a clear 
distinction and explicit conversion between host pointers and target 
addresses. It is never safe to cast from one to the other.

I put quite a lot of effort into getting this separation right when I 
implemented the lock_user interfaces. It was fairly trivial to implement 
address space translation (even softmmu) using this inerface. I'm quite 
annoyed that we seem to have regresses so badly in this area. AFAICS the 
whole of syscalls.c needs re-auditing to figure out which values are host 
pointers and which are target addresses.

We should have either lock_user or {get,put}_user, not both.

Paul

  reply	other threads:[~2007-11-03 17:52 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-03 17:26 [Qemu-devel] RFC: x86_64 Best way to fix 'cast to pointer from integer of different size' problems? TJ
2007-11-03 17:52 ` Paul Brook [this message]
2007-11-05 19:51   ` Thayne Harbaugh
2007-11-06  1:05     ` Paul Brook
2007-11-06  2:00       ` Thayne Harbaugh
2007-11-07 19:18         ` Fabrice Bellard
2007-11-07 20:59           ` Thayne Harbaugh
2007-11-07 23:02           ` Paul Brook
2007-11-12 16:42           ` Thayne Harbaugh
2007-11-06 20:05       ` Fabrice Bellard
2007-11-06 21:52         ` Stuart Anderson
2007-11-06 22:05           ` Paul Brook
2007-11-06 22:19             ` 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=200711031752.20135.paul@codesourcery.com \
    --to=paul@codesourcery.com \
    --cc=linux@tjworld.net \
    --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).