Author: Vitaly Buka Date: 2025-01-13T11:53:16+01:00 New Revision: 8ef2858421dbea9d80ce62679bc7095f6d76898a
URL: https://github.com/llvm/llvm-project/commit/8ef2858421dbea9d80ce62679bc7095f6d76898a DIFF: https://github.com/llvm/llvm-project/commit/8ef2858421dbea9d80ce62679bc7095f6d76898a.diff LOG: [NFC][sanitizer] Commit test for #106912 (#108289) Almost all sanitizers already support the test. * Tsan does not use DlsymAlloc yet. * Lsan will support with #106912. memprof,rtsan,nsan are not tested as part of sanitizer_common, but we should keep them here to show up when it happen. --------- Co-authored-by: Xiaofeng Tian <110771974+txf...@users.noreply.github.com> (cherry picked from commit 1797174ea6adab08474658f9c9748991d172321c) Added: compiler-rt/test/sanitizer_common/TestCases/dlsym_alloc.c Modified: Removed: ################################################################################ diff --git a/compiler-rt/test/sanitizer_common/TestCases/dlsym_alloc.c b/compiler-rt/test/sanitizer_common/TestCases/dlsym_alloc.c new file mode 100644 index 00000000000000..3905ac40ae2dc7 --- /dev/null +++ b/compiler-rt/test/sanitizer_common/TestCases/dlsym_alloc.c @@ -0,0 +1,61 @@ +// RUN: %clang -O0 %s -o %t && %run %t + +// FIXME: TSAN does not use DlsymAlloc. +// UNSUPPORTED: tsan + +// FIXME: https://github.com/llvm/llvm-project/pull/106912 +// XFAIL: lsan + +#include <stdlib.h> + +const char *test() __attribute__((disable_sanitizer_instrumentation)) { + void *volatile p = malloc(3); + p = realloc(p, 7); + free(p); + + p = calloc(3, 7); + free(p); + + free(NULL); + + return ""; +} + +const char *__asan_default_options() + __attribute__((disable_sanitizer_instrumentation)) { + return test(); +} +const char *__hwasan_default_options() + __attribute__((disable_sanitizer_instrumentation)) { + return test(); +} +const char *__lsan_default_options() + __attribute__((disable_sanitizer_instrumentation)) { + return test(); +} +const char *__memprof_default_options() + __attribute__((disable_sanitizer_instrumentation)) { + return test(); +} +const char *__msan_default_options() + __attribute__((disable_sanitizer_instrumentation)) { + return test(); +} +const char *__nsan_default_options() + __attribute__((disable_sanitizer_instrumentation)) { + return test(); +} +const char *__rtsan_default_options() + __attribute__((disable_sanitizer_instrumentation)) { + return test(); +} +const char *__tsan_default_options() + __attribute__((disable_sanitizer_instrumentation)) { + return test(); +} +const char *__ubsan_default_options() + __attribute__((disable_sanitizer_instrumentation)) { + return test(); +} + +int main(int argc, char **argv) { return 0; } _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits