From: Thayne Harbaugh <thayne@c2.net>
To: qemu-devel@nongnu.org
Cc: paul@codesourcery.com
Subject: Re: [Qemu-devel] RFC: x86_64 Best way to fix 'cast to pointer from integer of different size' problems?
Date: Wed, 07 Nov 2007 13:59:07 -0700 [thread overview]
Message-ID: <1194469147.5154.230.camel@phantasm.home.enterpriseandprosperity.com> (raw)
In-Reply-To: <47320F6E.5060505@bellard.org>
On Wed, 2007-11-07 at 20:18 +0100, Fabrice Bellard wrote:
> Hi,
>
> Regarding the user memory access, here is my suggestion which should
> minimize the changes:
The virtue of making the minimum changes is that there are likely fewer
errors. Other than that, it's more important to me to make the
*changes*.
> - Keep __put_user() and __get_user() as you did.
good.
> - Remove put_user(), get_user(), copy_from_user() and copy_to_user()
I'd prefer to keep put_user(), get_user(), copy_from_user() and
copy_to_user() and have them internally perform
lock_user()/unlock_user(). I like how lock_user()/unlock_user()
minimizes copying - I think that's good. I also like keeping functions
that work in similar ways as the kernel counterparts - this is important
for maintaining functions that emulate kernel behavior so that code is
more comparable to the kernel. This is also very near the way my
current patches are written and is the minimum work for me.
> - Modify the signal.c code so that it uses __put_user, __get_user and
> lock/unlock_user.
good.
> - Modify lock_user() so that it automatically does access_ok() and
> returns NULL if access_ok() fails.
Yes - this is good. This is something that I missed with my first set
of patches and it's significant.
> - Test lock_user/lock_user_struct/... return value explicitely at every
> call.
yep.
> - Fix page_check_range() so that it handles writes to pages containing
> code by calling page_unprotect when necessary (the current code can fail
> in this case !).
Good.
> - Suppress no longer needed page_unprotect_range() call in syscall.c.
sure.
> - Suppress or fix tput/tget macros so that they do access_ok().
I think it's better to use get_user()/put_user() for these which would
handle assigning to different sized types and with proper sign-extension
when the target and host aren't the same sized word.
next prev parent reply other threads:[~2007-11-07 21:11 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
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 [this message]
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=1194469147.5154.230.camel@phantasm.home.enterpriseandprosperity.com \
--to=thayne@c2.net \
--cc=paul@codesourcery.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).