ramosian-glider / address-sanitizer

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

can not mask function in closed source library #356

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
>What steps will reproduce the problem?
1. Compile attached example: gmake
2. Run: LD_LIBRARY_PATH="./" ./app
3. it stops on function "f"

>What is the expected output? What do you see instead?
At least not abort/exit after call function "f" 

>What version of the product are you using? On what operating system?
I try clang 3.5.0 and gcc 4.9.2

I used close source library (linux shared library) with my application, that I 
can not fix/recompile. I want ignore errors from it (sometimes it calls strncpy 
with the same pointers as input and output).

I tried add __attribute__((__no_sanitize_address__)) to its definitions,
I tried add __attribute__((__no_sanitize_address__)) to my function (which 
compiled with -fsanitize=address) that call function from close source library.
I tried clang "-fsanitize-blacklist=blacklist.txt", and in blacklist.txt I 
mentioned bad function from close source library, plus my function with call 
bad function from close source library.

Neither of these variants can mask problem, and allow me to debug my code.

In attachment file is simple gnu make based project, that demonstrate problem.

Original issue reported on code.google.com by dushis...@gmail.com on 12 Nov 2014 at 10:09

Attachments:

GoogleCodeExporter commented 9 years ago
Try ASAN_OPTIONS=replace_str=0 as a workaround. 
We are planing a better support for this case, but I don't have an ETA:
https://groups.google.com/forum/#!topic/address-sanitizer/M6jmTnYbRRY

Original comment by konstant...@gmail.com on 13 Nov 2014 at 12:39

GoogleCodeExporter commented 9 years ago
>Try ASAN_OPTIONS=replace_str=0 

This helps, thanks, but does this disable string.h checks for all of my app?

Can not find any note about replace_str here: 
https://code.google.com/p/address-sanitizer/wiki/Flags , is it some secret 
option for privy councillors?

Original comment by dushis...@gmail.com on 13 Nov 2014 at 1:02

GoogleCodeExporter commented 9 years ago
>> This helps, thanks, but does this disable string.h checks for all of my app?

Yes, at least some of them. 
See here for the exact list: 
http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_interceptors
.cc?revision=216184&view=markup&pathrev=216184

The flag is deliberately undocumented, we don't want users to rely on it.

CC-ed Kuba. Kuba, any ETA for the asan interceptor suppressions?
Are you still working on those? 

Original comment by konstant...@gmail.com on 13 Nov 2014 at 1:17

GoogleCodeExporter commented 9 years ago
Yes, working on that. Can't say any specific date, though.

Original comment by kuba.brecka@gmail.com on 13 Nov 2014 at 1:47

GoogleCodeExporter commented 9 years ago
Suppressions had landed in r223508. Though we need to document them. Would the 
llvm webpage be the appropriate place? (For now, http://reviews.llvm.org/D6280 
has the best documentation.)

Original comment by zaks.a...@gmail.com on 17 Feb 2015 at 5:38

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