task::finish_emulated_syscall

Kyle Huey me at kylehuey.com
Mon Jan 26 02:31:50 PST 2015


On Mon, Jan 26, 2015 at 2:33 PM, Kyle Huey <me at kylehuey.com> wrote:

>
> On Mon, Jan 26, 2015 at 2:19 PM, Robert O'Callahan <robert at ocallahan.org>
> wrote:
>
>> On Fri, Jan 23, 2015 at 6:03 PM, Kyle Huey <me at kylehuey.com> wrote:
>>
>>> Why is this necessary?
>>>
>>
>> When we resume with a PTRACE_SYSEMU (or PTRACE_SYSEMU_SINGLESTEP) on x86,
>> and we reach a system call, we get a ptrace trap. We need to exit the
>> emulated system call before we set the registers from the trace. We do that
>> by single-stepping in finish_emulated_syscall, but as the comments there
>> describe, it's not trivial since on x86 singlestepping not only exits the
>> syscall but also executes the instruction after it.
>>
>
> Why do we need to exit the syscall before setting the registers?  Does the
> kernel do something weird here?
>

The answer seems to be yes.  On x86 early returning from
finish_emulated_syscall blows up replaying even trivial programs like
/bin/true, while on my ARM branch it appears to work just fine.  I'll have
to poke at it harder.

Thanks for the explanation.

- Kyle
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/rr-dev/attachments/20150126/2d7b20d4/attachment.html>


More information about the rr-dev mailing list