lewisje / address-sanitizer

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

Enable LSAN support for 32bit architecture #403

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I am working on trying to increase the support of leak sanitizer on 32 bit 
architectures. My aim is to bring up the leak identification rate, by reducing 
the number of false negatives we are currently getting from junk data looking 
like mid pointers. On a 32 bit architecture as the address space is smaller, 
there is a high probability that an allocation of 4 bytes of random junk can 
look like a mid pointer, leading to missed leaks. 

Valgrind memcheck tries to relieve this problem by reporting any allocation 
with no start pointer and one or more interior pointer as possibly lost, but 
this approach has issues as it can often reports too many false positives; 
leading debuggers to often ignore the possibly lost report. Dr. Memory goes one 
stage further by using heuristics to remove some of these false positives from 
the reported possibly leaks (http://drmemory.org/docs/page_leaks.html)

The first stage of my attached working patch is simply the addition of 
"possible leaks" on 32 bit archs (using preprocessors).
Next I would like to work on a way of removing as many false positives from the 
reported "possible leaks" as possible.

We could do this by using heuristics like the ones used in dr. memory, but I 
know valgrind memcheck dismissed this guessing approach as looking "scary" 
(https://bugs.kde.org/show_bug.cgi?id=280271).  

Any ideas or thoughts would be greatly appreciated.

My testing is being done on an arm 32 bit device so my patches work on top of 
the following ARM patch 
(https://code.google.com/p/address-sanitizer/issues/detail?id=294)

REFERENCE ISSUES: 
Port LSan to arm 
https://code.google.com/p/address-sanitizer/issues/detail?id=294
Leak sanitizer support for Android on arm64 
https://code.google.com/p/address-sanitizer/issues/detail?id=379
https://code.google.com/p/valgrind-variant/wiki/LeakCheckingOn32bits

Original issue reported on code.google.com by taylo...@googlemail.com on 11 Aug 2015 at 4:45

Attachments:

GoogleCodeExporter commented 9 years ago
This has come up before, including the bug you mentioned above,
and it is problematic for the reasons you mostly explained. :)  
We are deliberately not enabling lsan on 32-bit --
it will have too high maintenance cost for us and we are not willing to pay it, 
sorry.

If you are still enthusiastic, keep updating this bug with more 
details/patches, 
maybe someone else will find them useful. 

Original comment by konstant...@gmail.com on 11 Aug 2015 at 5:09

GoogleCodeExporter commented 9 years ago
As this keeps popping up, perhaps add a descriptive message to #error in lsan 
header?

Original comment by tetra2...@gmail.com on 16 Aug 2015 at 8:57

GoogleCodeExporter commented 9 years ago

Original comment by ramosian.glider@gmail.com on 20 Aug 2015 at 12:26