aboutsummaryrefslogtreecommitdiff
path: root/compiler-rt
diff options
context:
space:
mode:
authorVitaly Buka <vitalybuka@google.com>2024-01-19 22:42:17 -0800
committerVitaly Buka <vitalybuka@google.com>2024-01-19 23:25:13 -0800
commit3e3d74af86869278c4bc3fa015f4e0bda15f09e0 (patch)
treef2913e96a33fdf98d9f1ece3a8c221399b2c7a29 /compiler-rt
parent15b089cb023eaf7f80bcd5cd0e0e5fdd2fa2cbd0 (diff)
downloadllvm-3e3d74af86869278c4bc3fa015f4e0bda15f09e0.zip
llvm-3e3d74af86869278c4bc3fa015f4e0bda15f09e0.tar.gz
llvm-3e3d74af86869278c4bc3fa015f4e0bda15f09e0.tar.bz2
Reapply "[sanitizer] Skip /include/c++/ from summary (#78534)"
Keep linux only test. This reverts commit 4619147911c2a955bb605618bc518b45da994a81.
Diffstat (limited to 'compiler-rt')
-rw-r--r--compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_report.cpp3
-rw-r--r--compiler-rt/test/sanitizer_common/TestCases/Linux/allocator_returns_null_std.cpp30
2 files changed, 32 insertions, 1 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_report.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_report.cpp
index 253dc10..8438e01 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 0000000..812cf04
--- /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