viralcode / address-sanitizer

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

need to instrument thread-local globals #12

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Currently, asan does not instrument thread-local globals, but it should. 

Two problems here: 

1. The address of main thread's thread-local is not available at the link time 
where we currently form the array which will be passed to 
__asan_register_globals

2. Need to poison the non-main-thread's copies somehow. 

Original issue reported on code.google.com by konstant...@gmail.com on 23 Nov 2011 at 2:38

GoogleCodeExporter commented 9 years ago
For the main executable we can keep a stencil corresponding to the .tls segment 
with poisoned redzones (the redzone positions are determined using a function 
similar to __asan_register_globals). In the pthread_create callback we can copy 
that stencil over the current thread's TLS, which is usually before the 
thread's stack.

For the shared libraries it's a little bit trickier, because their TLS data is 
stored in a two-level map.

Original comment by ramosian.glider@gmail.com on 1 Feb 2012 at 4:05