[resend due to "Mail Delivery Subsystem " issue]

Hi,

Yeah, Evegenii has mentioned, only AOSP master branch has support for
LSAN+ASAN. (If you want quick and dirty you could probably just build the
libc.so from master and push it to your current Android 10 image ... it
probably works)
Equally important, you also need a fairly recent toolchain to compile with
LSAN+ASAN enabled for your android app (I dont know off the top of my head
which NDK  version is good, but anything before December 2020 will
definitely not work). Again, quick and dirty trick could be to check out
the latest toolchain, build it and, push the libclang_rt*.so to device.
(Eg., adb push
 
$ANDROID_TC/out/install/linux-x86/clang-dev/lib64/clang/$CLANG_VERSION/lib/linux/
libclang_rt.asan-aarch64-android.so /system/lib64/
libclang_rt.asan-aarch64-android.so)


Assuming the two conditions above are met, _lsan_do_leak_check(void) can be
called to force a leak-check

Hope this helps,
Vy



> On Tue, 9 Feb 2021 at 14:50, Evgenii Stepanov <[email protected]> wrote:
>
>> Hi,
>>
>> * ASan in Android 10 (or even Android 11) does not support leak
>> detection. The current AOSP master branch might.
>> * Leak detection is done when a program exits, which audioflinger never
>> does. There is an API to force a leak check at runtime.
>>
>>
>> On Mon, Feb 8, 2021 at 10:05 PM varsha vanga <[email protected]>
>> wrote:
>>
>>>
>>> Hi,
>>> I am trying to use the address sanitizer tool in Android AOSP -(Android
>>> 10.)
>>> I am trying to check the possible memory leaks in AudioFlinger.
>>>
>>> I have added the foll. code in Android.bp file 
>>> (frameworks/av/services/audioflinger/Android.bp)
>>> to enable ASAN:
>>>
>>> cflags: [
>>> +        "-Wno-error",
>>> +         "-fno-omit-frame-pointer",
>>> +         "-O0",
>>> +         "-Wno-frame-larger-than=",
>>> +         "-fvisibility=hidden",
>>> +         "-Wall",
>>> +         "-Werror",
>>> +          "-Wno-error=unused-function",
>>> +        * "-fsanitize-recover=address"*
>>>
>>>     ],
>>>    * clang: true,*
>>>
>>>
>>> *  sanitize: {        address: true,    },*
>>>
>>> I have inserted the intentional memory leak in the code so as to check
>>> the ASAN detection. built the code using "mm" and pushed it to the device.
>>> But I do not get any issue reported/crash from ASAN. Seems that I need
>>> to enable ASAN in some other part of AOSP.
>>> Can anyone help me with this. Hoping for the reply.
>>>
>>>
>>> Regards,
>>> Varsha
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "address-sanitizer" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/address-sanitizer/98249784-2481-4145-9455-6198641b32a8n%40googlegroups.com
>>> <https://groups.google.com/d/msgid/address-sanitizer/98249784-2481-4145-9455-6198641b32a8n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/address-sanitizer/CAGQmY_Wvkr30fS-WaUD1kJEcSi3Thivkscc8z7G2tsRwTwUWbA%40mail.gmail.com.

Reply via email to