reverse-stepping appears to hang forever if no branches occur for a very long time
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 10.7k
- Forks
- 662
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 2
Description
Consider the following:
#include <sys/mman.h>
int
main(int argc, char *argv[])
{
void *p = mmap(0, 0x100000, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
mprotect((char*)p + 0x100000 - 0x1000, 0x1000, PROT_NONE);
__asm__(
"movq %%rax, %0\n"
"jmpq *%%rax" : : "r"(p));
return 0;
}
Running to the inevitable segfault and reverse-stepping takes forever because there is many thousands of instructions between the last tick and the end of the region of zeros that rr tries to PTRACE_SINGLESTEP through. Of course this might be outside the scope of the rr replayer, since instrumentation based replayers will handle this fine, but it'd be nice to fix since bugs like these can happen (in our case the jit wasn't done copying over the generated code on another thread) and are a bit of a reverse-continue trap.
cc @JeffBezanson who hit this issue
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 with the provided mmap/mprotect/jump reproducer and rr's reverse-stepping path, especially the PTRACE_SINGLESTEP loop described in the report. Confirm that the long run of zero-filled instructions causes the delay, then define completion as reverse-stepping no longer taking forever while preserving the expected segfault behavior.
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
- 38/100