http://llvm.org/bugs/show_bug.cgi?id=20085

            Bug ID: 20085
           Summary: asan should not instrument loads generated by ubsan
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected]
    Classification: Unclassified

% cat vptr.cc 
struct A {  virtual void f(); };
void Bar(A *a) { a->f(); }
% clang -S -O -fsanitize=vptr -o -  vptr.cc| grep
'call.*\(__ubsan\|__asan_report\)'
        callq   __ubsan_handle_dynamic_type_cache_miss
% clang -S -O -fsanitize=address -o -  vptr.cc| grep
'call.*\(__ubsan\|__asan_report\)'
        callq   __asan_report_load8
        callq   __asan_report_load8
% clang -S -O -fsanitize=address,vptr -o -  vptr.cc| grep
'call.*\(__ubsan\|__asan_report\)'
        callq   __asan_report_load8
        callq   __asan_report_load8
        callq   __asan_report_load8
        callq   __ubsan_handle_dynamic_type_cache_miss
% 

As you can see, asan instruments one load generated by ubsan.
This is redundant. 

One way to avoid this extra instrumentation is to attach some kind of metadata
to the load and honor it in asan instrumentation pass.

We do something similar in tsan to treat vptr loads in a special way: 
clang -S -O -fsanitize=thread -emit-llvm  -o -  vptr.cc
  %vtable = load void (%struct.A*)*** %0, !tbaa !1
!1 = metadata !{metadata !2, metadata !2, i64 0}
!2 = metadata !{metadata !"vtable pointer", metadata !3, i64 0}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to