[LLVMbugs] [Bug 20085] New: asan should not instrument loads generated by ubsan

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jun 20 00:07:07 PDT 2014


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: samsonov at google.com
          Reporter: kcc at google.com
                CC: glider at google.com, llvmbugs at cs.uiuc.edu,
                    nlewycky at google.com, richard-llvm at metafoo.co.uk
    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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140620/13d4e367/attachment.html>


More information about the llvm-bugs mailing list