Skip to content

fix(mm): saturate offset/page-round arithmetic in mremap/mincore/vma helpers#127

Merged
kernalix7 merged 1 commit into
mainfrom
fix/mm-offset-page-round-overflow
Jun 11, 2026
Merged

fix(mm): saturate offset/page-round arithmetic in mremap/mincore/vma helpers#127
kernalix7 merged 1 commit into
mainfrom
fix/mm-offset-page-round-overflow

Conversation

@kernalix7

Copy link
Copy Markdown
Owner

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 ✓.

…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.
@kernalix7 kernalix7 merged commit b22208e into main Jun 11, 2026
2 checks passed
@kernalix7 kernalix7 deleted the fix/mm-offset-page-round-overflow branch June 11, 2026 02:26
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