On the Galaxy Nexus (an OMAP chipset) you receive a segfault right at startup on all processes. It appears not be able to read the ELF data after _start. Reproducible: Always Here is valgring with -v -v -d -d. /data/local/Inst/bin/valgrind -v -v -d -d ls --9213:1:debuglog DebugLog system started by Stage 1, level 2 logging requested --9213:1:launcher no tool requested, defaulting to 'memcheck' --9213:2:launcher selecting platform for 'ls' --9213:2:launcher selecting platform for '/system/bin/ls' --9213:2:launcher opened '/system/bin/ls' --9213:2:launcher read 4096 bytes from '/system/bin/ls' --9213:2:launcher selected platform 'arm-linux' --9213:1:launcher selected platform 'arm-linux' --9213:1:launcher launching /data/local/Inst/lib/valgrind/memcheck-arm-linux --9213:1:debuglog DebugLog system started by Stage 2 (main), level 2 logging requested --9213:1:main Welcome to Valgrind version 3.8.0.SVN debug logging --9213:1:main Checking current stack is plausible --9213:1:main Checking initial stack was noted --9213:1:main Starting the address space manager --9213:2:aspacem sp_at_startup = 0x00bee3cb50 (supplied) --9213:2:aspacem minAddr = 0x0004000000 (computed) --9213:2:aspacem maxAddr = 0x00bee3bfff (computed) --9213:2:aspacem cStart = 0x0004000000 (computed) --9213:2:aspacem vStart = 0x006171e000 (computed) --9213:2:aspacem suggested_clstack_top = 0x00bde3cfff (computed) --9213:2:aspacem <<< SHOW_SEGMENTS: Initial layout (5 segments, 0 segnames) --9213:2:aspacem 0: RSVN 0000000000-0003ffffff 64m ----- SmFixed --9213:2:aspacem 1: 0004000000-006171dfff 1495m --9213:2:aspacem 2: RSVN 006171e000-006171efff 4096 ----- SmFixed --9213:2:aspacem 3: 006171f000-00bee3bfff 1495m --9213:2:aspacem 4: RSVN 00bee3c000-00ffffffff 1041m ----- SmFixed --9213:2:aspacem >>> --9213:2:aspacem Reading /proc/self/maps --9213:2:aspacem <<< SHOW_SEGMENTS: With contents of /proc/self/maps (12 segments, 1 segnames) --9213:2:aspacem ( 0) /data/local/Inst/lib/valgrind/memcheck-arm-linux --9213:2:aspacem 0: RSVN 0000000000-0003ffffff 64m ----- SmFixed --9213:2:aspacem 1: 0004000000-0037ffffff 832m --9213:2:aspacem 2: FILE 0038000000-0038330fff 3346432 r-x-- d=0x10304 i=667991 o=4096 (0) --9213:2:aspacem 3: FILE 0038331000-0038334fff 16384 rw--- d=0x10304 i=667991 o=3350528 (0) --9213:2:aspacem 4: ANON 0038335000-0038e06fff 10m rw--- --9213:2:aspacem 5: 0038e07000-006171dfff 649m --9213:2:aspacem 6: RSVN 006171e000-006171efff 4096 ----- SmFixed --9213:2:aspacem 7: 006171f000-00bee1bfff 1494m --9213:2:aspacem 8: ANON 00bee1c000-00bee3cfff 135168 rw--- --9213:2:aspacem 9: RSVN 00bee3d000-00fffeffff 1041m ----- SmFixed --9213:2:aspacem 10: anon 00ffff0000-00ffff0fff 4096 r-x-- --9213:2:aspacem 11: RSVN 00ffff1000-00ffffffff 61440 ----- SmFixed --9213:2:aspacem >>> --9213:1:main Address space manager is running --9213:1:main Starting the dynamic memory manager --9213:1:mallocfr newSuperblock at 0x6171F000 (pszB 4194288) owner VALGRIND/tool --9213:1:mallocfr deferred_reclaimSuperblock at 0x6171F000 (pszB 4194288) (prev 0x0) owner VALGRIND/tool --9213:1:main Dynamic memory manager is running --9213:1:main Initialise m_debuginfo --9213:1:main VG_(libdir) = /data/local/Inst/lib/valgrind --9213:1:main Getting launcher's name ... --9213:1:main ... /data/local/Inst/bin/valgrind --9213:1:main Get hardware capabilities ... --9213:1:machine ARMv7 VFP 1 VFP2 1 VFP3 1 NEON 1 --9213:1:main ... arch = ARM, hwcaps = ARMv7-vfp-neon --9213:1:main Getting the working directory at startup --9213:1:main ... / --9213:1:main Split up command line --9213:1:main (early_) Process Valgrind's command line options --9213:1:main Create initial image --9213:1:initimg Loading client --9213:1:initimg Setup client env --9213:2:initimg preload_string: --9213:2:initimg "/data/local/Inst/lib/valgrind/vgpreload_core-arm-linux.so:/data/local/Inst/lib/valgrind/vgpreload_memcheck-arm-linux.so" --9213:1:initimg Setup client stack: size will be 8388608 --9213:2:initimg ARM has-neon from-auxv: YES --9213:2:initimg ARM has-tls from-auxv: YES --9213:2:initimg Client info: initial_IP=0x40036E0 initial_TOC=0x0 brk_base=0x128000 --9213:2:initimg Client info: initial_SP=0xBDE3CB60 max_stack_size=8388608 --9213:1:initimg Setup client data (brk) segment --9213:1:main Setup file descriptors --9213:1:main Create fake /proc/<pid>/cmdline --9213:1:main Initialise the tool part 1 (pre_clo_init) --9213:1:mallocfr deferred_reclaimSuperblock NULL (prev 0x6171F000) owner VALGRIND/tool --9213:1:mallocfr newSuperblock at 0x61B1F000 (pszB 1048560) owner VALGRIND/exectxt --9213:1:main Print help and quit, if requested --9213:1:main (main_) Process Valgrind's command line options, setup logging --9213:1:mallocfr newSuperblock at 0x61C1F000 (pszB 1048560) owner VALGRIND/core --9213:1:main Print the preamble... ==9213== Memcheck, a memory error detector ==9213== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al. ==9213== Using Valgrind-3.8.0.SVN and LibVEX; rerun with -h for copyright info ==9213== Command: ls ==9213== --9213-- Valgrind options: --9213-- -v --9213-- -v --9213-- -d --9213-- -d --9213-- Contents of /proc/version: --9213-- Linux version 3.0.31-g9c526da (zbowling@Zacs-MacBook-Pro.local) (gcc version 4.4.3 (GCC) ) #5 SMP PREEMPT Sun Jul 15 00:56:21 PDT 2012 --9213-- Arch and hwcaps: ARM, ARMv7-vfp-neon --9213-- Page sizes: currently 4096, max supported 4096 --9213-- Valgrind library directory: /data/local/Inst/lib/valgrind --9213:1:main ...finished the preamble --9213:1:main Initialise the tool part 2 (post_clo_init) --9213:1:main Initialise TT/TC --9213-- TT/TC: VG_(init_tt_tc) (startup of code management) --9213-- TT/TC: cache: 8 sectors of 27597024 bytes each = 220776192 total --9213-- TT/TC: table: 524168 total entries, max occupancy 340704 (65%) --9213:2:transtab cache: 8 sectors of 27597024 bytes each = 220776192 total --9213:2:transtab table: 524168 total entries, max occupancy 340704 (65%) --9213:1:main Initialise redirects --9213:1:mallocfr newSuperblock at 0x61D9A000 (pszB 1048560) owner VALGRIND/dinfo --9213:1:main Load initial debug info --9213-- Reading syms from /system/bin/toolbox --9213-- svma 0x0000004050, avma 0x000010c050 --9213-- Considering /system/bin/toolbox .. --9213-- .. CRC mismatch (computed 510abd5b wanted 59695f18) --9213-- Using debuginfo from /sdcard/symbols/system/bin/toolbox --9213-- Reading syms from /system/bin/linker --9213-- svma 0x00000036e0, avma 0x00040036e0 --9213-- Considering /system/bin/linker .. --9213-- .. CRC mismatch (computed 939136ba wanted f8765ce7) --9213-- Using debuginfo from /sdcard/symbols/system/bin/linker --9213-- Reading syms from /data/local/Inst/lib/valgrind/memcheck-arm-linux --9213-- svma 0x0038000000, avma 0x0038000000 --9213-- object doesn't have a dynamic symbol table --9213:1:mallocfr newSuperblock at 0x6275F000 (pszB 1048560) owner VALGRIND/dinfo --9213:1:mallocfr newSuperblock at 0x6285F000 (pszB 1048560) owner VALGRIND/dinfo --9213:1:mallocfr newSuperblock at 0x6295F000 (pszB 1048560) owner VALGRIND/dinfo --9213:1:mallocfr newSuperblock at 0x62A5F000 (pszB 2052080) unsplittable owner VALGRIND/dinfo --9213:1:mallocfr deferred_reclaimSuperblock at 0x6295F000 (pszB 1048560) (prev 0x0) owner VALGRIND/dinfo --9213:1:mallocfr deferred_reclaimSuperblock NULL (prev 0x6295F000) owner VALGRIND/dinfo --9213:1:mallocfr reclaimSuperblock at 0x6295F000 (pszB 1048560) owner VALGRIND/dinfo --9213:1:mallocfr newSuperblock at 0x62C54000 (pszB 4100080) unsplittable owner VALGRIND/dinfo --9213:1:mallocfr reclaimSuperblock at 0x62A5F000 (pszB 2052080) unsplittable owner VALGRIND/dinfo --9213:1:mallocfr newSuperblock at 0x61E9A000 (pszB 3178480) unsplittable owner VALGRIND/dinfo --9213:1:mallocfr reclaimSuperblock at 0x62C54000 (pszB 4100080) unsplittable owner VALGRIND/dinfo --9213:1:redir transfer ownership V -> C of 0x38055000 .. 0x38055fff --9213:1:main Initialise scheduler (phase 1) --9213:1:sched sched_init_phase1 --9213-- Scheduler: using generic scheduler lock implementation. --9213:1:main Tell tool about initial permissions --9213:2:main tell tool about 0000108000-000011ffff r-x --9213:2:main tell tool about 0000120000-0000122fff rw- --9213:2:main tell tool about 0000123000-0000127fff rw- --9213:2:main tell tool about 0004000000-0004012fff r-x --9213:2:main tell tool about 0004013000-0004014fff rw- --9213:2:main tell tool about 0004015000-0004020fff rw- --9213:2:main tell tool about 0004021000-0004021fff rwx --9213:2:main tell tool about 0038055000-0038055fff r-x --9213:2:main tell tool about 00bde3c000-00bde3cfff rwx --9213:2:main tell tool about 00ffff0000-00ffff0fff r-x --9213:2:main mark stack inaccessible 00bde3c000-00bde3cb5f --9213:1:main Initialise scheduler (phase 2) --9213:1:sched sched_init_phase2: tid_main=1, cls_end=0xbde3cfff, cls_sz=8388608 --9213:1:main Finalise initial image --9213:1:main Initialise signal management --9213:1:main Load suppressions --9213-- Reading suppressions file: /data/local/Inst/lib/valgrind/default.supp --9213:2:stacks register 0xBDE3C000-0xBDE3CFFF as stack 0 --9213:1:main --9213:1:main --9213:1:aspacem <<< SHOW_SEGMENTS: Memory layout at client startup (29 segments, 4 segnames) --9213:1:aspacem ( 0) /data/local/Inst/lib/valgrind/memcheck-arm-linux --9213:1:aspacem ( 1) /system/bin/toolbox --9213:1:aspacem ( 2) /system/bin/linker --9213:1:aspacem 0: RSVN 0000000000-0000107fff 1081344 ----- SmFixed --9213:1:aspacem 1: file 0000108000-000011ffff 98304 r-x-- d=0x10302 i=232 o=0 (1) --9213:1:aspacem 2: file 0000120000-0000122fff 12288 rw--- d=0x10302 i=232 o=94208 (1) --9213:1:aspacem 3: anon 0000123000-0000127fff 20480 rw--- --9213:1:aspacem 4: RSVN 0000128000-0003ffffff 62m ----- SmFixed --9213:1:aspacem 5: file 0004000000-0004012fff 77824 r-x-- d=0x10302 i=149 o=0 (2) --9213:1:aspacem 6: file 0004013000-0004014fff 8192 rw--- d=0x10302 i=149 o=73728 (2) --9213:1:aspacem 7: anon 0004015000-0004020fff 49152 rw--- --9213:1:aspacem 8: anon 0004021000-0004021fff 4096 rwx-- --9213:1:aspacem 9: RSVN 0004022000-0004820fff 8384512 ----- SmLower --9213:1:aspacem 10: 0004821000-0037ffffff 823m --9213:1:aspacem 11: FILE 0038000000-0038054fff 348160 r-x-- d=0x10304 i=667991 o=4096 (0) --9213:1:aspacem 12: file 0038055000-0038055fff 4096 r-x-- d=0x10304 i=667991 o=352256 (0) --9213:1:aspacem 13: FILE 0038056000-0038330fff 2994176 r-x-- d=0x10304 i=667991 o=356352 (0) --9213:1:aspacem 14: FILE 0038331000-0038334fff 16384 rw--- d=0x10304 i=667991 o=3350528 (0) --9213:1:aspacem 15: ANON 0038335000-0038e06fff 10m rw--- --9213:1:aspacem 16: 0038e07000-006171dfff 649m --9213:1:aspacem 17: RSVN 006171e000-006171efff 4096 ----- SmFixed --9213:1:aspacem 18: ANON 006171f000-00621bdfff 10m rwx-- --9213:1:aspacem 19: 00621be000-006275efff 5902336 --9213:1:aspacem 20: ANON 006275f000-006295efff 2097152 rwx-- --9213:1:aspacem 21: 006295f000-00bd63cfff 1452m --9213:1:aspacem 22: RSVN 00bd63d000-00bde3bfff 8384512 ----- SmUpper --9213:1:aspacem 23: anon 00bde3c000-00bde3cfff 4096 rwx-- --9213:1:aspacem 24: 00bde3d000-00bee1bfff 15m --9213:1:aspacem 25: ANON 00bee1c000-00bee3cfff 135168 rw--- --9213:1:aspacem 26: RSVN 00bee3d000-00fffeffff 1041m ----- SmFixed --9213:1:aspacem 27: anon 00ffff0000-00ffff0fff 4096 r-x-- --9213:1:aspacem 28: RSVN 00ffff1000-00ffffffff 61440 ----- SmFixed --9213:1:aspacem >>> --9213:1:main --9213:1:main --9213:1:main Running thread 1 --9213:1:syswrap- entering VG_(main_thread_wrapper_NORETURN) --9213:1:aspacem allocated thread stack at 0x621be000 size 1064960 --9213:1:syswrap- run_a_thread_NORETURN(tid=1): pre-thread_wrapper --9213:1:syswrap- thread_wrapper(tid=1): entry --9213:1:transtab allocate sector 0 --9213:1:mallocfr newSuperblock at 0x622C2000 (pszB 65520) owner VALGRIND/ttaux --9213-- TT/TC: initialise sector 0 --9213:1:mallocfr newSuperblock at 0x622D2000 (pszB 65520) owner VALGRIND/errors ==9213== Invalid read of size 4 --9213:1:mallocfr newSuperblock at 0x622E2000 (pszB 65520) owner VALGRIND/demangle --9213:1:mallocfr deferred_reclaimSuperblock at 0x622E2000 (pszB 65520) (prev 0x0) owner VALGRIND/demangle ==9213== at 0x4005180: __dl___linker_init (linker.c:2265) ==9213== by 0x40036EB: _start (begin.S:37) ==9213== Address 0x1c is not stack'd, malloc'd or (recently) free'd ==9213== --9213:1:gdbsrv VG core calling VG_(gdbserver_report_signal) vki_nr 11 SIGSEGV gdb_nr 11 SIGSEGV tid 1 --9213:1:gdbsrv not connected => pass ==9213== ==9213== Process terminating with default action of signal 11 (SIGSEGV) ==9213== Access not within mapped region at address 0x1C --9213:1:mallocfr deferred_reclaimSuperblock at 0x622E2000 (pszB 65520) (prev 0x622E2000) owner VALGRIND/demangle ==9213== at 0x4005180: __dl___linker_init (linker.c:2265) ==9213== by 0x40036EB: _start (begin.S:37) ==9213== If you believe this happened as a result of a stack ==9213== overflow in your program's main thread (unlikely but ==9213== possible), you can try to increase the size of the ==9213== main thread stack using the --main-stacksize= flag. ==9213== The main thread stack size used in this run was 8388608. --9213:1:syswrap- thread_wrapper(tid=1): exit --9213:1:syswrap- run_a_thread_NORETURN(tid=1): post-thread_wrapper --9213:1:syswrap- run_a_thread_NORETURN(tid=1): last one standing --9213:1:main entering VG_(shutdown_actions_NORETURN) --9213:1:aspacem <<< SHOW_SEGMENTS: Memory layout at client shutdown (33 segments, 4 segnames) --9213:1:aspacem ( 0) /data/local/Inst/lib/valgrind/memcheck-arm-linux --9213:1:aspacem ( 1) /system/bin/toolbox --9213:1:aspacem ( 2) /system/bin/linker --9213:1:aspacem 0: RSVN 0000000000-0000107fff 1081344 ----- SmFixed --9213:1:aspacem 1: file 0000108000-000011ffff 98304 r-x-- d=0x10302 i=232 o=0 (1) --9213:1:aspacem 2: file 0000120000-0000122fff 12288 rw--- d=0x10302 i=232 o=94208 (1) --9213:1:aspacem 3: anon 0000123000-0000127fff 20480 rw--- --9213:1:aspacem 4: RSVN 0000128000-0003ffffff 62m ----- SmFixed --9213:1:aspacem 5: file 0004000000-0004012fff 77824 r-xT- d=0x10302 i=149 o=0 (2) --9213:1:aspacem 6: file 0004013000-0004014fff 8192 rw--- d=0x10302 i=149 o=73728 (2) --9213:1:aspacem 7: anon 0004015000-0004020fff 49152 rw--- --9213:1:aspacem 8: anon 0004021000-0004021fff 4096 rwx-- --9213:1:aspacem 9: RSVN 0004022000-0004820fff 8384512 ----- SmLower --9213:1:aspacem 10: 0004821000-0037ffffff 823m --9213:1:aspacem 11: FILE 0038000000-0038054fff 348160 r-x-- d=0x10304 i=667991 o=4096 (0) --9213:1:aspacem 12: file 0038055000-0038055fff 4096 r-x-- d=0x10304 i=667991 o=352256 (0) --9213:1:aspacem 13: FILE 0038056000-0038330fff 2994176 r-x-- d=0x10304 i=667991 o=356352 (0) --9213:1:aspacem 14: FILE 0038331000-0038334fff 16384 rw--- d=0x10304 i=667991 o=3350528 (0) --9213:1:aspacem 15: ANON 0038335000-0038e06fff 10m rw--- --9213:1:aspacem 16: 0038e07000-006171dfff 649m --9213:1:aspacem 17: RSVN 006171e000-006171efff 4096 ----- SmFixed --9213:1:aspacem 18: ANON 006171f000-00621bdfff 10m rwx-- --9213:1:aspacem 19: ANON 00621be000-00621bffff 8192 ----- --9213:1:aspacem 20: ANON 00621c0000-00622bffff 1048576 rwx-- --9213:1:aspacem 21: ANON 00622c0000-00622c1fff 8192 ----- --9213:1:aspacem 22: ANON 00622c2000-00622f1fff 196608 rwx-- --9213:1:aspacem 23: 00622f2000-006275efff 4640768 --9213:1:aspacem 24: ANON 006275f000-0064eb0fff 39m rwx-- --9213:1:aspacem 25: 0064eb1000-00bd63cfff 1415m --9213:1:aspacem 26: RSVN 00bd63d000-00bde3bfff 8384512 ----- SmUpper --9213:1:aspacem 27: anon 00bde3c000-00bde3cfff 4096 rwx-- --9213:1:aspacem 28: 00bde3d000-00bee1bfff 15m --9213:1:aspacem 29: ANON 00bee1c000-00bee3cfff 135168 rw--- --9213:1:aspacem 30: RSVN 00bee3d000-00fffeffff 1041m ----- SmFixed --9213:1:aspacem 31: anon 00ffff0000-00ffff0fff 4096 r-x-- --9213:1:aspacem 32: RSVN 00ffff1000-00ffffffff 61440 ----- SmFixed --9213:1:aspacem >>> ==9213== ==9213== HEAP SUMMARY: ==9213== in use at exit: 0 bytes in 0 blocks ==9213== total heap usage: 0 allocs, 0 frees, 0 bytes allocated ==9213== ==9213== All heap blocks were freed -- no leaks are possible ==9213== ==9213== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0) ==9213== ==9213== 1 errors in context 1 of 1: ==9213== Invalid read of size 4 --9213:1:mallocfr deferred_reclaimSuperblock at 0x622E2000 (pszB 65520) (prev 0x622E2000) owner VALGRIND/demangle ==9213== at 0x4005180: __dl___linker_init (linker.c:2265) ==9213== by 0x40036EB: _start (begin.S:37) ==9213== Address 0x1c is not stack'd, malloc'd or (recently) free'd ==9213== ==9213== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0) --9213:1:gdbsrv VG_(gdbserver) called to terminate, nothing to terminate --9213:1:core_os VG_(terminate_NORETURN)(tid=1) Segmentation fault It appears to crash in bionic's linker.c when executing: Elf32_Phdr *phdr = (Elf32_Phdr *)((unsigned char *) linker_addr + elf_hdr->e_phoff); Here is the source: /* * This is the entry point for the linker, called from begin.S. This * method is responsible for fixing the linker's own relocations, and * then calling __linker_init_post_relocation(). * * Because this method is called before the linker has fixed it's own * relocations, any attempt to reference an extern variable, extern * function, or other GOT reference will generate a segfault. */ unsigned __linker_init(unsigned **elfdata) { unsigned linker_addr = find_linker_base(elfdata); Elf32_Ehdr *elf_hdr = (Elf32_Ehdr *) linker_addr; Elf32_Phdr *phdr = (Elf32_Phdr *)((unsigned char *) linker_addr + elf_hdr->e_phoff); soinfo linker_so; memset(&linker_so, 0, sizeof(soinfo)); linker_so.base = linker_addr; linker_so.dynamic = (unsigned *) -1; I'm not sure if this is a 4.1.1 or that the galaxy nexus boards don't work with Valgrind at all yet.
(In reply to comment #0) > I'm not sure if this is a 4.1.1 or that the galaxy nexus boards don't work > with Valgrind at all yet. Same problem on Android emulator 4.1
fixed (by a temporary bypass) in revision 12758. The temporary bypass is to not AT_IGNORE the AT_BASE on android. The consequence of this temporary bypass might be that breakpoints in shared libs are placed at wrong addresses. (feedback on this is welcome). As follow-up, need to understand better the interaction between GDB, AT_BASE and Valgrind GDBSERVER.
Created attachment 75029 [details] x86 patch Attached the patch for x86.
(In reply to comment #3) > Created attachment 75029 [details] > x86 patch > > Attached the patch for x86. Committed revision 13105. Thanks for the patch.