From: vic <zandy@cs.wisc.edu>
To: linux-kernel@vger.kernel.org
Cc: "Mike Coleman" <mkc+dated+1012446540.067c74@mathdogs.com>,
marcelo@conectiva.com.br, torvalds@transmeta.com,
alan@lxorguk.ukuu.org.uk, hirofumi@mail.parknet.co.jp
Subject: Re: [PATCH] ptrace on stopped processes (2.4)
Date: Mon, 18 Mar 2002 21:59:51 -0600 [thread overview]
Message-ID: <m3zo15jjgo.fsf@localhost.localdomain> (raw)
In-Reply-To: <m3adwc9woz.fsf@localhost.localdomain> <87g0632lzw.fsf@mathdogs.com> <m3advcq5jv.fsf@localhost.localdomain> <87665wbdtf.fsf@mathdogs.com> <m3g04qz0yf.fsf@localhost.localdomain>
This is a repost of the ptrace patch to 2.4 kernels
we've discussed in recent months.
Since the last post, I have updated it to linux 2.4.18
(no changes) and tested it with subterfuge and uml.
Subterfuge seems to be unaffected.
UML needs minor modifications; I've discussed them with
Jeff Dike and (I believe) he is happy.
I believe I have addressed everyone's concerns.
The patch fixes these two bugs:
1. gdb and other tools cannot attach to a stopped
process. The wait that follows the PTRACE_ATTACH
will block indefinitely.
2. It is not possible to use PTRACE_DETACH to leave
a process stopped, because ptrace ignores SIGSTOPs
sent by the tracing process.
Vic
--- /home/vic/p/linux-2.4.18.orig/kernel/ptrace.c Wed Mar 13 13:14:54 2002
+++ /home/vic/p/linux-2.4.18/kernel/ptrace.c Mon Mar 18 21:58:11 2002
@@ -54,6 +54,7 @@
int ptrace_attach(struct task_struct *task)
{
+ int stopped;
task_lock(task);
if (task->pid <= 1)
goto bad;
@@ -90,7 +91,13 @@
}
write_unlock_irq(&tasklist_lock);
+ stopped = (task->state == TASK_STOPPED);
send_sig(SIGSTOP, task, 1);
+ /* If it was stopped when we got here,
+ clear the pending SIGSTOP. */
+ if (stopped)
+ wake_up_process(task);
+
return 0;
bad:
--- /home/vic/p/linux-2.4.18.orig/arch/i386/kernel/signal.c Wed Mar 13 13:16:44 2002
+++ /home/vic/p/linux-2.4.18/arch/i386/kernel/signal.c Wed Mar 13 16:31:38 2002
@@ -620,9 +620,9 @@
continue;
current->exit_code = 0;
- /* The debugger continued. Ignore SIGSTOP. */
- if (signr == SIGSTOP)
- continue;
+ /* The debugger continued. */
+ if (signr == SIGSTOP && current->ptrace & PT_PTRACED)
+ continue; /* ignore SIGSTOP */
/* Update the siginfo structure. Is this good? */
if (signr != info.si_signo) {
next prev parent reply other threads:[~2002-03-19 4:01 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-12-21 19:53 [PATCH] ptrace on stopped processes (2.4) vic
2001-12-21 23:19 ` Jeff Dike
2001-12-22 3:56 ` OGAWA Hirofumi
2001-12-22 17:38 ` Mike Coleman
2002-01-17 16:57 ` vic
2002-01-17 19:23 ` OGAWA Hirofumi
2002-01-23 17:58 ` vic
2002-01-23 22:14 ` OGAWA Hirofumi
2002-01-23 22:29 ` vic
2002-01-24 1:41 ` OGAWA Hirofumi
2002-01-21 3:09 ` Mike Coleman
2002-01-28 20:15 ` vic
2002-03-19 3:59 ` vic [this message]
-- strict thread matches above, loose matches on Subject: below --
2003-03-17 21:24 Rajesh Rajamani
2003-03-24 4:09 ` Daniel Jacobowitz
2003-03-24 6:24 ` raj
2003-03-24 15:05 ` Daniel Jacobowitz
2003-03-25 13:48 ` Werner Almesberger
2003-03-25 13:58 ` Daniel Jacobowitz
2003-03-25 14:53 ` Werner Almesberger
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=m3zo15jjgo.fsf@localhost.localdomain \
--to=zandy@cs.wisc.edu \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=hirofumi@mail.parknet.co.jp \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo@conectiva.com.br \
--cc=mkc+dated+1012446540.067c74@mathdogs.com \
--cc=torvalds@transmeta.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