[compiler-rt] r244083 - [libFuzzer] add weak hooks for strcmp

Kostya Serebryany kcc at google.com
Wed Aug 5 11:20:54 PDT 2015


Author: kcc
Date: Wed Aug  5 13:20:54 2015
New Revision: 244083

URL: http://llvm.org/viewvc/llvm-project?rev=244083&view=rev
Log:
[libFuzzer] add weak hooks for strcmp

Modified:
    compiler-rt/trunk/lib/dfsan/dfsan_custom.cc
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc

Modified: compiler-rt/trunk/lib/dfsan/dfsan_custom.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/dfsan/dfsan_custom.cc?rev=244083&r1=244082&r2=244083&view=diff
==============================================================================
--- compiler-rt/trunk/lib/dfsan/dfsan_custom.cc (original)
+++ compiler-rt/trunk/lib/dfsan/dfsan_custom.cc Wed Aug  5 13:20:54 2015
@@ -124,10 +124,16 @@ SANITIZER_INTERFACE_ATTRIBUTE int __dfsw
   return 0;
 }
 
+DECLARE_WEAK_INTERCEPTOR_HOOK(dfsan_weak_hook_strcmp, uptr caller_pc,
+                              const char *s1, const char *s2,
+                              dfsan_label s1_label, dfsan_label s2_label)
+
 SANITIZER_INTERFACE_ATTRIBUTE int __dfsw_strcmp(const char *s1, const char *s2,
                                                 dfsan_label s1_label,
                                                 dfsan_label s2_label,
                                                 dfsan_label *ret_label) {
+  CALL_WEAK_INTERCEPTOR_HOOK(dfsan_weak_hook_strcmp, GET_CALLER_PC(), s1, s2,
+                             s1_label, s2_label);
   for (size_t i = 0;; ++i) {
     if (s1[i] != s2[i] || s1[i] == 0 || s2[i] == 0) {
       if (flags().strict_data_dependencies) {

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc?rev=244083&r1=244082&r2=244083&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc Wed Aug  5 13:20:54 2015
@@ -204,9 +204,14 @@ static inline int CharCmpX(unsigned char
   return (c1 == c2) ? 0 : (c1 < c2) ? -1 : 1;
 }
 
+DECLARE_WEAK_INTERCEPTOR_HOOK(__sanitizer_weak_hook_strcmp, uptr called_pc,
+                              const char *s1, const char *s2)
+
 INTERCEPTOR(int, strcmp, const char *s1, const char *s2) {
   void *ctx;
   COMMON_INTERCEPTOR_ENTER(ctx, strcmp, s1, s2);
+  CALL_WEAK_INTERCEPTOR_HOOK(__sanitizer_weak_hook_strcmp, GET_CALLER_PC(), s1,
+                             s2);
   unsigned char c1, c2;
   uptr i;
   for (i = 0;; i++) {




More information about the llvm-commits mailing list