[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5374D10A.1060905@redhat.com>
Date: Thu, 15 May 2014 16:36:58 +0200
From: Denys Vlasenko <dvlasenk@...hat.com>
To: Pedro Alves <palves@...hat.com>, Oleg Nesterov <oleg@...hat.com>,
Sergio Durigan Junior <sergiodj@...hat.com>
CC: LKML <linux-kernel@...r.kernel.org>,
Roland McGrath <roland@...k.frob.com>,
Tom Tromey <tromey@...hat.com>,
Jan Kratochvil <jan.kratochvil@...hat.com>,
Tejun Heo <tj@...nel.org>,
Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [RFC/PATCH] Implement new PTRACE_EVENT_SYSCALL_{ENTER,EXIT}
On 05/14/2014 08:49 PM, Pedro Alves wrote:
> I realized now that I responded to this. Sorry about that.
>
> On 01/19/2014 03:29 PM, Oleg Nesterov wrote:
>> On 01/19, Sergio Durigan Junior wrote:
>>>
>>> On Friday, January 10 2014, Oleg Nesterov wrote:
>>>
>>>> So suppose that gdb does ptrace(PTRACE_SINGLESTEP) and the tracee
>>>> executes the "syscall" insn. What it should report?
>>> [...]
>>>> But what should syscall-exit do? Should it still report SIGSEGV as
>>>> it currently does, or should it report _SYSCALL_EXIT instead (if
>>>> PTRACE_O_SYSCALL_EXIT of course), or should it report both?
>>>
>>> Both only if _SYSCALL_EXIT is set. Otherwise, stick to the current
>>> behavior, I guess.
>>
>> OK, both. In which order? Probably _EXIT first. But this looks a bit
>> strange. Suppose that the tracee reports _EXIT, then debugger does
>> ptrace(PTRACE_CONT), should the tracee report SIGTRAP?
>
> Seems to me that this should be very much the same as fork/vfork/clone
> event handling. Those are triggered by a syscall anyway. So, say:
>
> - ptrace(PTRACE_SINGLESTEP)
> - the tracee executes the "syscall" insn, and the syscall is "clone".
> - PTRACE_EVENT_FORK is reported.
> - The debugger does ptrace(PTRACE_CONT).
>
> What should be reported? What is reported now?
Yes, PTRACE_SINGLESTEP looks ambiguous. Just like PTRACE_SYSCALL is.
I think we can take it further and add PTRACE_EVENT_SINGLESTEP too,
like the patches under discussing which add PTRACE_EVENT_SYSCALL_ENTER,EXIT
and therefore do away with the need to use ambiguous PTRACE_SYSCALL.
Such API is clearer (I hope) - as long as option is on,
user wants to get single-stepping SIGTRAPs after each insn,
including syscall insn (in this case, after we return to userspace).
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists