Repository navigation
nplb: Name an mmap()ed page in PosixPrctlTest.SetVmaAnonName - #13148
Merged
Merged
Conversation
PR_SET_VMA_ANON_NAME needs a page-aligned start address and names the whole mapping the range falls in. The test passed a malloc(4096) pointer, which isn't guaranteed to be page aligned, so on platforms where it isn't the call fails with EINVAL and the test is skipped as unsupported. Map a private anonymous page instead, so the address is aligned and the test names a mapping it owns rather than part of the allocator's heap. Bug: 532068409
Contributor
|
Contributor
🤖 Gemini Suggested Commit Message💡 Pro Tips for a Better Commit Message:
|
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates the PosixPrctlTest.SetVmaAnonName test to use page-aligned memory allocated via mmap instead of malloc, which is required for PR_SET_VMA_ANON_NAME to work correctly. It also replaces free with munmap and dynamically queries the page size using sysconf(_SC_PAGESIZE). Feedback was provided to safely handle potential failures from sysconf(_SC_PAGESIZE) by asserting its return value is positive before casting it to size_t, preventing potential out-of-bounds or overflow issues.
andrewsavage1
approved these changes
Oct 6, 2026
briantting
pushed a commit
that referenced
this pull request
Oct 8, 2026
…SetVmaAnonName Refer to original PR: #13148 `PR_SET_VMA_ANON_NAME` needs a page-aligned start address and names the whole mapping the range falls in. The test passed a `malloc(4096)` pointer, which isn't guaranteed to be page aligned, so on platforms where it isn't the call fails with `EINVAL` and the test is skipped as unsupported. Map a private anonymous page instead, so the address is aligned and the test names a mapping it owns rather than part of the allocator's heap. Bug: 532068409 (cherry picked from commit f000d6a)
briantting
pushed a commit
that referenced
this pull request
Oct 16, 2026
…SetVmaAnonName Refer to original PR: #13148 `PR_SET_VMA_ANON_NAME` needs a page-aligned start address and names the whole mapping the range falls in. The test passed a `malloc(4096)` pointer, which isn't guaranteed to be page aligned, so on platforms where it isn't the call fails with `EINVAL` and the test is skipped as unsupported. Map a private anonymous page instead, so the address is aligned and the test names a mapping it owns rather than part of the allocator's heap. Bug: 532068409 (cherry picked from commit f000d6a)
briantting
pushed a commit
that referenced
this pull request
Oct 16, 2026
…SetVmaAnonName Refer to original PR: #13148 `PR_SET_VMA_ANON_NAME` needs a page-aligned start address and names the whole mapping the range falls in. The test passed a `malloc(4096)` pointer, which isn't guaranteed to be page aligned, so on platforms where it isn't the call fails with `EINVAL` and the test is skipped as unsupported. Map a private anonymous page instead, so the address is aligned and the test names a mapping it owns rather than part of the allocator's heap. Bug: 532068409 (cherry picked from commit f000d6a)
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.
PR_SET_VMA_ANON_NAMEneeds a page-aligned start address and names the whole mapping the range falls in. The test passed amalloc(4096)pointer, which isn't guaranteed to be page aligned, so on platforms where it isn't the call fails withEINVALand the test is skipped as unsupported.Map a private anonymous page instead, so the address is aligned and the test names a mapping it owns rather than part of the allocator's heap.
Bug: 532068409