fix(vfs): bound procfs maps VMA loop and seq_file iteration#133
Merged
Conversation
procfs_pid::generate_maps iterated 0..desc.vma_count while indexing a fixed [VmaEntry; MAX_VMA] array; a descriptor reporting more VMAs than MAX_VMA would index out of bounds (siblings fd_count/cmdline_len/ environ_len already clamp with .min()). Clamp the loop to MAX_VMA. seq_file::fill looped while ops.next() yielded Some; a SeqOps whose next() never returns None while show() makes no progress (so the overflow break never fires) would spin forever on a /proc read. Add a hard 1<<20 iteration cap.
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.
Two panic/hang fixes on /proc read paths:
procfs_pid::generate_mapsiterated0..desc.vma_countindexing a fixed[VmaEntry; MAX_VMA]; a descriptor with more VMAs than MAX_VMA indexes OOB. Siblings fd_count/cmdline_len/environ_len already clamp with.min(); clamp the loop to MAX_VMA.seq_file::filllooped whileops.next()yielded Some; a SeqOps whose next() never returns None while show() makes no progress spins forever (the overflow break never fires). Add a hard1<<20iteration cap.