Skip to content

nplb: Name an mmap()ed page in PosixPrctlTest.SetVmaAnonName - #13148

Merged
andrewsavage1 merged 1 commit into
youtube:mainfrom
hferreiro:fix-set-vma-anon-name
Oct 6, 2026
Merged

andrewsavage1 merged 1 commit into
youtube:mainfrom
hferreiro:fix-set-vma-anon-name

Conversation

@hferreiro

Copy link
Copy Markdown
Collaborator

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

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
@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor
Context State Description
CI / All Pass ❌ FAIL Some checks failed
CI / android ❌ FAIL Failed
CI / evergreen ✅ PASS Passed
CI / linux ✅ PASS Passed
CI / tvos ✅ PASS Passed
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

🤖 Gemini Suggested Commit Message


starboard: Ensure alignment in VMA naming test

Ensure memory used for VMA naming is page-aligned. The prctl call with
PR_SET_VMA_ANON_NAME requires a page-aligned start address, which
malloc does not guarantee. Using a private anonymous mapping ensures
the test operates on an aligned address and names a mapping it owns
rather than part of the heap. This prevents incorrect EINVAL failures.

Bug: 532068409

💡 Pro Tips for a Better Commit Message:

  1. Influence the Result: Want to change the output? You can write custom prompts or instructions directly in the Pull Request description. The model uses that text to generate the message.
  2. Re-run the Generator: Post a comment with: /generate-commit-message

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
andrewsavage1 merged commit f000d6a into youtube:main Oct 6, 2026
684 of 689 checks passed
@hferreiro
hferreiro deleted the fix-set-vma-anon-name branch October 7, 2026 22:44
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants