Skip to content

fix(boring-sys): localize allocator hooks on Android - #518

Open
deepso7 wants to merge 1 commit into
cloudflare:v4.xfrom
deepso7:android-local-memory-hooks
Open

fix(boring-sys): localize allocator hooks on Android#518
deepso7 wants to merge 1 commit into
cloudflare:v4.xfrom
deepso7:android-local-memory-hooks

Conversation

@deepso7

@deepso7 deepso7 commented Jul 28, 2026

Copy link
Copy Markdown

Summary

Avoid weak BoringSSL allocator hooks on Android.

BoringSSL exposes OPENSSL_memory_alloc, OPENSSL_memory_free, and
OPENSSL_memory_get_size as weak ELF symbols. When boring-sys is linked
into an Android shared library alongside other native dependencies, these
symbols can be resolved to incompatible process symbols and cause a crash
during BoringSSL initialization.

This change applies an Android-only patch that uses BoringSSL's existing
local null-function-pointer fallback instead. Other platforms retain the
current weak-symbol behavior.

Verification

  • Cross-compiled boring-sys and a downstream UniFFI library for
    aarch64-linux-android.
  • Verified the resulting libcrypto.a reports all three allocator hooks as
    LOCAL OBJECT.
  • Tested endpoint construction in a React Native/Hermes app on a physical
    arm64 Android device.
  • Confirmed BoringSSL initializes successfully without the previous
    SIGSEGV.
  • cargo fmt --all -- --check passes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant