<div dir="ltr">Hi Gaurav,<div><br></div><div>Yes, I think this change makes sense. Please follow the process described in <a href="http://llvm.org/docs/Phabricator.html">http://llvm.org/docs/Phabricator.html</a>.</div><div>You can list me (samsonov) as a reviewer, and cc llvm-commits in the review. Make sure to add a test case.</div><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 11, 2015 at 7:09 AM, Gaurav Malhotra <span dir="ltr"><<a href="mailto:malhotrag@gmail.com" target="_blank">malhotrag@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Hi,<br><br></div>I've very recently started looking at clang+ASan to sanitize my application. I discovered that the run time suppressions support added by <a href="http://reviews.llvm.org/D6280" target="_blank">http://reviews.llvm.org/D6280</a> does not suppress memcpy-param-overlap (and other *-param-overlap) errors. I want to suppress these errors from a library that I cannot recompile.<br><br>I looked at the code in asan_interceptors.cc and it seems to me that the suppressions mechanism used for ASAN_READ_RANGE and ASAN_WRITE_RANGE can easily be extended to CHECK_RANGES_OVERLAP. I made those code changes and recompiled clang and everything seems to be working as I expected. The essence of my changes is listed at the bottom of this email.<br><br></div><div>Is this change appropriate? If yes, what is the process to get this code committed?<br><br></div><div>Thanks and Regards,<br></div><div>Gaurav Malhotra<br></div><div><br></div><div>P.S. Here is the code change I made to CHECK_RANGES_OVERLAP. This was accompanied by changes to all the callers of this macro to pass the AsanInterceptorContext pointer that they already have. <br><br><span style="font-family:monospace,monospace">--- a/lib/asan/asan_interceptors.cc<br>+++ b/lib/asan/asan_interceptors.cc<br>@@ -82,13 +82,24 @@ static inline bool RangesOverlap(const char *offset1, uptr length1,<br>                                  const char *offset2, uptr length2) {<br>   return !((offset1 + length1 <= offset2) || (offset2 + length2 <= offset1));<br> }<br>-#define CHECK_RANGES_OVERLAP(name, _offset1, length1, _offset2, length2) do { \<br>+#define CHECK_RANGES_OVERLAP(ctx, name, _offset1, length1, _offset2, length2) do { \<br>   const char *offset1 = (const char*)_offset1; \<br>   const char *offset2 = (const char*)_offset2; \<br>   if (RangesOverlap(offset1, length1, offset2, length2)) { \<br>-    GET_STACK_TRACE_FATAL_HERE; \<br>-    ReportStringFunctionMemoryRangesOverlap(name, offset1, length1, \<br>-                                            offset2, length2, &stack); \<br>+      AsanInterceptorContext *_ctx = (AsanInterceptorContext *)ctx;     \<br>+      bool suppressed = false;                                          \<br>+      if (_ctx) {                                                       \<br>+        suppressed = IsInterceptorSuppressed(_ctx->interceptor_name);   \<br>+        if (!suppressed && HaveStackTraceBasedSuppressions()) {         \<br>+          GET_STACK_TRACE_FATAL_HERE;                                   \<br>+          suppressed = IsStackTraceSuppressed(&stack);                  \<br>+        }                                                               \<br>+      }                                                                 \<br>+      if (!suppressed) {                                                \<br>+        GET_STACK_TRACE_FATAL_HERE;                                     \<br>+        ReportStringFunctionMemoryRangesOverlap(name, offset1, length1, \<br>+                                             offset2, length2, &stack); \<br>+      }                                                                 \<br></span></div></div></blockquote><div><br></div><div>Looks like a lot of this code is copied from the ACCESS_MEMORY_RANGE implementation. You would</div><div>probably want to reduce a copy-paste by pulling out functionality to a separate macro.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><span style="font-family:monospace,monospace">   } \<br> } while (0)<br> </span><br><br></div></div>
<br>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">Alexey Samsonov<br><a href="mailto:vonosmas@gmail.com" target="_blank">vonosmas@gmail.com</a></div></div>
</div></div>