Skip to content

Ensure RandomMmapHint never returns address 0 under TSan builds. - #609

Merged
copybara-service[bot] merged 1 commit into
masterfrom
test_973936269
Aug 31, 2026
Merged

Ensure RandomMmapHint never returns address 0 under TSan builds.#609
copybara-service[bot] merged 1 commit into
masterfrom
test_973936269

Conversation

@copybara-service

Copy link
Copy Markdown

Ensure RandomMmapHint never returns address 0 under TSan builds.

In ThreadSanitizer builds, RandomMmapHint recomputes candidate addresses in
a loop bounded by 10 iterations to find an address range reserved for the
application. When tag == MemoryTag::kSampled (tag bits 0), producing 0
left addr == 0 when exiting the loop because there was no addr != 0 check
inside or after the TSan loop.

Wrap the candidate address computation in a do-while loop to guarantee
addr != 0 across all iterations, and assert that addr != 0 before returning.

@copybara-service
copybara-service Bot force-pushed the test_973936269 branch 2 times, most recently from 2a723d2 to 53255ae Compare August 31, 2026 22:57
In ThreadSanitizer builds, RandomMmapHint recomputes candidate addresses in
a loop bounded by 10 iterations to find an address range reserved for the
application. When tag == MemoryTag::kSampled (tag bits 0), producing 0
left addr == 0 when exiting the loop because there was no addr != 0 check
inside or after the TSan loop.

Wrap the candidate address computation in a do-while loop to guarantee
addr != 0 across all iterations, and assert that addr != 0 before returning.

PiperOrigin-RevId: 974141730
@copybara-service
copybara-service Bot merged commit 13adce0 into master Aug 31, 2026
2 checks passed
@copybara-service
copybara-service Bot deleted the test_973936269 branch August 31, 2026 23:33
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