Jeff-Lewis / address-sanitizer

Automatically exported from code.google.com/p/address-sanitizer
0 stars 0 forks source link

Leak sanitizer support for Android on arm64 #379

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
This is for porting leak sanitizer for Android with arm64. It seems 32bit arm 
had issues documented at 
https://code.google.com/p/address-sanitizer/issues/detail?id=294&can=1&q=leak%20
sanitizer&colspec=ID%20Type%20Status%20Priority%20OpSys%20Owner%20Summary.

  But is there any plan to port for arm64, now that there are 64 bit processors running Android.

Original issue reported on code.google.com by vairav...@gmail.com on 6 Mar 2015 at 11:47

GoogleCodeExporter commented 9 years ago

Original comment by konstant...@gmail.com on 6 Mar 2015 at 11:57

GoogleCodeExporter commented 9 years ago
We don't have plans yet, but it's in our radar. We need to make ARM stable 
runtime first. 

Original comment by rengo...@gmail.com on 7 Mar 2015 at 12:52

GoogleCodeExporter commented 9 years ago
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.

Original comment by vairav...@gmail.com on 7 Mar 2015 at 2:45

GoogleCodeExporter commented 9 years ago
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. :( / :) 

Original comment by konstant...@gmail.com on 7 Mar 2015 at 2:52

GoogleCodeExporter commented 9 years ago
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?

Original comment by vairav...@gmail.com on 7 Mar 2015 at 3:45

GoogleCodeExporter commented 9 years ago
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();

Original comment by konstant...@gmail.com on 7 Mar 2015 at 5:36

GoogleCodeExporter commented 9 years ago
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.

Original comment by earth...@google.com on 22 May 2015 at 3:20

GoogleCodeExporter commented 9 years ago
Adding Project:AddressSanitizer as part of GitHub migration.

Original comment by ramosian.glider@gmail.com on 30 Jul 2015 at 9:06