DynamoRIO / DynamoRIO/dynamorio
APP CRASH: app RAX corrupted by signal handler
- Dominant language
- C
- Stars
- 3.2k
- Forks
- 629
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 30
Description
_From [qin.zhao@gmail.com](https://code.google.com/u/qin.zhao@gmail.com/) on October 19, 2010 16:00:33_
On receiving a signal, if a client has a signal handler and returns DR_SIGNAL_REDIRECT, then when calling handle_client_action_from_cache, DR converts signal context into mcontext, and set sigreturn target to be fcache_return_routine. On dynamorio_sigreturn, the control will transfer to the fcache_return_routine.
However, in the fcache_return_routine, the rax value is got from %gs:0x0,
mov %gs:0x0, %rbx
mov %rbx, 0x38(%rdi) (xax in dcontext)
which is not the right value.
A quick fix would add code to set XAX value to %gs:0x0. Any other better solution?
Qin
_Original issue: http://code.google.com/p/dynamorio/issues/detail?id=354_
Contributor guide
Research direction
Trace the signal-redirection path through handle_client_action_from_cache, dynamorio_sigreturn, and fcache_return_routine, focusing on how the RAX value is transferred through the signal context and dcontext. Done means the client’s RAX value is preserved correctly after returning from the signal handler and the reported application crash is eliminated.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100