]> git.proxmox.com Git - qemu.git/commit
linux-user: Handle images where lowest vaddr is not page aligned
authorPeter Maydell <peter.maydell@linaro.org>
Tue, 17 May 2011 12:34:46 +0000 (13:34 +0100)
committerRiku Voipio <riku.voipio@iki.fi>
Tue, 21 Jun 2011 17:29:01 +0000 (20:29 +0300)
commitf3ed1f5d476bfc18c4b2e27bf2386f54c98561f1
treeeb151b997291f5556886d44d0693d18465407449
parentb947527941b17c8f4a31f95dfa114e467ba1325d
linux-user: Handle images where lowest vaddr is not page aligned

Fix a bug in the linux-user ELF loader code where it was not correctly
handling images where the lowest vaddr to be loaded was not page aligned.
The problem was that the code to probe for a suitable guest base address
was changing the 'loaddr' variable (by rounding it to a page boundary),
which meant that the load bias would then be incorrectly calculated
unless loaddr happened to already be page-aligned.

Binaries generated by gcc with the default linker script do start with
a loadable segment at a page-aligned vaddr, so were unaffected. This
bug was noticed with a binary created by the Google Go toolchain for ARM.

We fix the bug by refactoring the "probe for guest base" code out into
its own self-contained function.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
linux-user/elfload.c