From: Oleg Nesterov <oleg@redhat.com>
To: Tejun Heo <tj@kernel.org>
Cc: vda.linux@googlemail.com, jan.kratochvil@redhat.com,
linux-kernel@vger.kernel.org, torvalds@linux-foundation.org,
akpm@linux-foundation.org, indan@nul.nu, bdonlan@gmail.com,
pedro@codesourcery.com
Subject: Re: [PATCH 4/5] ptrace: implement TRAP_NOTIFY and use it for group stop events
Date: Fri, 17 Jun 2011 20:31:18 +0200 [thread overview]
Message-ID: <20110617183118.GA8375@redhat.com> (raw)
In-Reply-To: <20110617151236.GI2611@htj.dyndns.org>
On 06/17, Tejun Heo wrote:
>
> Hello, Oleg.
>
> On Thu, Jun 16, 2011 at 09:51:38PM +0200, Oleg Nesterov wrote:
> > I already applied this series. But somehow I have the fuzzy feeling we
> > can simplify JOBCTL_TRAP_NOTIFY/JOBCTL_TRAP_STOP logic later. No, I can't
> > explain what I mean ;)
>
> Heh, yeah, please go ahead.
>
> > One question,
> >
> > > @@ -1797,8 +1824,10 @@ static void ptrace_stop(int exit_code, int why, int clear_code, siginfo_t *info)
> > > if (why == CLD_STOPPED && (current->jobctl & JOBCTL_STOP_PENDING))
> > > gstop_done = task_participate_group_stop(current);
> > >
> > > - /* any trap clears pending STOP trap */
> > > + /* any trap clears pending STOP trap, STOP trap clears NOTIFY */
> > > task_clear_jobctl_pending(current, JOBCTL_TRAP_STOP);
> > > + if (info && info->si_code >> 8 == PTRACE_EVENT_STOP)
> > > + task_clear_jobctl_pending(current, JOBCTL_TRAP_NOTIFY);
> >
> > OK, but can't we check why == CLD_STOPPED instead of PTRACE_EVENT_STOP?
>
> Yeap, sure. The reason why I used PTRACE_EVENT_STOP was because
> PTRACE_LISTEN needs the same test and it doesn't have access to @why.
> Maybe it's better to create ptrace_is_trap_stop(si)?
Sure, PTRACE_EVENT_STOP have to look at info (although we could add
another JOBCTL_ bit). But since ptrace_stop() checks CLD_STOPPED anyway
we could do
if (why == CLD_STOPPED) {
if (current->jobctl & JOBCTL_STOP_PENDING)
gstop_done = task_participate_group_stop(current);
task_clear_jobctl_pending(current, JOBCTL_TRAP_NOTIFY);
}
as a microcleanup. OK, please forget, this is minor.
> > In fact, can't we move all code above under 'if (why == CLD_STOPPED)' ?
> > JOBCTL_TRAP_STOP can't be set otherwise, no? I am almost sure I missed
> > something though.
>
> JOBCTL_TRAP_STOP should also be cleared on CLD_TRAPPED traps.
Yes, this is clear
> ie. If
> the ptracer does PTRACE_INTERRUPT
Ah, indeed, I forgot about PTRACE_INTERRUPT. Thanks.
Oleg.
next prev parent reply other threads:[~2011-06-17 18:33 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-14 9:20 [PATCHSET ptrace] ptrace: implement PTRACE_SEIZE/INTERRUPT and group stop notification, take#5 Tejun Heo
2011-06-14 9:20 ` [PATCH 1/5] job control: introduce JOBCTL_TRAP_STOP and use it for group stop trap Tejun Heo
2011-06-14 9:20 ` [PATCH 2/5] ptrace: implement PTRACE_SEIZE Tejun Heo
2011-06-18 7:55 ` Denys Vlasenko
2011-06-18 7:59 ` Denys Vlasenko
2011-06-18 8:35 ` Tejun Heo
2011-06-18 8:57 ` Denys Vlasenko
2011-06-18 9:04 ` Tejun Heo
2011-06-18 8:30 ` Tejun Heo
2011-06-18 8:58 ` Denys Vlasenko
2011-06-14 9:20 ` [PATCH 3/5] ptrace: implement PTRACE_INTERRUPT Tejun Heo
2011-06-14 9:20 ` [PATCH 4/5] ptrace: implement TRAP_NOTIFY and use it for group stop events Tejun Heo
2011-06-16 19:51 ` Oleg Nesterov
2011-06-17 15:12 ` Tejun Heo
2011-06-17 18:31 ` Oleg Nesterov [this message]
2011-06-14 9:20 ` [PATCH 5/5] ptrace: implement PTRACE_LISTEN Tejun Heo
2011-09-23 11:17 ` Matt Fleming
2011-09-23 12:26 ` Oleg Nesterov
2011-06-16 19:44 ` [PATCHSET ptrace] ptrace: implement PTRACE_SEIZE/INTERRUPT and group stop notification, take#5 Oleg Nesterov
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=20110617183118.GA8375@redhat.com \
--to=oleg@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=bdonlan@gmail.com \
--cc=indan@nul.nu \
--cc=jan.kratochvil@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pedro@codesourcery.com \
--cc=tj@kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=vda.linux@googlemail.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 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.