[rfa] Handle amd64-linux %orig_rax

Daniel Jacobowitz drow@false.org
Tue Oct 31 19:30:00 GMT 2006


On Tue, Oct 31, 2006 at 08:11:20PM +0100, Andi Kleen wrote:
> 
> > Oh dear.  So if we set registers on the syscall exit path, the
> > kernel/ISA may just eat them.  And we have no reliable way to know
> > whether we're stopped on the syscall exit path.
> 
> If you're single stepping over it you can remember it from
> one instruction before (check if the opcode is SYSCALL or SYSENTER,
> these are unique 2 byte opcodes each)
> 
> If someone sets a breakpoint directly on the return point
> and doesn't single step that wouldn't work, but then you shouldn't care about 
> the previous register state anyways.

This case is usually SIGINT while inside a syscall, e.g. nanosleep. 
That gives us a prompt, and if the user changes $rcx there, we write
into the register - and later it gets overridden.  i.e. we're at the
ptrace_stop call in kernel/signal.c:get_signal_to_deliver.

I'm not quite sure how we're getting into the problem case though?
I'd have guessed we were in sysret_signal and that uses iret.

-- 
Daniel Jacobowitz
CodeSourcery



More information about the Gdb-patches mailing list