[compiler-rt] 3e3d74a - Reapply "[sanitizer] Skip /include/c++/ from summary (#78534)"

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 19 23:25:27 PST 2024


Author: Vitaly Buka
Date: 2024-01-19T23:25:13-08:00
New Revision: 3e3d74af86869278c4bc3fa015f4e0bda15f09e0

URL: https://github.com/llvm/llvm-project/commit/3e3d74af86869278c4bc3fa015f4e0bda15f09e0
DIFF: https://github.com/llvm/llvm-project/commit/3e3d74af86869278c4bc3fa015f4e0bda15f09e0.diff

LOG: Reapply "[sanitizer] Skip /include/c++/ from summary (#78534)"

Keep linux only test.

This reverts commit 4619147911c2a955bb605618bc518b45da994a81.

Added: 
    compiler-rt/test/sanitizer_common/TestCases/Linux/allocator_returns_null_std.cpp

Modified: 
    compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_report.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_report.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_report.cpp
index 253dc10607a6ebe..8438e019591b58a 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_report.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_report.cpp
@@ -34,7 +34,8 @@ static bool FrameIsInternal(const SymbolizedStack *frame) {
     return true;
   const char *file = frame->info.file;
   const char *module = frame->info.module;
-  if (file && (internal_strstr(file, "/compiler-rt/lib/")))
+  if (file && (internal_strstr(file, "/compiler-rt/lib/") ||
+               internal_strstr(file, "/include/c++/")))
     return true;
   if (module && (internal_strstr(module, "libclang_rt.")))
     return true;

diff  --git a/compiler-rt/test/sanitizer_common/TestCases/Linux/allocator_returns_null_std.cpp b/compiler-rt/test/sanitizer_common/TestCases/Linux/allocator_returns_null_std.cpp
new file mode 100644
index 000000000000000..812cf049f2a9bcb
--- /dev/null
+++ b/compiler-rt/test/sanitizer_common/TestCases/Linux/allocator_returns_null_std.cpp
@@ -0,0 +1,30 @@
+// Test the behavior of malloc called from std:: when the allocation size
+// exceeds the sanitizer's allocator max allowed one.
+
+// RUN: %clangxx -O0 %s -o %t
+// RUN: %env_tool_opts=allocator_may_return_null=0 not %run %t 2>&1 | FileCheck %s
+
+// UBSAN has no allocator.
+// UNSUPPORTED: ubsan
+
+// REQUIRES: x86_64-target-arch
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <vector>
+
+int main(int argc, char **argv) {
+  // The maximum value of all supported sanitizers (search for
+  // kMaxAllowedMallocSize). For ASan + LSan, ASan limit is used.
+  constexpr size_t kMaxAllowedMallocSizePlusOne = (1ULL << 40) + 1;
+
+  std::vector<char> v;
+  v.resize(kMaxAllowedMallocSizePlusOne);
+
+  fprintf(stderr, "x: %lx\n", (long)v.data());
+
+  return 0;
+}
+
+// CHECK: #{{[0-9]+.*}}allocator_returns_null_std.cpp
+// CHECK: {{SUMMARY: .*Sanitizer: allocation-size-too-big.*allocator_returns_null_std.cpp.*}} in main


        


More information about the llvm-commits mailing list