All of lore.kernel.org
 help / color / mirror / Atom feed
From: Denys Vlasenko <vda.linux@googlemail.com>
To: Pedro Alves <pedro@codesourcery.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>,
	Oleg Nesterov <oleg@redhat.com>, Tejun Heo <tj@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] Make PTRACE_SEIZE set ptrace options specified in 'data'
Date: Sat, 10 Sep 2011 13:40:16 +0200	[thread overview]
Message-ID: <201109101340.16506.vda.linux@googlemail.com> (raw)
In-Reply-To: <201109101219.30942.pedro@codesourcery.com>

On Saturday 10 September 2011 13:19, Pedro Alves wrote:
> On Friday 09 September 2011 21:03:10, Denys Vlasenko wrote:
> > execve is such a rare syscall the one extra stop on it is not
> > going to be a problem.
> > 
> > > And about not needing to handle the magic unadorned SIGTRAP.
> > > The magic unadorned post-exec SIGTRAP does not have `status & 0xff00'
> > > set, it is not a ptrace event!
> > 
> > What SIGTRAP? With PTRACE_O_TRACEEXEC, there is no SIGTRAP.
> 
> But _without_ PTRACE_O_TRACEEXEC there is.  You've raised its
> existence as justification for needing to be able to set
> options directly on PTRACE_SEIZE.

It was an example. There may be other options with similar
problem of "we want to enable new behavior ASAP, without
waiting fro the first ptrace-stop".

> Point is, if we don't get rid 
> of the SIGTRAP when PTRACE_O_TRACEEXEC is _not_ in effect, then
> _everyone_ will always pass PTRACE_O_TRACEEXEC to SEIZE.

Yes, that's the nature of many options: they are fixing
ptrace quirks, and therefore newer programs which know about
these options will _always_ use them. For example, should we
also unconditionally enable PTRACE_O_TRACESYSGOOD?



> > > If we don't disable the magic SIGTRAP, there's no way for a
> > > tracer to do a very non-invasive SEIZE, say, a GDB mode that
> > > only cares to let the tracer run free to catch SIGSEGVs
> > > in some child, while later on during the run, the user remembers
> > > to set a breakpoint.  At that point the tracer needs to catch
> > > exec events, so it'd enable TRACE_O_EVENTEXEC.  Getting rid of
> > > the SIGTRAP gets rid of the spurious stops when TRACE_O_EVENTEXEC
> > > is not enabled.
> > 
> > This part I don't understand.
> 
> Say, you run the whole of gcc's testsuite under gdb, and
> let it run until one of the children SIGSEGVs.  You do "gdb make; run".
> Currently, all the children stop momentarily for fork/vfork/exec,
> which slows down the run significantly (there are thousands of
> forks/execs).

I doubt about "significantly". fork and exec are heavy syscalls
(they trash entire L1 data cache on today's CPUs), a ptrace stop
on top of that is perhaps 10% slowdown _of the syscall_,
about a few % slowdown overall.


> We should be able to only SEIZE the shell that runs 
> "make" (gdb runs the child through the shell, like "sh -c make"),
> and let all its children run free, the least invasive way possible.

True.

> When a SIGSEGV happens, gdb can sync up about the process that crashed
> from /proc.

It doesn't need to do even that - but probably will, gdb code is said
to be quite complex. I think current code will require auto-attach stops
in forked children anyway (for parent-child accounting and such),
and it will require a serious rewrite to get rid of that requirement.

-- 
vda

  reply	other threads:[~2011-09-10 11:40 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-08 18:22 [PATCH v3] Make PTRACE_SEIZE set ptrace options specified in 'data' Denys Vlasenko
2011-09-08 19:24 ` Oleg Nesterov
2011-09-09 11:12 ` Pedro Alves
2011-09-09 12:28   ` Denys Vlasenko
2011-09-09 13:15     ` Pedro Alves
2011-09-09 16:30       ` Oleg Nesterov
2011-09-09 16:55       ` Denys Vlasenko
2011-09-09 17:09         ` Pedro Alves
2011-09-09 17:18           ` Oleg Nesterov
2011-09-09 20:03           ` Denys Vlasenko
2011-09-10 11:19             ` Pedro Alves
2011-09-10 11:40               ` Denys Vlasenko [this message]
2011-09-10 12:12                 ` Pedro Alves
2011-09-10 15:36                   ` Pedro Alves
2011-09-13  7:45                     ` Indan Zupancic
2011-09-13  8:04                   ` Indan Zupancic
2011-09-10 23:34 ` Tejun Heo

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=201109101340.16506.vda.linux@googlemail.com \
    --to=vda.linux@googlemail.com \
    --cc=dvlasenk@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@redhat.com \
    --cc=pedro@codesourcery.com \
    --cc=tj@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.