HomePhabricator

Fix invalid memory access on android x86

Description

Fix invalid memory access on android x86

On certain versions of android x86, the main module app_process is not
built as PIE. When accessing the PT_GNU_EH_FRAME_HDR in such a
scenario, the dlpi_addr is 0, but the virtual address is not
relocated. Manually rebase the address to avoid an invalid memory
access.

Details

Committed
compnerdApr 5 2017, 11:33 AM
Parents
rL299574: clang-format: Support formatting utf-8 character literals in C++11+ mode.
Branches
Unknown
Tags
Unknown

Event Timeline

krasin added a subscriber: krasin.Apr 6 2017, 10:34 AM

FYI: this breaks some bots, like http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/1239

In file included from /mnt/b/sanitizer-buildbot1/sanitizer-x86_64-linux/build/llvm/projects/libunwind/src/libunwind.cpp:27:
/mnt/b/sanitizer-buildbot1/sanitizer-x86_64-linux/build/llvm/projects/libunwind/src/AddressSpace.hpp:387:28: error: unused typedef 'Elf_Addr' [-Werror,-Wunused-local-typedef]
        typedef ElfW(Addr) Elf_Addr;
                           ^
[ 13%] Building C object projects/libunwind/src/CMakeFiles/unwind_objects.dir/UnwindRegistersRestore.S.o
1 error generated.
make[2]: *** [projects/libunwind/src/CMakeFiles/unwind_objects.dir/libunwind.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
[ 13%] Building CXX object projects/libcxx/lib/CMakeFiles/cxx_objects.dir/__/src/chrono.cpp.o
make[1]: *** [projects/libunwind/src/CMakeFiles/unwind_objects.dir/all] Error 2

I am preparing a fix that only makes this typedef under Android.