* [Qemu-devel] problems with mmap on qemu-arm
@ 2009-06-17 17:54 Kai Backman
2009-06-17 20:38 ` [Qemu-devel] " Kai Backman
0 siblings, 1 reply; 3+ messages in thread
From: Kai Backman @ 2009-06-17 17:54 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 769 bytes --]
I'm running qemu-arm and see the following output from mmap with 'strace
qemu-arm -strace' (for both host and traget strace output):
mmap(NULL, 32800, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0x2ad329b46000
4023 mmap(0,131072,7,34,-1,0) = 0xfffffff2
When my program later tries to read memory at 0xfffffffe it fails with a
SIGSEGV:
Program received signal SIGSEGV, Segmentation fault.
1: x/i $pc 0xce30: ldr r1, [r5]
(gdb) i r
r5 0xfffffffe -2
Why does qemu-arm return such high addresses on a 32 bit platform and why is
the memory inaccessible? If this doesn't seem like an obvious bug in my
code, where in the qemu code should I start looking for how mmap works?
Kai
--
Kai Backman, Software Engineer, kaib@google.com
[-- Attachment #2: Type: text/html, Size: 1476 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Qemu-devel] Re: problems with mmap on qemu-arm
2009-06-17 17:54 [Qemu-devel] problems with mmap on qemu-arm Kai Backman
@ 2009-06-17 20:38 ` Kai Backman
2009-06-18 18:55 ` Riku Voipio
0 siblings, 1 reply; 3+ messages in thread
From: Kai Backman @ 2009-06-17 20:38 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 1284 bytes --]
I tracked this down to the code in linux-user/syscall.c. The mmap code seems
broken, it assumes arg1 is a pointer to an array where the real arguments
are. Given arg1 = 0 the memory access check fails.
The code I'm working on will happily take mmap2 instead so I have a
workaround. Does someone have an opinion on the state of the mmap code?
Kai
On Wed, Jun 17, 2009 at 8:54 PM, Kai Backman <kaib@google.com> wrote:
> I'm running qemu-arm and see the following output from mmap with 'strace
> qemu-arm -strace' (for both host and traget strace output):
> mmap(NULL, 32800, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
> 0x2ad329b46000
> 4023 mmap(0,131072,7,34,-1,0) = 0xfffffff2
>
> When my program later tries to read memory at 0xfffffffe it fails with a
> SIGSEGV:
> Program received signal SIGSEGV, Segmentation fault.
> 1: x/i $pc 0xce30: ldr r1, [r5]
> (gdb) i r
> r5 0xfffffffe -2
>
> Why does qemu-arm return such high addresses on a 32 bit platform and why
> is the memory inaccessible? If this doesn't seem like an obvious bug in my
> code, where in the qemu code should I start looking for how mmap works?
>
> Kai
>
> --
> Kai Backman, Software Engineer, kaib@google.com
>
--
Kai Backman, Software Engineer, kaib@google.com
[-- Attachment #2: Type: text/html, Size: 2220 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] Re: problems with mmap on qemu-arm
2009-06-17 20:38 ` [Qemu-devel] " Kai Backman
@ 2009-06-18 18:55 ` Riku Voipio
0 siblings, 0 replies; 3+ messages in thread
From: Riku Voipio @ 2009-06-18 18:55 UTC (permalink / raw)
To: Kai Backman; +Cc: qemu-devel
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=UTF-8, Size: 1876 bytes --]
On Wed, Jun 17, 2009 at 11:38:32PM +0300, Kai Backman wrote:
> I tracked this down to the code in linux-user/syscall.c. The mmap code
> seems broken, it assumes arg1 is a pointer to an array where the real
> arguments are. Given arg1 = 0 the memory access check fails.
> The code I'm working on will happily take mmap2 instead so I have a
> workaround. Does someone have an opinion on the state of the mmap code?
> Kai
looking at old_mmap() for arm in kernel, qemu seems to the right thing. Ie
you are probably calling mmap the wrong way, you are supposed to give it a
array.
mmap syscall is depreceated, glibc uses mmap2 since forever.
> On Wed, Jun 17, 2009 at 8:54 PM, Kai Backman <[1]kaib@google.com> wrote:
>
> I'm running qemu-arm and see the following output from mmap with 'strace
> qemu-arm -strace' (for both host and traget strace output):
> mmap(NULL, 32800, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
> 0) = 0x2ad329b46000
> 4023 mmap(0,131072,7,34,-1,0) = 0xfffffff2
> When my program later tries to read memory at 0xfffffffe it fails with a
> SIGSEGV:
> Program received signal SIGSEGV, Segmentation fault.
> 1: x/i $pc 0xce30: ldr r1, [r5]
> (gdb) i r
> r5 0xfffffffe -2
> Why does qemu-arm return such high addresses on a 32 bit platform and
> why is the memory inaccessible? If this doesn't seem like an obvious bug
> in my code, where in the qemu code should I start looking for how mmap
> works?
> Kai
> --
> Kai Backman, Software Engineer, [2]kaib@google.com
>
> --
> Kai Backman, Software Engineer, [3]kaib@google.com
>
> References
>
> Visible links
> 1. mailto:kaib@google.com
> 2. mailto:kaib@google.com
> 3. mailto:kaib@google.com
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-06-18 18:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-17 17:54 [Qemu-devel] problems with mmap on qemu-arm Kai Backman
2009-06-17 20:38 ` [Qemu-devel] " Kai Backman
2009-06-18 18:55 ` Riku Voipio
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.