* [Qemu-devel] linux-user/mmap.c query
@ 2004-09-22 22:16 cb-qemu
2004-09-23 23:44 ` Paul Brook
0 siblings, 1 reply; 2+ messages in thread
From: cb-qemu @ 2004-09-22 22:16 UTC (permalink / raw)
To: qemu-devel
Hi Fabrice and everyone
I'm trying to use qemu-arm to run some statically linked linux binaries, and
I've come across an issue with the target_mmap function. The test at line 185:
if (offset & ~TARGET_PAGE_MASK)
return -EINVAL;
seems to be unnecessary as there is code to handle a non-aligned offset later
on in the function which is introduced by the comment
/* worst case: we cannot map the file because the offset is not
aligned, so we read it */
In addition, there seems to be an inconsistency in the way errors are reported
from target_mmap and what is expected by linux-user/elfload.c. target_mmap()
returns -EINVAL, but elfload.c expects errors to be reported with -1 and errno
to be set.
The following (totally minimal) patch enables me to run a few simple statically
linked ARM binaries. (This is just to make it clear the change I am talking
about).
Once this is addressed I run into problems with binaries which execute code
from writable pages - the code pages are marked non-writable by tb_link_phys()
but segfaults arising from writes are not handled. I haven't fully investigated
this problem yet. Is this supposed to work? I'll try and create a test case if
I don't make any progress on this.
BTW, is it possible to run qemu-arm under gdb and get breakpoints working? When
I try, gdb complains because the qemu binary is remapped somewhere else in the
addres space.
Regards
Charlie
--- linux-user/mmap.c 5 Jul 2004 21:25:16 -0000 1.7
+++ linux-user/mmap.c 22 Sep 2004 20:18:53 -0000
@@ -182,7 +182,7 @@
}
#endif
- if (offset & ~TARGET_PAGE_MASK)
+ if (offset & ~TARGET_PAGE_MASK && 0)
return -EINVAL;
len = TARGET_PAGE_ALIGN(len);
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] linux-user/mmap.c query
2004-09-22 22:16 [Qemu-devel] linux-user/mmap.c query cb-qemu
@ 2004-09-23 23:44 ` Paul Brook
0 siblings, 0 replies; 2+ messages in thread
From: Paul Brook @ 2004-09-23 23:44 UTC (permalink / raw)
To: qemu-devel
On Wednesday 22 September 2004 23:16, cb-qemu@fish.zetnet.co.uk wrote:
> BTW, is it possible to run qemu-arm under gdb and get breakpoints working?
> When I try, gdb complains because the qemu binary is remapped somewhere
> else in the addres space.
Configure with --static.
> --- linux-user/mmap.c 5 Jul 2004 21:25:16 -0000 1.7
> +++ linux-user/mmap.c 22 Sep 2004 20:18:53 -0000
> @@ -182,7 +182,7 @@
> }
> #endif
>
> - if (offset & ~TARGET_PAGE_MASK)
> + if (offset & ~TARGET_PAGE_MASK && 0)
> return -EINVAL;
>
> len = TARGET_PAGE_ALIGN(len);
Isn't this just papering over the problem? What about the other places in that
function which return -EINVAL?
Also the later code handles host misalignment, whereas this test if for target
misalignment.
Paul
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-09-23 23:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-22 22:16 [Qemu-devel] linux-user/mmap.c query cb-qemu
2004-09-23 23:44 ` Paul Brook
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).