On Fri, Feb 7, 2014 at 12:24 PM, Yuri Gribov <[email protected]> wrote:

> >> 2) Can we add a check to REAL() to produce a nice diagnostic message
> >> in this case?
> >
> > There are a few such checks.
>
> I don't think that REAL() currently checks anything:
>

REAL doesn't check anything. Some interceptors do the checks, e.g.
INTERCEPTOR(char*, strdup, const char *s) {
  if (!asan_inited) return internal_strdup(s);
  ENSURE_ASAN_INITED();
...




>
> ~/llvm/trunk/projects/compiler-rt/lib$ grep NULL interception/* -l
> interception/interception_win.cc
>
> We seem to rely on callers to make sure that these variables are
> properly initialized.
>
> >> 3) We once discussed making __asan_init a constructor to solve this
> >> problem (discussion and patch available here:
> >> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58937).
> >
> >
> > __asan_init is a constructor, but there could be other constructors that
> run
> > before it.
>
> Are you sure? I don't see any ctors in compiler-rt trunk:
>

The compiler eimits a CTOR function that call __asan_init

clang  -fsanitize=address foo.cc && objdump -d ./a.out

000000000047dbd0 <asan.module_ctor>:
  47dbd0:       55                      push   %rbp
  47dbd1:       48 89 e5                mov    %rsp,%rbp
  47dbd4:       48 83 ec 10             sub    $0x10,%rsp
  47dbd8:       e8 d3 d6 fe ff          callq  46b2b0 <__asan_init_v3>



> ~/llvm/trunk/projects/compiler-rt/lib/asan$ grep constructor *  | grep
> -v TestCases
> asan_thread.cc:      // On Android, libc constructor is called _after_
> asan_init, and cleans up
> asan_thread.h:  // NOTE: There is no AsanThread constructor. It is
> allocated
>
> >> Some proposal from me:
> >> * could you add a note about spurious "failed to intercept" warnings?
> >> (see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58680 for reference)
> >
> > Hm? What about that? How would you phrase it?
>
> Added to Cons section in wiki.
>

I don't really like the phrasing.
First, debug output concerns only developers, not (most) users.
Second, what does this output mean?
I suspect that this means the same thing as with -static-libstdc++ -- asan
failed to intercept one of the functions is wants to intercept.
For memcpy&friends it means that asan will not find bugs there.
For some other functions (e.g. longjmp) it means that asan may report false
positives.
This problem needs deeper analysis before I can recommend asan-DSO to
anyone.

--kcc

-- 
You received this message because you are subscribed to the Google Groups 
"address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to