[compiler-rt] [rtsan] Introduce blocking-fn-name and intercepted-fn-name suppressions (PR #112108)

Chris Apple via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 12 12:30:00 PDT 2024


================
@@ -92,3 +92,25 @@ bool __rtsan::IsStackTraceSuppressed(const StackTrace &stack) {
   }
   return false;
 }
+
+static bool IsFunctionSuppressed(const char *interceptor_name,
+                                 const char *flag_name) {
+  if (suppression_ctx == nullptr)
+    return false;
+
+  if (!suppression_ctx->HasSuppressionType(flag_name))
+    return false;
+
+  Suppression *s;
+  return suppression_ctx->Match(interceptor_name, flag_name, &s);
+}
+
+bool __rtsan::IsInterceptorSuppressed(const char *interceptor_name) {
+  return IsFunctionSuppressed(
+      interceptor_name, ConvertTypeToFlagName(ErrorType::InterceptedFnName));
+}
+
+bool __rtsan::IsBlockingFnSuppressed(const char *blocking_fn_name) {
+  return IsFunctionSuppressed(blocking_fn_name,
+                              ConvertTypeToFlagName(ErrorType::BlockingFnName));
+}
----------------
cjappl wrote:

As you can tell, these are very closely related, sharing the same implementation, and just different names based on if they are blocking or intercepted function.

Is it worthwhile to have two categories for this, or lump them into one? Open to feedback here.

https://github.com/llvm/llvm-project/pull/112108


More information about the llvm-commits mailing list