Skip to content

Use MADV_GUARD_INSTALL and MADV_GUARD_REMOVE in GuardedPageAllocator. - #1011

Draft
copybara-service[bot] wants to merge 1 commit into
masterfrom
test_983950148
Draft

copybara-service[bot] wants to merge 1 commit into
masterfrom
test_983950148

Conversation

@copybara-service

Copy link
Copy Markdown

Use MADV_GUARD_INSTALL and MADV_GUARD_REMOVE in GuardedPageAllocator.

MADV_GUARD_INSTALL and MADV_GUARD_REMOVE (Linux 6.13+) install and remove lightweight guard PTE markers under mmap_read_lock without splitting or merging VMAs, while MADV_GUARD_INSTALL also zaps physical pages on deallocation. Probe for support in GuardedPageAllocator::MapPages while the region is PROT_NONE before transitioning the VMA once to PROT_READ | PROT_WRITE, falling back to per-page mprotect on older kernels or when TCMALLOC_INTERNAL_LEGACY_LOCKING is defined.

@copybara-service
copybara-service Bot force-pushed the test_983950148 branch 2 times, most recently from a755e2c to f23bcff Compare September 20, 2026 15:16
`MADV_GUARD_INSTALL` and `MADV_GUARD_REMOVE` (Linux 6.13+) install and remove lightweight guard PTE markers under `mmap_read_lock` without splitting or merging VMAs, while `MADV_GUARD_INSTALL` also zaps physical pages on deallocation. Probe for support in `GuardedPageAllocator::MapPages` while the region is `PROT_NONE` before transitioning the VMA once to `PROT_READ | PROT_WRITE`, falling back to per-page `mprotect` on older kernels or when `TCMALLOC_INTERNAL_LEGACY_LOCKING` is defined.

PiperOrigin-RevId: 983950148
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