Re-enable AddressSanitizer on aarch64 via native arm64 runners#461
Open
aflores-qb wants to merge 1 commit into
Open
Conversation
69703b5 to
05176d3
Compare
The aarch64 Docker images were built and tested under QEMU-user emulation, where the ASan-instrumented binary aborts at startup (CHECK failed: sanitizer_allocator_primary64.h) because QEMU's emulated address space cannot host libasan's fixed 64-bit allocator region. ASan was therefore disabled on arm64 via NO_SANITIZERS=2. Run the arm64 build/test on native ubuntu-24.04-arm runners instead of under QEMU, where ASan initialises normally, and drop arm64 from noasan_fallback_platforms so it builds with ASan again (ubuntu+debian). - publish_docker_matrix_base.yml: route linux/arm64/v8 to a native ubuntu-24.04-arm runner; skip the multiarch/qemu-user-static binfmt registration on that native runner (it is amd64-only and fails with "Exec format error" there, and is unneeded since arm64 containers run natively); lower vm.mmap_rnd_bits to 28 before the arm64 test as cheap CI-only insurance for older base-image libasan. - publish_docker_matrix_all.yml: remove linux/arm64/v8 from noasan_fallback_platforms (ubuntu, debian); narrow the AsanTest canaries to the platforms still under QEMU (armv7, ppc64le). - Makefile: drop the dead -DSANITIZER_CAN_USE_ALLOCATOR64=0 blocks (the define only affects libasan's own build, not the application) and document the real cause and fix.
05176d3 to
b218195
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #311.
Root cause
The aarch64 images are cross-built and then run (
docker runtest step) under QEMU-user emulation. AddressSanitizer aborts at startup there:QEMU's constrained emulated address space can't host libasan's fixed 64-bit allocator region, so the
mmapreturns-ENOMEM(0xfffffffffffffff4 == -12). That failing test is why ASan was disabled on arm64 viaNO_SANITIZERS=2(noasan_fallback_platforms).Side note: the
-DSANITIZER_CAN_USE_ALLOCATOR64=0workaround in theMakefilewas a no-op — that define only takes effect when libasan itself is compiled, not the application (hence the "But this doesn't work!" comment). Those dead blocks are removed.Fix
Build and test aarch64 on native
ubuntu-24.04-armrunners (free for public repos, GA Aug 2025) instead of under QEMU. On real hardware ASan initialises normally, solinux/arm64/v8is dropped fromnoasan_fallback_platformsand ships with ASan again (ubuntu + debian). No ASLR/security tradeoff and no change to what's shipped beyond re-enabling ASan.Changes
linux/arm64/v8toubuntu-24.04-arm(everything else stays on the amd64 runner + QEMU); add a CI-onlysysctl vm.mmap_rnd_bits=28before the arm64 test as cheap insurance in case a base image ever ships a pre-LLVM-17 libasan (GCC ≤13).linux/arm64/v8fromnoasan_fallback_platformsfor ubuntu + debian; narrow the*AsanTestcanaries to the platforms still under QEMU (armv7,ppc64le).SANITIZER_CAN_USE_ALLOCATOR64=0blocks and document the actual cause/fix.armv7andppc64lestay on the QEMU fallback (NO_SANITIZERS=2); the AsanTest canary jobs keep probing them.Notes / validation
ubuntu:latest/debian:latesttoolchains starts fine even atvm.mmap_rnd_bits=32; under QEMU it aborts with the issue's CHECK — consistent with the diagnosis.docker runtest on the native runner (the PR build path loads the image locally and skips push/merge), so the green/red result here directly validates that ASan works on arm64."linux/arm64/v8"tonoasan_fallback_platforms.