gopalshankar / address-sanitizer

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

make unaligned pointers handling in LSan more useful #304

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
With use_unaligned=1, LSan will consider unaligned byte patterns as pointers. 
This matters in certain rare cases, e.g. when pointers are stored in a packed 
struct. To help detect such cases, HeapChecker supports a mode where we run two 
leak checks back-to-back, one of which takes into account only aligned byte 
patters and the other considers all byte patters. By comparing the results, 
HeapChecker can detect the presence of unaligned pointers. (The idea being that 
this is more convenient than running the program twice with use_unaligned=1/0 
and comparing the results manually.)

LSan could support a similar feature with a relatively simple change, although 
the utility of this is unclear. False positives due to unaligned pointers are 
quite rare (only 2 cases in the first year of LSan deployment) and it seems 
that the minor convenience boost might not be worth the complexity increase.

Original issue reported on code.google.com by earth...@google.com on 30 Apr 2014 at 6:11