linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Denys Vlasenko <dvlasenk@redhat.com>
To: Pedro Alves <palves@redhat.com>, Oleg Nesterov <oleg@redhat.com>,
	Sergio Durigan Junior <sergiodj@redhat.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Roland McGrath <roland@hack.frob.com>,
	Tom Tromey <tromey@redhat.com>,
	Jan Kratochvil <jan.kratochvil@redhat.com>,
	Tejun Heo <tj@kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [RFC/PATCH] Implement new PTRACE_EVENT_SYSCALL_{ENTER,EXIT}
Date: Thu, 15 May 2014 16:36:58 +0200	[thread overview]
Message-ID: <5374D10A.1060905@redhat.com> (raw)
In-Reply-To: <5373BACB.9090807@redhat.com>

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).

  reply	other threads:[~2014-05-15 14:37 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-06 22:52 [RFC/PATCH] Implement new PTRACE_EVENT_SYSCALL_{ENTER,EXIT} Sergio Durigan Junior
2014-01-07 15:30 ` Oleg Nesterov
2014-01-07 16:37   ` Sergio Durigan Junior
2014-01-07 19:12     ` Oleg Nesterov
2014-01-09 18:49   ` Pedro Alves
2014-01-10 13:58     ` Oleg Nesterov
2014-01-19  2:48       ` Sergio Durigan Junior
2014-01-19 15:29         ` Oleg Nesterov
2014-05-14 18:49           ` Pedro Alves
2014-05-15 14:36             ` Denys Vlasenko [this message]
2014-05-16 10:30               ` Pedro Alves
2014-01-09 21:04   ` Roland McGrath
2014-01-19  2:39     ` Sergio Durigan Junior
2014-01-13 13:35 ` Denys Vlasenko
2014-01-19  2:29   ` Sergio Durigan Junior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5374D10A.1060905@redhat.com \
    --to=dvlasenk@redhat.com \
    --cc=jan.kratochvil@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@redhat.com \
    --cc=palves@redhat.com \
    --cc=roland@hack.frob.com \
    --cc=sergiodj@redhat.com \
    --cc=tj@kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=tromey@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).