From: Tejun Heo <tj@kernel.org>
To: Oleg Nesterov <oleg@redhat.com>
Cc: jan.kratochvil@redhat.com, vda.linux@googlemail.com,
linux-kernel@vger.kernel.org, torvalds@linux-foundation.org,
akpm@linux-foundation.org, indan@nul.nu,
Tony Luck <tony.luck@intel.com>,
Fenghua Yu <fenghua.yu@intel.com>,
Ralf Baechle <ralf@linux-mips.org>,
Kyle McMartin <kyle@mcmartin.ca>, Helge Deller <deller@gmx.de>,
"James E.J. Bottomley" <jejb@parisc-linux.org>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Paul Mackerras <paulus@samba.org>,
Martin Schwidefsky <schwidefsky@de.ibm.com>,
Heiko Carstens <heiko.carstens@de.ibm.com>,
"David S. Miller" <davem@davemloft.net>,
Chris Metcalf <cmetcalf@tilera.com>,
x86@kernel.org
Subject: Re: [PATCH 06/11] ptrace: make group stop state visible via PTRACE_GETSIGINFO
Date: Thu, 12 May 2011 19:15:53 +0200 [thread overview]
Message-ID: <20110512171553.GM1030@htj.dyndns.org> (raw)
In-Reply-To: <20110512164745.GA20215@redhat.com>
Hello,
On Thu, May 12, 2011 at 06:47:45PM +0200, Oleg Nesterov wrote:
> On 05/11, Tejun Heo wrote:
> >
> > On Tue, May 10, 2011 at 06:55:45PM +0200, Oleg Nesterov wrote:
> > > IOW, if the tracee reports via ptrace_notify*, the tracee can look at
> > > si_pt_flags == stop-in-effect. If the tracer reports a signal, the
> > > tracer obviously lacks this info, hmm.
> >
> > Which indicates tracee is in group stop trap.
>
> What do you mean?
I meant that whether group stop is in effect or not can be determined
reliably in most cases. The only exception is signal delivery trap as
siginfo there isn't from trap but I think we can survive that.
> si_pt_flags doesn't "exist" when the tracee reports the signal or
> CLD_STOPPED. This doesn't look clean.
Sure, it ain't clean. Fully agreed.
> > I don't know. PTRACE_GETSIGINFO seemed to already fit the bill and I
> > want to avoid introducing a new request if at all possible. It sure
> > is a bit quirky but doesn't compromisea functionality.
>
> I am not sure too, but the new request is much simpler to use, and it
> is more extensible. We can report more info. Say, the state of
> JOBCTL_STOP_CONSUME or something else.
Functionality-wise, I don't think GETSIGINFO is worse. We can add
more flags and fields there too. It sure is cumbersome to use because
the information isn't there for signal delivery and group stop traps;
however, both aren't critical. Debugger can simply force INTERRUPT
trap and get it there.
> > This was quick hack. Proper test would look like,
> >
> > si.si_code && (si.si_pt_flags & PTRACE_SI_STOPPED)
>
> This doesn't look right too? How can we know we can trust si_pt_flags?
> This needs some YES_YOU_CAN_CHECK_si_pt_flags(si_code), but I can't
> understand what it should do right now...
Ah, okay, you were asking how to tell si has the SIGTRAP info. IIUC,
si_code is non-zero iff the information is generated from kernel so
testing lower bits against SIGTRAP should be good enough. It can't
happen by user generated signals. The only way to side step that
would be using PTRACE_SETSIGINFO - but that's the debugger shooting
its own foot. I don't feel particularly sympathetic.
> > > We have more and more "group_stop_count || SIGNAL_STOP_STOPPED" checks,
> > > perhaps we should make a helper. Or at least invent the short name to
> > > denote the group-stopped-or-in-progress to simplify the discussions ;)
> >
> > Yeah, how about group_stop_in_effect()?
>
> Or may me signal_stop_stopped(struct signal_struct *sig), like
> signal_group_exit/SIGNAL_GROUP_EXIT. But I am fine with
> group_stop_in_effect, probably it is more explanatorily.
Given that stop might be in progress (not complete yet), I think a
name which clearly notes that is preferable. signal_stpo_stopped()
sounds like it's already stopped.
> > * I think we better block PTRACE_SETSIGINFO for non signal delivery
> > traps. It doesn't make any sense. Let's just fail that with
> > -EINVAL if PT_SEIZED.
>
> Oh I agree, it does not make any sense. Should we change the current
> behaviour for PT_SEIZED? I don't really care, this looks minor.
Hmmm... I don't wanna change PTRACE_ATTACH behavior unless necessary.
The pt_flags part isn't even reported if ATTACHed.
> > * I don't think PTRACE_GETSIGINFO returning volatile information to be
> > problematic. The information is generated on the fly on trap
> > anyway.
>
> Yes. And I'd understand if si_pt_flags was filled by the tracee
> during the trap (although I do not think this makes sense) to record
> the state at the time of this trap.
>
> But PTRACE_GETSIGINFO returns the dynamic info which reflects the
> process-wide state at the time of syscall.
Hmmm... Well, if we're gonna introduce a new request, it's gonna have
to be able to replace PTRACE_GETSIGINFO. I don't wanna ask userland
to make two ptrace requests on each trap to tell what's going on.
Another point is that most programs would have to support pre-SEIZE
behavior as well so I'd like to avoid deviating the interface too much
if possible.
If you combine the two, we basically end up something which carries
both siginfo and something else at one go. Its semantics can
definitely be made prettier, I agree, but I'm not sure whether the
benefits would be enough to justify a new request. Maybe it would be.
If you can propose something sane, it would be awesome.
Thanks.
--
tejun
next prev parent reply other threads:[~2011-05-12 17:16 UTC|newest]
Thread overview: 115+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-08 15:48 [PATCHSET ptrace] ptrace: implement PTRACE_SEIZE/INTERRUPT and group stop notification Tejun Heo
2011-05-08 15:48 ` [PATCH 01/11] job control: rename signal->group_stop and flags to jobctl and rearrange flags Tejun Heo
2011-05-08 15:48 ` [PATCH 02/11] ptrace: implement PTRACE_SEIZE Tejun Heo
2011-05-09 16:18 ` Oleg Nesterov
2011-05-10 9:46 ` Tejun Heo
2011-05-10 13:20 ` Oleg Nesterov
2011-05-10 13:47 ` Tejun Heo
2011-05-10 18:19 ` Oleg Nesterov
2011-05-15 15:56 ` PTRACE_SEIZE should not stop [Re: [PATCH 02/11] ptrace: implement PTRACE_SEIZE] Jan Kratochvil
2011-05-15 16:26 ` Tejun Heo
2011-05-15 17:15 ` Jan Kratochvil
2011-05-15 17:25 ` Tejun Heo
2011-05-15 19:48 ` Jan Kratochvil
2011-05-16 8:31 ` Tejun Heo
2011-05-16 12:26 ` Jan Kratochvil
2011-05-16 12:42 ` Tejun Heo
2011-05-16 13:03 ` Jan Kratochvil
2011-05-16 13:51 ` Tejun Heo
2011-05-16 13:21 ` Jan Kratochvil
2011-05-16 13:45 ` Tejun Heo
2011-05-16 13:48 ` Jan Kratochvil
2011-05-16 13:54 ` Tejun Heo
2011-05-08 15:48 ` [PATCH 03/11] ptrace: ptrace_check_attach(): rename @kill to @ignore_state and add comments Tejun Heo
2011-05-08 15:48 ` [PATCH 04/11] ptrace: implement PTRACE_INTERRUPT Tejun Heo
2011-05-08 21:58 ` Denys Vlasenko
2011-05-09 10:09 ` Tejun Heo
2011-05-09 10:55 ` Denys Vlasenko
2011-05-09 16:58 ` Oleg Nesterov
2011-05-10 9:50 ` Tejun Heo
2011-05-10 14:06 ` Oleg Nesterov
2011-05-10 14:20 ` Tejun Heo
2011-05-10 18:08 ` Oleg Nesterov
2011-05-11 8:29 ` Tejun Heo
2011-05-12 17:06 ` Oleg Nesterov
2011-05-12 17:21 ` Tejun Heo
2011-05-10 21:59 ` Denys Vlasenko
2011-05-11 9:19 ` Tejun Heo
2011-05-11 12:23 ` Denys Vlasenko
2011-05-11 13:22 ` Tejun Heo
2011-05-11 16:20 ` Bryan Donlan
2011-05-11 19:24 ` Tejun Heo
2011-05-15 16:10 ` PTRACE_DETACH without stop [Re: [PATCH 04/11] ptrace: implement PTRACE_INTERRUPT] Jan Kratochvil
2011-05-15 16:35 ` Tejun Heo
2011-05-15 17:39 ` Jan Kratochvil
2011-05-16 9:01 ` Tejun Heo
2011-05-16 12:08 ` Jan Kratochvil
2011-05-16 12:24 ` Tejun Heo
2011-05-08 15:48 ` [PATCH 05/11] ptrace: restructure ptrace_getsiginfo() Tejun Heo
2011-05-08 15:49 ` [PATCH 06/11] ptrace: make group stop state visible via PTRACE_GETSIGINFO Tejun Heo
2011-05-10 16:55 ` Oleg Nesterov
2011-05-10 17:11 ` Oleg Nesterov
2011-05-11 8:08 ` Tejun Heo
2011-05-12 16:47 ` Oleg Nesterov
2011-05-12 17:15 ` Tejun Heo [this message]
2011-05-08 15:49 ` [PATCH 07/11] ptrace: add JOBCTL_TRAPPED Tejun Heo
2011-05-08 15:49 ` [PATCH 08/11] ptrace: move fallback JOBCTL_TRAPPING clearing to get_signal_to_deliver() Tejun Heo
2011-05-11 15:48 ` Oleg Nesterov
2011-05-11 19:17 ` Tejun Heo
2011-05-12 15:40 ` Oleg Nesterov
2011-05-08 15:49 ` [PATCH 09/11] job control: reorganize wait_task_stopped() Tejun Heo
2011-05-11 15:48 ` Oleg Nesterov
2011-05-11 19:29 ` Tejun Heo
2011-05-12 15:42 ` Oleg Nesterov
2011-05-12 16:02 ` Tejun Heo
2011-05-12 17:25 ` Oleg Nesterov
2011-05-12 17:32 ` Tejun Heo
2011-05-12 17:33 ` Tejun Heo
2011-05-12 18:33 ` Oleg Nesterov
2011-05-13 8:46 ` Tejun Heo
2011-05-13 17:21 ` Oleg Nesterov
2011-05-14 10:56 ` Tejun Heo
2011-05-15 14:40 ` waitpid(WNOHANG) should report SIGCHLD-notified signals [Re: [PATCH 09/11] job control: reorganize wait_task_stopped()] Jan Kratochvil
2011-05-15 16:47 ` Tejun Heo
2011-05-15 17:01 ` Tejun Heo
2011-05-15 17:47 ` Jan Kratochvil
2011-05-16 9:13 ` Tejun Heo
2011-05-16 12:11 ` Jan Kratochvil
2011-05-16 12:27 ` Tejun Heo
2011-05-16 12:39 ` Jan Kratochvil
2011-05-16 12:46 ` Tejun Heo
2011-05-08 15:49 ` [PATCH 10/11] ptrace: move JOBCTL_TRAPPING wait to wait(2) and ptrace_check_attach() Tejun Heo
2011-05-11 16:49 ` Oleg Nesterov
2011-05-11 17:00 ` Oleg Nesterov
2011-05-11 19:45 ` Tejun Heo
2011-05-11 19:53 ` Tejun Heo
2011-05-12 10:23 ` Tejun Heo
2011-05-12 16:06 ` Oleg Nesterov
2011-05-12 15:59 ` Oleg Nesterov
2011-05-12 16:07 ` Tejun Heo
2011-05-12 18:20 ` Oleg Nesterov
2011-05-13 9:13 ` Tejun Heo
2011-05-13 18:34 ` Oleg Nesterov
2011-05-08 15:49 ` [PATCH 11/11] ptrace: implement group stop notification for ptracer Tejun Heo
2011-05-08 22:42 ` Denys Vlasenko
2011-05-09 10:10 ` Tejun Heo
2011-05-10 22:37 ` Denys Vlasenko
2011-05-11 9:05 ` Tejun Heo
2011-05-11 12:01 ` Denys Vlasenko
2011-05-11 13:13 ` Tejun Heo
2011-05-11 19:58 ` Oleg Nesterov
2011-05-11 20:18 ` Tejun Heo
2011-05-11 20:21 ` Tejun Heo
2011-05-12 10:24 ` Tejun Heo
2011-05-15 14:02 ` getter PTRACE_GETSIGINFO should not modify anything [Re: [PATCH 11/11] ptrace: implement group stop notification for ptracer] Jan Kratochvil
2011-05-15 14:28 ` Tejun Heo
2011-05-15 17:17 ` Jan Kratochvil
2011-05-15 17:28 ` Tejun Heo
2011-05-15 20:06 ` Jan Kratochvil
2011-05-16 8:43 ` Tejun Heo
2011-05-16 12:17 ` Jan Kratochvil
2011-05-16 12:56 ` Tejun Heo
2011-05-16 13:00 ` Ingo Molnar
2011-05-08 22:27 ` [PATCHSET ptrace] ptrace: implement PTRACE_SEIZE/INTERRUPT and group stop notification Denys Vlasenko
2011-05-09 9:48 ` Tejun Heo
2011-05-15 13:55 ` ptrace-testsuite status [Re: [PATCHSET ptrace] ptrace: implement PTRACE_SEIZE/INTERRUPT and group stop notification] Jan Kratochvil
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=20110512171553.GM1030@htj.dyndns.org \
--to=tj@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=benh@kernel.crashing.org \
--cc=cmetcalf@tilera.com \
--cc=davem@davemloft.net \
--cc=deller@gmx.de \
--cc=fenghua.yu@intel.com \
--cc=heiko.carstens@de.ibm.com \
--cc=indan@nul.nu \
--cc=jan.kratochvil@redhat.com \
--cc=jejb@parisc-linux.org \
--cc=kyle@mcmartin.ca \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@redhat.com \
--cc=paulus@samba.org \
--cc=ralf@linux-mips.org \
--cc=schwidefsky@de.ibm.com \
--cc=tony.luck@intel.com \
--cc=torvalds@linux-foundation.org \
--cc=vda.linux@googlemail.com \
--cc=x86@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 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).