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
60 lines
2.4 KiB
C
60 lines
2.4 KiB
C
// RUN: %clang -target x86_64-linux-gnu -S -emit-llvm -o - %s | FileCheck -check-prefixes CHECK,WITHOUT %s
|
|
// RUN: %clang -target x86_64-linux-gnu -S -emit-llvm -o - %s -fsanitize=memory | FileCheck -check-prefixes CHECK,MSAN %s
|
|
// RUN: %clang -target x86_64-linux-gnu -S -emit-llvm -o - %s -fsanitize=kernel-memory | FileCheck -check-prefixes CHECK,KMSAN %s
|
|
// RUN: %clang -target x86_64-linux-gnu -S -emit-llvm -o - %s -fsanitize=memory -fno-sanitize-memory-param-retval | FileCheck -check-prefixes CHECK,MSAN,RETTLS %s
|
|
|
|
// Instrumented function.
|
|
// MSan uses memset(addr, -1, size) to poison allocas and stores shadow of the return value in
|
|
// __msan_retval_tls. KMSAN uses __msan_poison_alloca() to poison allocas and calls
|
|
// __msan_get_context_state() at function prologue to access the task context struct (including the
|
|
// shadow of the return value).
|
|
//
|
|
// CHECK-LABEL: i32 @instrumented1
|
|
// KMSAN: __msan_get_context_state
|
|
// WITHOUT-NOT: __msan_poison_alloca
|
|
// WITHOUT-NOT: @llvm.memset
|
|
// MSAN: @llvm.memset{{.*}}({{.*}}, i8 -1
|
|
// KMSAN: __msan_poison_alloca
|
|
// WITHOUT-NOT: __msan_retval_tls
|
|
// RETTLS: __msan_retval_tls
|
|
// CHECK: ret i32
|
|
int instrumented1(int *a) {
|
|
volatile char buf[8];
|
|
return *a;
|
|
}
|
|
|
|
// Function with no_sanitize("memory")/no_sanitize("kernel-memory"): no shadow propagation, but
|
|
// unpoisons memory to prevent false positives.
|
|
// MSan uses memset(addr, 0, size) to unpoison locals, KMSAN uses __msan_unpoison_alloca(). Both
|
|
// tools still access the retval shadow to write 0 to it.
|
|
//
|
|
// CHECK-LABEL: i32 @no_false_positives1
|
|
// KMSAN: __msan_get_context_state
|
|
// WITHOUT-NOT: __msan_unpoison_alloca
|
|
// WITHOUT-NOT: @llvm.memset
|
|
// MSAN: @llvm.memset{{.*}}({{.*}}, i8 0
|
|
// KMSAN: __msan_unpoison_alloca
|
|
// WITHOUT-NOT: __msan_retval_tls
|
|
// RETTLS: __msan_retval_tls
|
|
// CHECK: ret i32
|
|
__attribute__((no_sanitize("memory"))) __attribute__((no_sanitize("kernel-memory"))) int no_false_positives1(int *a) {
|
|
volatile char buf[8];
|
|
return *a;
|
|
}
|
|
|
|
// Function with disable_sanitizer_instrumentation: no instrumentation at all.
|
|
//
|
|
// CHECK-LABEL: i32 @no_instrumentation1
|
|
// KMSAN-NOT: __msan_get_context_state
|
|
// WITHOUT-NOT: __msan_poison_alloca
|
|
// WITHOUT-NOT: @llvm.memset
|
|
// MSAN-NOT: @llvm.memset{{.*}}({{.*}}, i8 0
|
|
// KMSAN-NOT: __msan_unpoison_alloca
|
|
// WITHOUT-NOT: __msan_retval_tls
|
|
// MSAN-NOT: __msan_retval_tls
|
|
// CHECK: ret i32
|
|
__attribute__((disable_sanitizer_instrumentation)) int no_instrumentation1(int *a) {
|
|
volatile char buf[8];
|
|
return *a;
|
|
}
|