* [Qemu-devel] linux-user mremap()
@ 2008-09-26 18:24 Vince Weaver
2008-09-27 5:17 ` Kirill A. Shutemov
0 siblings, 1 reply; 3+ messages in thread
From: Vince Weaver @ 2008-09-26 18:24 UTC (permalink / raw)
To: qemu-devel
Until the linux-user mremap() problem is fixed (the one where a 64-bit
value can be returned even on a 32-bit target), might it make sense to
apply a patch like this?
This will at least let users know what the problem is, instead of just
segfaulting.
Vince
Index: mmap.c
===================================================================
--- mmap.c (revision 5321)
+++ mmap.c (working copy)
@@ -538,6 +538,13 @@
mmap_lock();
/* XXX: use 5 args syscall */
host_addr = (long)mremap(g2h(old_addr), old_size, new_size, flags);
+#if TARGET_ABI_BITS == 32
+ if (host_addr > 0xffffffff) {
+ printf("ERROR! mremap() returned 64-bit value on 32-bit target!\n\n");
+ exit(-1);
+ }
+#endif
+
if (host_addr == -1) {
new_addr = -1;
} else {
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] linux-user mremap()
2008-09-26 18:24 [Qemu-devel] linux-user mremap() Vince Weaver
@ 2008-09-27 5:17 ` Kirill A. Shutemov
2008-09-27 17:01 ` Vince Weaver
0 siblings, 1 reply; 3+ messages in thread
From: Kirill A. Shutemov @ 2008-09-27 5:17 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 1104 bytes --]
On Fri, Sep 26, 2008 at 02:24:43PM -0400, Vince Weaver wrote:
>
> Until the linux-user mremap() problem is fixed (the one where a 64-bit
> value can be returned even on a 32-bit target), might it make sense to
> apply a patch like this?
>
> This will at least let users know what the problem is, instead of just
> segfaulting.
>
> Vince
If host is x86_64, use MAP_32BIT.
>
>
>
>
> Index: mmap.c
> ===================================================================
> --- mmap.c (revision 5321)
> +++ mmap.c (working copy)
> @@ -538,6 +538,13 @@
> mmap_lock();
> /* XXX: use 5 args syscall */
> host_addr = (long)mremap(g2h(old_addr), old_size, new_size, flags);
> +#if TARGET_ABI_BITS == 32
> + if (host_addr > 0xffffffff) {
> + printf("ERROR! mremap() returned 64-bit value on 32-bit target!\n\n");
> + exit(-1);
> + }
> +#endif
> +
> if (host_addr == -1) {
> new_addr = -1;
> } else {
>
>
--
Regards, Kirill A. Shutemov
+ Belarus, Minsk
+ ALT Linux Team, http://www.altlinux.com/
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] linux-user mremap()
2008-09-27 5:17 ` Kirill A. Shutemov
@ 2008-09-27 17:01 ` Vince Weaver
0 siblings, 0 replies; 3+ messages in thread
From: Vince Weaver @ 2008-09-27 17:01 UTC (permalink / raw)
To: qemu-devel
> If host is x86_64, use MAP_32BIT.
I don't think that works for mremap(), hence the problem.
In any case, even if it does fix it for x86_64, simply crashing qemu with
a segfault on other architectures still isn't a good thing to do.
Vince
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-09-27 17:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-26 18:24 [Qemu-devel] linux-user mremap() Vince Weaver
2008-09-27 5:17 ` Kirill A. Shutemov
2008-09-27 17:01 ` Vince Weaver
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).