mirror of
https://github.com/apple/swift-crypto
synced 2026-11-23 04:34:21 +00:00
Motivation: BoringSSL and Folly both attempt to play silly buggers with the sdallocx symbol defined in jemalloc. Unfortunately, they don't play nicely together, and the end result if you have both present is that BoringSSL will reliably SIGBUS or SIGSEGV on initialization. Naturally, this isn't good. See also apple/swift-nio-ssl#191. Modifications: - Resolve the issue by patching out BoringSSL's allocator optimisation. - Update BoringSSL to 6432bb46ab44731567ec923e6c8fc182f13d0070. Result: Flow and BoringSSL will play better together.
17 lines
930 B
Diff
17 lines
930 B
Diff
diff --git a/Sources/CCryptoBoringSSL/crypto/mem.c b/Sources/CCryptoBoringSSL/crypto/mem.c
|
|
index b1d165e..0f66bc4 100644
|
|
--- a/Sources/CCryptoBoringSSL/crypto/mem.c
|
|
+++ b/Sources/CCryptoBoringSSL/crypto/mem.c
|
|
@@ -84,7 +84,10 @@ static void __asan_unpoison_memory_region(const void *addr, size_t size) {}
|
|
// Windows doesn't really support weak symbols as of May 2019, and Clang on
|
|
// Windows will emit strong symbols instead. See
|
|
// https://bugs.llvm.org/show_bug.cgi?id=37598
|
|
-#if defined(__GNUC__) || (defined(__clang__) && !defined(_MSC_VER))
|
|
+
|
|
+// Swift Crypto disables this for compatibility with weird libraries. See
|
|
+// https://github.com/apple/swift-nio-ssl/issues/189
|
|
+#if 0
|
|
// sdallocx is a sized |free| function. By passing the size (which we happen to
|
|
// always know in BoringSSL), the malloc implementation can save work. We cannot
|
|
// depend on |sdallocx| being available so we declare a wrapper that falls back
|