fix(mm): saturate offset/page-round arithmetic in mremap/mincore/vma helpers#127
Merged
Merged
Conversation
…helpers Nine unchecked additions on user-derived length/offset values: page round-ups ((x + PAGE_SIZE - 1)) in mincore_ops/mremap_ops, mapping end+extra and new_addr+new_size in mremap_ops, file-offset continuity / split-offset updates in mmap_region, and pgoff+nr_pages in vma_merge. A value near usize::MAX overflows -> ring-0 panic under overflow-checks. Use saturating_add throughout: for the contiguity predicates a saturated end simply reads as non-contiguous (fail-safe), and the split/round paths can no longer panic. All are exported mm helpers not yet reached from a live mmap-family syscall (latent); the wired mmap/mprotect/slab/page_alloc /vmalloc/page_table paths were verified clean.
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.
Nine unchecked user-derived additions (page round-ups, mapping end+extra, new_addr+new_size, file-offset continuity/split updates, pgoff+nr_pages) → saturating_add. Latent (unwired mm helpers; wired mmap/mprotect/slab/page_alloc/vmalloc/page_table verified clean by a Codex mm pass). Gate: clippy -p oncrix-mm ✓ + build ✓ + fmt ✓.