Isomalloc: fix macOS 26+ segfaults - #3996
Merged
Merged
Conversation
bad_location() probed candidate addresses with mmap(..., MAP_FIXED), which silently replaces whatever is mapped there. On macOS 26 the system allocator's zones lie in the range that find_largest_free_region() probes, so the probe unmapped live heap memory and every Charm++ program crashed a few percent of the time. Add call_mmap_probe(), which never replaces an existing mapping: MAP_FIXED_NOREPLACE on Linux, MAP_FIXED | MAP_EXCL on FreeBSD, and a hint-only mmap elsewhere. bad_location() unmaps whatever the probe returned and treats a returned address that differs from the hint as "in use". Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
ritvikrao
self-requested a review
September 29, 2026 14:45
ritvikrao
approved these changes
Sep 29, 2026
adityapb
approved these changes
Sep 29, 2026
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.
Fixes #3995. This fix was suggested by Claude. I don't have enough experience with this part of the code to properly review it, but it did fix the random segfaults that I was encountering on macOS, so I thought I'd at least show you the potential fix. Please feel free to either merge it, merge it with changes, or discard this PR.