Skip to content

fix: enable HWASAN support in the runtime - #14742

Open
eric-wieser wants to merge 2 commits into
leanprover:masterfrom
eric-wieser:hwasan
Open

fix: enable HWASAN support in the runtime#14742
eric-wieser wants to merge 2 commits into
leanprover:masterfrom
eric-wieser:hwasan

Conversation

@eric-wieser

@eric-wieser eric-wieser commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

This PR allows Lean to be built with hwasan.

Lean's pointer packing conflicts with HWASAN allocator tagging on 64-bit machines due to top bit usage.
Previously we just disabled builds altogether in this configuration.
With this PR, we instead disable HWASAN allocator tagging around malloc for Lean objects in the default allocator.
While this limits the usefulness of HWASAN for sanitization of lean itself, it at least means that larger applications that link Lean can still use hwasan on their own logic.

Also enable LSAN utilities when HWASAN is active and update LEAN_PTR_PACKING_SAFE to indicate HWASAN compatibility.

This partially addresses #13113.

vitalybuka and others added 2 commits August 10, 2026 23:28
Lean's pointer packing conflicts with HWASAN allocator tagging on 64-bit machines due to top bit usage.

Disable HWASAN allocator tagging around `malloc` for Lean objects in the default allocator. This allows Lean's pointer packing to coexist with HWASAN.

Also enable LSAN utilities when HWASAN is active and update `LEAN_PTR_PACKING_SAFE` to assume HWASAN compatibility.
@eric-wieser

Copy link
Copy Markdown
Contributor Author

changelog-compiler

@github-actions github-actions Bot added the changelog-compiler Compiler, runtime, and FFI label Aug 10, 2026
@eric-wieser eric-wieser changed the title fix: Enable HWASAN support in the runtime. fix: enable HWASAN support in the runtime Aug 11, 2026
@github-actions github-actions Bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Aug 11, 2026
@mathlib-lean-pr-testing

Copy link
Copy Markdown

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 1d2dde6d64cb3da989bab118f4d386eb55237fe5 --onto 3fc29d37a70f8fd904ebab848557c12383543008. You can force Mathlib CI using the force-mathlib-ci label. (2026-08-11 00:04:31)

@leanprover-bot

Copy link
Copy Markdown
Collaborator

Reference manual CI status:

  • ❗ Reference manual CI will not be attempted unless your PR branches off the nightly-with-manual branch. Try git rebase 1d2dde6d64cb3da989bab118f4d386eb55237fe5 --onto 3fc29d37a70f8fd904ebab848557c12383543008. You can force reference manual CI using the force-manual-ci label. (2026-08-11 00:04:33)

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

Labels

changelog-compiler Compiler, runtime, and FFI toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants