Bug 268545 - valgrind dies with failed in UME only for dynamically linked binaries, works fine for static binaries
Summary: valgrind dies with failed in UME only for dynamically linked binaries, works ...
Status: RESOLVED NOT A BUG
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (show other bugs)
Version: 3.6.0
Platform: Unlisted Binaries Linux
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-15 10:01 UTC by Sundeep
Modified: 2011-03-15 14:24 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
cpu_loop source code (3.71 KB, text/x-csrc)
2011-03-15 10:01 UTC, Sundeep
Details
log of cpu_loop dynamically linked program run thorugh valgrind (2.43 KB, text/plain)
2011-03-15 10:02 UTC, Sundeep
Details
strace log of cpu_loop dynamically linked program run through valgrind (13.41 KB, text/plain)
2011-03-15 10:03 UTC, Sundeep
Details
statically linked program run on valgrind works fine (10.24 KB, text/plain)
2011-03-15 10:04 UTC, Sundeep
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sundeep 2011-03-15 10:01:20 UTC
Created attachment 58018 [details]
cpu_loop source code

Version:           3.6.0
OS:                Linux

Valgrind dies on Android for dynamically linked programs, works fine with dynamically linked programs

With statically linked binaries, valgrind works fine, 
With Dynamically linked Binaries, it fails at loading the binary on to RAM due to some linker/mapping issue.

Created standalone Cross compiler ToolChain for Android ndk-n5b, got the dynamically linked apps working fine on Android.

Compiled valgrind for android with custom built Android ndk-n5b standalone CC toolchain and got it running on Target Platform.

     Being tracked by Valgrind developers at http://bugs.kde.org/show_bug.cgi?id=138424


Reproducible: Didn't try

Steps to Reproduce:
-Build android standalone toolchain with ndk-n5b
-changed armv7 to arm in configure file
-got latest config.sub and config.guess files from libtools

./configure --prefix=/data/valcheck --host=arm-linux-androideabi CC=arm-linux-androideabi-gcc
make && make install && adb push /data/valcheck /data/valcheck

compiled a small program let say a hello world program, actually another cpu_busy loop that has NO static arrays.

valgrind --tool=memcheck cpu_loop_dyn




Actual Results:  
Dies with
valgrind: mmap(0x0, 2952865436) failed in UME with error 22 (Invalid argument).
valgrind: this can be caused by executables with very large text, data or bss segments.

Expected Results:  
It should run and yield memleak statistics
Comment 1 Sundeep 2011-03-15 10:02:38 UTC
Created attachment 58019 [details]
log of cpu_loop dynamically linked program run thorugh valgrind
Comment 2 Sundeep 2011-03-15 10:03:43 UTC
Created attachment 58020 [details]
strace log of cpu_loop dynamically linked program run through valgrind
Comment 3 Sundeep 2011-03-15 10:04:39 UTC
Created attachment 58021 [details]
statically linked program run on valgrind works fine
Comment 4 Tom Hughes 2011-03-15 10:12:24 UTC
Android isn't really a supported platform yet, so you're probably better off addressing this with the people that are working on porting valgrind to android than report it here as none of us have any experience of valgrind on android.
Comment 5 Sundeep 2011-03-15 14:04:39 UTC
(In reply to comment #4)
> Android isn't really a supported platform yet, so you're probably better off
> addressing this with the people that are working on porting valgrind to android
> than report it here as none of us have any experience of valgrind on android.

From the strace log and valgrind log data, I come to a stand that it is breaking in loading the exe file onto memory. Can you please give some more info on why this can happen, So, that I can try fixing it.
Comment 6 Tom Hughes 2011-03-15 14:24:06 UTC
As I said, valgrind is not currently supported on android and nobody here is going to be able to help you. There are people working on android port and I suggest you talk to them. There is bug tracking the progress they have made so far which you can see here:

https://bugs.kde.org/show_bug.cgi?id=266035

The problem you are seeing is most likely caused by incompatibilities between the address space layout on android and how valgrind likes to arrange memory, such that something can't be loaded at the required address.

It will need careful debugging by somebody with good knowledge of both valgrind and the kernel being used and access to an appropriate system on which to debug it.