qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] qemu-user: relocating target code weakness


From: Mike Frysinger
Subject: Re: [Qemu-devel] qemu-user: relocating target code weakness
Date: Mon, 24 Jan 2011 15:00:10 -0500

On Mon, Jan 24, 2011 at 13:16, Stefano Bonifazi wrote:
>> Start address in which address the ELF code section, in reality (not
>> under qemu-user) should be mapped. in x86 32 bit it's 08048000, you
>> can check it by yourself by executing:
>> cat /proc/self/maps
>
> Wait, like that I don't understand anything more.. As far as I understood
> when calling mmap from within a process, its result, when no error happen,
> would be the virtual address where the mapping starts.. so if I get
> 0x10000000 from mmap why should it be 08048000 instead??

he is telling you what ELF_START_MMAP is all about.  it is the base
address that the linux kernel for that architecture will start giving
out addresses.  so when running Linux on an x86 system, the first
mmap() a process does will start at 0x80000000 and move up.

although looking at the elfload code quickly, it doesnt seem that this
is really used anymore.  so it probably can be ignored.

> Inside load_elf_binary the call to mmap has elf_ppnt->p_vaddr as required
> starting address (plus alignment) and MAP_FIXED flag.

review the mmap() man page ... MAP_FIXED is always a *suggestion* and
never a requirement.  the app must check the return value to see what
the kernel actually gave it.
-mike



reply via email to

[Prev in Thread] Current Thread [Next in Thread]