CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
72 lines
1.8 KiB
C++
72 lines
1.8 KiB
C++
// RUN: %clangxx -fsanitize=realtime %s -o %t
|
|
// RUN: %env_rtsan_opts=halt_on_error=false %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-NOSUPPRESSIONS
|
|
// RUN: %env_rtsan_opts=suppressions='%s.supp':print_stats_on_exit=true not %run %t 2>&1 | FileCheck %s
|
|
// UNSUPPORTED: ios
|
|
|
|
// Intent: Ensure that suppressions work as intended
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <unistd.h>
|
|
|
|
#include <atomic>
|
|
#include <vector>
|
|
|
|
std::atomic<int> cas_atomic{0};
|
|
|
|
void *MallocViolation() { return malloc(10); }
|
|
|
|
void VectorViolations() {
|
|
// All of these should be suppressed by *vector*
|
|
std::vector<int> v(10);
|
|
v.resize(20);
|
|
v.clear();
|
|
v.resize(0);
|
|
v.push_back(1);
|
|
v.reserve(10);
|
|
}
|
|
|
|
void BlockFunc() [[clang::blocking]] {
|
|
int expected = 0;
|
|
while (!cas_atomic.compare_exchange_weak(expected, 1)) {
|
|
expected = cas_atomic.load();
|
|
}
|
|
}
|
|
|
|
void *process() [[clang::nonblocking]] {
|
|
void *ptr = MallocViolation(); // Suppressed call-stack-contains
|
|
VectorViolations(); // Suppressed call-stack-contains with regex
|
|
BlockFunc(); // Suppressed function-name-matches
|
|
free(ptr); // Suppressed function-name-matches
|
|
|
|
// This is the one that should abort the program
|
|
// Everything else is suppressed
|
|
usleep(1);
|
|
|
|
return ptr;
|
|
}
|
|
|
|
int main() {
|
|
process();
|
|
return 0;
|
|
}
|
|
|
|
// CHECK-NOT: failed to open suppressions file
|
|
// CHECK: Intercepted call to real-time unsafe function
|
|
// CHECK-SAME: usleep
|
|
|
|
// CHECK-NOT: Intercepted call to real-time unsafe function
|
|
// CHECK-NOT: malloc
|
|
// CHECK-NOT: vector
|
|
// CHECK-NOT: free
|
|
// CHECK-NOT: BlockFunc
|
|
|
|
// CHECK: RealtimeSanitizer exit stats:
|
|
// CHECK: Suppression count: 7
|
|
|
|
// CHECK-NOSUPPRESSIONS: malloc
|
|
// CHECK-NOSUPPRESSIONS: vector
|
|
// CHECK-NOSUPPRESSIONS: free
|
|
// CHECK-NOSUPPRESSIONS: BlockFunc
|
|
// CHECK-NOSUPPRESSIONS: usleep
|