Don't fill in file holes
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 10.7k
- Forks
- 662
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 2
Description
If an application creates a shared mmap of a file with holes, rr will usually copy the contents of the file to the trace by reading /proc/.../mem. This has the side effect of allocating space to "fill in" the holes, which is observable by applications and also can lead to errors if the file system becomes full.
We could probably avoid this by changing read_bytes_fallible so that for memory regions which are mapped files, instead of reading /proc/.../mem we read from /proc/.../map_files/<addr-range>. We might also need to (or want to) use lseek(..., SEEK_HOLE) to avoid copying holes to the trace.
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 tracing read_bytes_fallible and the handling of memory regions mapped from files. Compare reading /proc/.../mem with /proc/.../map_files/, and investigate whether lseek(..., SEEK_HOLE) is needed. Done means tracing shared mmap files without filling file holes, while avoiding errors when the filesystem is full.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, linux
- Domain
- devtools, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100