Open ramosian-glider opened 9 years ago
We don't have plans yet, but it's in our radar. We need to make ARM stable runtime first.
Reported by rengolin
on 2015-03-07 00:52:22
Thanks for the update. Do you have any recommendations in the short term? I have tried
using Valgrind for Android but the applications are practically slow that its hard
to execute any use case.
Reported by vairavans
on 2015-03-07 02:45:42
There are several problems here, actually.
1. Make lsan work on AArch64 Linux. I don't know the status of this, but it should
be easy to accomplish.
2. Make lsan work on Android, x86_64 and AArch64.
>> Do you have any recommendations in the short term?
Nope. Unless of course you want to help us with the development. :( / :)
Reported by konstantin.s.serebryany
on 2015-03-07 02:52:48
Sure, i can give it a shot. Btw, android apps don't really have an exit unlike a typical
c program with a main. In c terms, android apps have a kind of an infinite loop which
doesn't quit. Would leak sanitizer still work in such cases?
Reported by vairavans
on 2015-03-07 03:45:46
Right now we can call leak checking only once per process,
but this does not necessary has to be done at the very end.
From lsan_interface.h:
// Calling this function makes LSan enter the leak checking phase immediately.
// Use this if normal end-of-process leak checking happens too late (e.g. if
// you have intentional memory leaks in your shutdown code). Calling this
// function overrides end-of-process leak checking; it must be called at
// most once per process. This function will terminate the process if there
// are memory leaks and the exit_code flag is non-zero.
void __lsan_do_leak_check();
Reported by konstantin.s.serebryany
on 2015-03-07 05:36:25
For the record, I've recently added a new interface function which allows multiple leak
checks:
// Check for leaks now. Returns zero if no leaks have been found or if leak
// detection is disabled, non-zero otherwise.
// This function may be called repeatedly, e.g. to periodically check a
// long-running process. It prints a leak report if appropriate, but does not
// terminate the process. It does not affect the behavior of
// __lsan_do_leak_check() or the end-of-process leak check, and is not
// affected by them.
int __lsan_do_recoverable_leak_check();
> 1. Make lsan work on AArch64 Linux. I don't know the status of this, but it should
be easy to accomplish.
Recently this was done for MIPS. I invite you (vairavans) to take a look at those patches
to get an idea of the scope of work. Basically you will have to:
- port stoptheworld (reimplementing internal_clone() will probably be the bulk of this),
- port the TLS discovery code,
- pick up a few platform-dependent bits and pieces in lsan_common.
Reported by earthdok@google.com
on 2015-05-22 15:20:49
Adding Project:AddressSanitizer as part of GitHub migration.
Reported by ramosian.glider
on 2015-07-30 09:06:35
@ramosian-glider
I am currently trying to use described functionality in my android library:
#include <sanitizer/lsan_interface.h>
__lsan_do_leak_check();
__lsan_do_recoverable_leak_check();
However, the linking stage fails:
xxxxx.cpp:481: error: undefined reference to '__lsan_do_leak_check'
How can I link from Android.mk to implementation of that function?
[edit]
In fact, I wonder what is the current status of Leak sanitizer support for Android. There is couple of information scattered thorough the wiki/Internet when regarding debugging applications/so libraries, but no concise description. E.g.:
I managed to compile my library with address sanitizer support on armeabi, armeabi-v7a, arm64-v8a, x86; build for x86_64 failed.
[edit2]
Upon running my library for arm64-v8a on an emulator it crashes with:
java.lang.UnsatisfiedLinkError: dlopen failed: library "libclang_rt.asan-aarch64-android.so"
therefore I could not find any working setup that provides working leak sanitizer for Android.
LSan does not work on Android at the moment. I'm not sure how much work is left, probably a subset of things listed in this comment: https://github.com/google/sanitizers/issues/379#issuecomment-136551038
Currently LSan is disabled for Android in the upstream (llvm / cmake) build system, and it is not included in the android prebuilt libraries (the ones you find in the NDK) either.
Regarding your "dlopen failed" error, for this library to appear on device (or emulator) you'd need to run asan_device_setup as per ASan documentation. And, again, there is no LSan there.
Thank you for your comment @eugenis. I am currently stuck with a memory-related issue in my NDK component on Android. I hoped I could resolve that with Leak Sanitizer. Are you aware of any other tools that might be helpful in this case?
Valgrind has some sort of memory profiler (massif). I don't know how well it works on android.
On Thu, Mar 30, 2017 at 10:04 PM, Piotr notifications@github.com wrote:
Thank you for your comment @eugenis https://github.com/eugenis. I am currently stuck with a memory-related issue in my NDK component on Android. I hoped I could resolve that with Leak Sanitizer. Are you aware of any other tools that might be helpful in this case?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/google/sanitizers/issues/379#issuecomment-290616742, or mute the thread https://github.com/notifications/unsubscribe-auth/AAZuSh_xO0lMlu_RT1-j4NjS5dNVWhMVks5rrIlvgaJpZM4MudPz .
Just curious, are there any technical blockers for enabling LSan on Android Aarch64? At a first glance I can see TLS supporting caveats, but for beginning we can just disable thread local caches in LSan runtime and exclude static TLS from root set (I just don't know how Android libc implements it).
No blockers. It should be quite easy, we just never had time to finish the job.
TLS implementation is different from glibc, of course, but it is quite simple. Excluding it from root set would create false positive reports though.
The fact that android apps never finish normally (they catch SIGKILL instead) means the will be no automatic leak report, but the tool would still be usable for standalone executables and through __lsan_do_leak_check() interface.
On Fri, Mar 31, 2017 at 3:50 PM, chefmax notifications@github.com wrote:
Just curious, are there any technical blockers for enabling LSan on Android Aarch64? At a first glance I can see TLS supporting caveats, but for beginning we can just disable thread local caches in LSan runtime and exclude static TLS from root set (I just don't know how Android libc implements it).
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/google/sanitizers/issues/379#issuecomment-290850256, or mute the thread https://github.com/notifications/unsubscribe-auth/AAZuSgzREm-JrFPxGj6zK-MQlhKakmOJks5rrYMogaJpZM4MudPz .
Ping. Any progress on this since last year?
Nope.
==30805==AddressSanitizer: detect_leaks is not supported on this platform.
LSAN still does not work for aarch64-clang on Android 8.0
Any progress on this over the last three years?
ASAN+LSAN should work for Android 30+ (aarch64 and x86_64)
(no HWASAN+LSAN yet tho)
On Fri, Aug 27, 2021, 4:40 AM Tianqi Xu @.***> wrote:
Any progress on this over the last three years?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/google/sanitizers/issues/379#issuecomment-907033108, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANONE6NKFML67VR32D46JLT65FOPANCNFSM4DFZ2PZQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
ASAN+LSAN should work for Android 30+ (aarch64 and x86_64) (no HWASAN+LSAN yet tho) … On Fri, Aug 27, 2021, 4:40 AM Tianqi Xu @.***> wrote: Any progress on this over the last three years? — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#379 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANONE6NKFML67VR32D46JLT65FOPANCNFSM4DFZ2PZQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
$ ${ANDROID_NDK}/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android31-clang++ -fsanitize=address -O0 -fno-omit-frame-pointer -g -pie -fPIE sample.cpp
$ adb push a.out /data/local/tmp/lkk/ && adb shell "cd /data/local/tmp/lkk/ && LD_LIBRARY_PATH=/data/local/tmp/lkk/arm64-v8a/:$LD_LIBRARY_PATH ASAN_OPTIONS=detect_leaks=1 /data/local/tmp/lkk/a.out"
WARNING: linker: Warning: "/data/local/tmp/lkk/arm64-v8a/libclang_rt.asan-aarch64-android.so" unused DT entry: unknown processor-specific (type 0x70000001 arg 0x0) (ignoring)
WARNING: linker: Warning: "/data/local/tmp/lkk/arm64-v8a/libc++_shared.so" unused DT entry: unknown processor-specific (type 0x70000001 arg 0x0) (ignoring)
I tried the NDK25C, and the error AddressSanitizer: detect_leaks is not supported on this platform. Aborted was reported.
ASAN+LSAN should work for Android 30+ (aarch64 and x86_64) (no HWASAN+LSAN yet tho) … On Fri, Aug 27, 2021, 4:40 AM Tianqi Xu @.***> wrote: Any progress on this over the last three years? — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#379 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANONE6NKFML67VR32D46JLT65FOPANCNFSM4DFZ2PZQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
seems not working for me~
I also get "detect_leaks is not supported on this platform". Any suggestions?
Originally reported on Google Code with ID 379
Reported by
vairavans
on 2015-03-06 23:47:18