From 28a09f695973f99d784cc344fcac6289452a2240 Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Fri, 17 Nov 2023 13:08:58 -0800 Subject: [PATCH] Fix asan.test_asyncify_longjmp (#20740) This test started failing after the compiler-rt upgrade because we started depending on the `getrlimit` syscall, and this test builds in `-sSTRICT` mode which disables `ALLOW_UNIMPLEMENTED_SYSCALLS` which means stub syscalls are not included. --- .circleci/config.yml | 1 + system/lib/compiler-rt/lib/asan/asan_rtl.cpp | 2 ++ .../lib/sanitizer_common/sanitizer_posix_libcdep.cpp | 2 ++ 3 files changed, 5 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 861e54716016..76f265cc9cfd 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -520,6 +520,7 @@ jobs: asan.test_cubescript asan.test_wasm_worker_hello asan.test_externref_emjs_dynlink + asan.test_asyncify_longjmp lsan.test_stdio_locking lsan.test_dlfcn_basic lsan.test_pthread_create" diff --git a/system/lib/compiler-rt/lib/asan/asan_rtl.cpp b/system/lib/compiler-rt/lib/asan/asan_rtl.cpp index d77b27bc336e..fb9dab47eb6b 100644 --- a/system/lib/compiler-rt/lib/asan/asan_rtl.cpp +++ b/system/lib/compiler-rt/lib/asan/asan_rtl.cpp @@ -447,7 +447,9 @@ static void AsanInitInternal() { ReplaceSystemMalloc(); +#if !SANITIZER_EMSCRIPTEN DisableCoreDumperIfNecessary(); +#endif InitializeShadowMemory(); diff --git a/system/lib/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp b/system/lib/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp index 2c34bcbc8bf0..b780f57279b7 100644 --- a/system/lib/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp +++ b/system/lib/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp @@ -83,6 +83,7 @@ bool DontDumpShadowMemory(uptr addr, uptr length) { #endif // MADV_DONTDUMP } +#if !SANITIZER_EMSCRIPTEN static rlim_t getlim(int res) { rlimit rlim; CHECK_EQ(0, getrlimit(res, &rlim)); @@ -127,6 +128,7 @@ void SetAddressSpaceUnlimited() { setlim(RLIMIT_AS, RLIM_INFINITY); CHECK(AddressSpaceIsUnlimited()); } +#endif void Abort() { #if !SANITIZER_GO