From 12c9c93e0960113aecdc73706beff69c7d4fed77 Mon Sep 17 00:00:00 2001 From: Wouter van Oortmerssen Date: Mon, 4 Oct 2021 16:20:48 -0700 Subject: [PATCH] [Memory64] sanitizer header changes for 64-bit --- .../lib/sanitizer_common/sanitizer_platform_limits_posix.h | 3 ++- system/lib/compiler-rt/lib/ubsan/ubsan_flags.cpp | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/system/lib/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h b/system/lib/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h index 769fe36a90f78..27ee8dc70d513 100644 --- a/system/lib/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h +++ b/system/lib/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h @@ -427,7 +427,8 @@ struct __sanitizer_file_handle { }; #endif -#if SANITIZER_MAC +// These fields are not actually pointers, and so wasm64 must use unsigned and not uptr for them +#if SANITIZER_MAC || SANITIZER_EMSCRIPTEN struct __sanitizer_msghdr { void *msg_name; unsigned msg_namelen; diff --git a/system/lib/compiler-rt/lib/ubsan/ubsan_flags.cpp b/system/lib/compiler-rt/lib/ubsan/ubsan_flags.cpp index 48bb217d45695..d5463b1fc8607 100644 --- a/system/lib/compiler-rt/lib/ubsan/ubsan_flags.cpp +++ b/system/lib/compiler-rt/lib/ubsan/ubsan_flags.cpp @@ -75,6 +75,10 @@ void InitializeFlags() { parser.ParseString(__ubsan_default_options()); // Override from environment variable. #if SANITIZER_EMSCRIPTEN +#ifdef __wasm64__ + // FIXME: support UBSAN in wasm64. + abort(); +#else char *options = (char*) EM_ASM_INT({ return withBuiltinMalloc(function () { return allocateUTF8(Module['UBSAN_OPTIONS'] || 0); @@ -82,6 +86,7 @@ void InitializeFlags() { }); parser.ParseString(options); emscripten_builtin_free(options); +#endif #else parser.ParseStringFromEnv("UBSAN_OPTIONS"); #endif // SANITIZER_EMSCRIPTEN