mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Andrew Morton <akpm@linux-foundation.org>,
	Roland McGrath <roland@redhat.com>
Cc: Jan Kratochvil <jan.kratochvil@redhat.com>,
	Denys Vlasenko <dvlasenk@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH for 2.6.30] ptrace: revert "ptrace_detach: the wrong wakeup breaks the ERESTARTxxx logic"
Date: Tue, 2 Jun 2009 22:39:39 +0200	[thread overview]
Message-ID: <20090602203939.GA13939@redhat.com> (raw)
In-Reply-To: <20090602011318.GA2461@redhat.com>

Commit 95a3540da9c81a5987be810e1d9a83640a366bd5 removed the "extra"
wake_up_process() from ptrace_detach(), but as Jan pointed out this breaks
the compatibility.

I believe the changelog is right and this wake_up() is wrong in many ways.
But GDB assumes that ptrace(PTRACE_DETACH, child, 0, 0) always wakes up the
tracee. Despite the fact this breaks SIGNAL_STOP_STOPPED/group_stop_count logic,
and despite the fact this wake_up_process() can break another assumption:
PTRACE_DETACH with SIGSTOP should leave the tracee in TASK_STOPPED case.
Because the untraced child can dequeue SIGSTOP and call do_signal_stop()
before ptrace_detach() calls wake_up_process().

Revert this change for now. We need some fixes even if we we want to keep
the current behaviour, but these fixes are not for 2.6.30.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>

--- a/kernel/ptrace.c
+++ b/kernel/ptrace.c
@@ -304,6 +304,8 @@ int ptrace_detach(struct task_struct *ch
 	if (child->ptrace) {
 		child->exit_code = data;
 		dead = __ptrace_detach(current, child);
+		if (!child->exit_state)
+			wake_up_process(child);
 	}
 	write_unlock_irq(&tasklist_lock);
 


       reply	other threads:[~2009-06-02 20:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20090529103017.D548FFC2BD@magilla.sf.frob.com>
     [not found] ` <20090529125405.GD19812@redhat.com>
     [not found]   ` <20090529143049.GA27424@redhat.com>
     [not found]     ` <20090530202313.GA12066@host0.dyn.jankratochvil.net>
     [not found]       ` <20090530234449.GA31604@redhat.com>
     [not found]         ` <20090601014258.E3EA2FC3C7@magilla.sf.frob.com>
     [not found]           ` <20090602011318.GA2461@redhat.com>
2009-06-02 20:39             ` Oleg Nesterov [this message]
2009-06-02 20:55               ` 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=20090602203939.GA13939@redhat.com \
    --to=oleg@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=dvlasenk@redhat.com \
    --cc=jan.kratochvil@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --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®