Track growth of MAP_GROWSDOWN segments
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 10.7k
- Forks
- 662
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 2
Description
Followup to #1355. These segments can be automatically grown downward by the kernel when userspace accesses outside the segment bounds. rr gets no notification of this. This is a potentially bad bug if one of these segments actually does grow, and then userspace tries to map or unmap some pages near the stack. rr's stale cache could cause it to misinterpret m{,re,un}map semantics.
One way to handle this is, if there's a m{,re,un}map operation on a memory cell that falls in the range (lower-segment, map-grows-down-segment], then throw out the mmap cache and rebuild it before interpreting the operation. Another option is to always map a guard page just below a MAP_GROWSDOWN segment, and have rr implement the segment auto-growth semantics itself.
Neither of these is exactly trivial, so I'm favor of leaving this alone until it becomes a problem in practice.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading issue #1355 and the rr code that handles mmap, mremap, and munmap operations and maintains the mmap cache. Compare the cache behavior with Linux MAP_GROWSDOWN segment growth and evaluate the two approaches described here. Done means rr correctly interprets mapping operations after a segment grows, with tests covering the affected semantics.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, linux
- Domain
- devtools, operating-systems
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100