From: Tejun Heo <tj@kernel.org>
To: Roland McGrath <roland@redhat.com>
Cc: oleg@redhat.com, linux-kernel@vger.kernel.org, rjw@sisk.pl,
jan.kratochvil@redhat.com
Subject: Re: [PATCH 2/4] ptrace: remove the extra wake_up_process() from ptrace_detach()
Date: Fri, 28 Jan 2011 11:59:57 +0100 [thread overview]
Message-ID: <20110128105957.GJ24925@htj.dyndns.org> (raw)
In-Reply-To: <20110128070252.709F8183C1A@magilla.sf.frob.com>
Hello, Roland.
On Thu, Jan 27, 2011 at 11:02:52PM -0800, Roland McGrath wrote:
> > On Mon, Jan 17, 2011 at 02:13:40PM -0800, Roland McGrath wrote:
> > > Of course I agree that the current code is wrong here. But I'm still not
> > > at all clear on what practical compatibility problems it introduces. This
> > > change is OK if and only if we are really making the only area clean and
> > > well-defined in the same release cycle.
> >
> > I don't follow what you meant by the above sentence. Can you please
> > clarify a bit?
>
> I think I meant to write "the whole area" rather than "the only area".
> The point I meant to make is that removing this (wrong) wake-up entirely
> should only be done when we are also thoroughly cleaning up and verifying
> everything about the behavior of stopping/resuming in ptrace. When we get
> to a clear statement of what all the rules are and we really believe that
> the new code matches those rules, then fine. When we are still in the
> quagmire, no change is better than an incremental change whose subtle
> ramifications we can't clearly articulate.
Hmm... I'm not sure I quite agree. We sure should proceed with the
big picture in mind but procedding gradually is usually the better and
sometimes the only way to get there. Unconditional wake up doesn't
belong anywhere no matter which direction we end up taking. It's a
natural step to take.
> > It's slightly more serious than that. Calling wake_up_process()
> > unconditionally can cause a quite serious failure. It wakes up a
> > process in any state and there are code paths which aren't prepared to
> > be woken up unless certain conditions are met.
>
> I understand that. But I don't recall having seen anyone cite an actual
> scenario in the real world where it does something problematic.
I don't think it will be easily seen during regular use. Debugging is
often pretty slow paced and tasks are usually stopped in well known
places. But it does make a pretty decent attack vector for malicious
users. I don't think it will take too much effort to come up with a
proof-of-concept DOS attack exploiting this. It's plain dangerous to
do this no matter how unlikely regular users might hit it.
> > A safer choice can be changing it to wake up only tasks in interruptible
> > sleep.
>
> For ptrace-related purposes, wake_up_state(child, TASK_TRACED|TASK_STOPPED)
> ought to cover anything that it is doing now that anything could reasonably
> be relying on.
That probably is something we need to do for -stable, I agree.
> > I have very difficult time imagining what real user visible
> > implication it would have in negative and noticeable manner, so while
> > I do agree that we should proceed carefully, I think it would be
> > better to take the chance and remove the erratic behavior. We have
> > release cycles and testing at multiple layers after all. If we find
> > out that it breaks something in serious manner, we can always revert.
>
> "Difficult time imagining" and ptrace subtleties unfortunately often go
> together.
But that's the only way forward. Ptrace sure is complicated, some
part due to its inherent nature but more because things were
continuously piled on top of it without proper clean up, but other
parts of kernel are complicated too and we make changes all the time.
We have the whole release cycle structure and testing hierarchies
throughout the ecosystem to enable changes like this.
> I want to be sure we are doing something right, rather than just
> being thoroughly unsure that we aren't doing something wrong.
But this is something which is apparently wrong and highly unlikely to
cause any problem especially because with the patchset an attached
task is always in traced state on detach and thus always gets
signal_wake_up(). The only difference is removal of an extra spurious
unconditional wakeup which may or may not disturb the group stop
depending on timing. If we can't change this, I don't know what we
can.
Thank you.
--
tejun
next prev parent reply other threads:[~2011-01-28 11:00 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-22 11:13 [PATCHSET] ptrace,signal: cleanups and fixes Tejun Heo
2010-12-22 11:13 ` [PATCH 1/4] signal: fix SIGCONT notification code Tejun Heo
2011-01-12 20:41 ` Jan Kratochvil
2011-01-13 11:27 ` Tejun Heo
2011-01-13 14:40 ` Oleg Nesterov
2010-12-22 11:13 ` [PATCH 2/4] ptrace: remove the extra wake_up_process() from ptrace_detach() Tejun Heo
2011-01-17 22:13 ` Roland McGrath
2011-01-27 13:34 ` Tejun Heo
2011-01-28 7:02 ` Roland McGrath
2011-01-28 10:59 ` Tejun Heo [this message]
2010-12-22 11:13 ` [PATCH 3/4] signal: remove superflous try_to_freeze() loop in do_signal_stop() Tejun Heo
2011-01-17 22:10 ` Roland McGrath
2010-12-22 11:13 ` [PATCH 4/4] ptrace: kill tracehook_notify_jctl() Tejun Heo
2011-01-17 22:14 ` Roland McGrath
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=20110128105957.GJ24925@htj.dyndns.org \
--to=tj@kernel.org \
--cc=jan.kratochvil@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@redhat.com \
--cc=rjw@sisk.pl \
--cc=roland@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
all inboxes | Powered by JetHome®