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
70 lines
1.9 KiB
C
70 lines
1.9 KiB
C
// Test that globals from different shared objects all get registered.
|
|
|
|
// This source file is compiled into three different source object files. Each
|
|
// object file declares a global buffer. The first two are linked together, and
|
|
// the third is loaded at runtime. We make sure that out-of-bounds accesses
|
|
// are caught for all three buffers.
|
|
|
|
// RUN: %clang_asan -c -o %t-one.o -DMAIN_FILE %s
|
|
// RUN: %clang_asan -c -o %t-two.o -DSECONDARY_FILE %s
|
|
// RUN: %clang_asan -o %t %t-one.o %t-two.o %libdl
|
|
// RUN: %clang_asan -o %t-dynamic.so -shared -fPIC -DSHARED_LIBRARY_FILE %s
|
|
// RUN: not %run %t 1 2>&1 | FileCheck --check-prefix ASAN-CHECK-1 %s
|
|
// RUN: not %run %t 2 2>&1 | FileCheck --check-prefix ASAN-CHECK-2 %s
|
|
// RUN: not %run %t 3 2>&1 | FileCheck --check-prefix ASAN-CHECK-3 %s
|
|
|
|
#if MAIN_FILE
|
|
|
|
#include <dlfcn.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
extern char buffer1[1];
|
|
extern char buffer2[1];
|
|
char buffer1[1] = { 0 };
|
|
|
|
int main(int argc, char *argv[]) {
|
|
int n = atoi(argv[1]);
|
|
if (n == 1) {
|
|
buffer1[argc] = 0;
|
|
// ASAN-CHECK-1: {{0x.* is located 1 bytes .* 'buffer1'}}
|
|
} else if (n == 2) {
|
|
buffer2[argc] = 0;
|
|
// ASAN-CHECK-2: {{0x.* is located 1 bytes .* 'buffer2'}}
|
|
} else if (n == 3) {
|
|
char *libsuffix = "-dynamic.so";
|
|
char *libpath = malloc(strlen(argv[0]) + strlen(libsuffix) + 1);
|
|
sprintf(libpath, "%s%s", argv[0], libsuffix);
|
|
|
|
void *handle = dlopen(libpath, RTLD_NOW);
|
|
if (!handle) {
|
|
fprintf(stderr, "dlopen: %s\n", dlerror());
|
|
return 1;
|
|
}
|
|
|
|
char *buffer = (char *)dlsym(handle, "buffer3");
|
|
if (!buffer) {
|
|
fprintf(stderr, "dlsym: %s\n", dlerror());
|
|
return 1;
|
|
}
|
|
|
|
buffer[argc] = 0;
|
|
// ASAN-CHECK-3: {{0x.* is located 1 bytes .* 'buffer3'}}
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
#elif SECONDARY_FILE
|
|
|
|
extern char buffer2[1];
|
|
char buffer2[1] = { 0 };
|
|
|
|
#elif SHARED_LIBRARY_FILE
|
|
|
|
extern char buffer3[1];
|
|
char buffer3[1] = { 0 };
|
|
|
|
#endif
|