From: Daniel Jacobowitz <dan@debian.org>
To: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>,
Ingo Molnar <mingo@elte.hu>
Cc: Linus Torvalds <torvalds@transmeta.com>, linux-kernel@vger.kernel.org
Subject: Re: [patch] ptrace-fix-2.5.33-A1
Date: Thu, 5 Sep 2002 14:36:09 -0400 [thread overview]
Message-ID: <20020905183609.GA26898@nevyn.them.org> (raw)
In-Reply-To: <874rd4cqki.fsf@devron.myhome.or.jp>
I'll reply to the rest of this in a moment, but one thing at a time...
On Fri, Sep 06, 2002 at 02:08:13AM +0900, OGAWA Hirofumi wrote:
> Ingo Molnar <mingo@elte.hu> writes:
>
> > Linus,
> >
> > the attached patch (against BK-curr) collects two ptrace related fixes:
> > first it undoes Ogawa's change (so various uses of ptrace works again),
> > plus it adds Daniel's suggested fix that allows a parent to PTRACE_ATTACH
> > to a child it forked. (this also fixes the incorrect BUG_ON() assert
> > Ogawa's patch was intended to fix in the first place.)
> >
> > i've tested various ptrace uses and they appear to work just fine.
> >
> > (Daniel, let us know if you can still see anything questionable in this
> > area - or if the ptrace list could be managed in a cleaner way.)
> in sys_wait4()
>
> + } else {
> + if (p->ptrace) {
> + write_lock_irq(&tasklist_lock);
> + ptrace_unlink(p);
> + write_unlock_irq(&tasklist_lock);
> + }
> release_task(p);
> + }
>
> Umm, why needed this? If ->real_parent == ->parent, it's real
> child. So this child don't use ->ptrace_list.
You're right, we just need to clear p->ptrace. And there was a problem
with debugged detached tasks. Ingo, does this look right to you? It
passes my testing. Handle unlinking in release_task instead of at both
call sites, since they both need it.
===== exit.c 1.45 vs edited =====
*** /tmp/exit.c-1.45-26998 Mon Sep 2 01:15:09 2002
--- exit.c Thu Sep 5 14:23:32 2002
*************** static void release_task(struct task_str
*** 66,71 ****
--- 66,76 ----
atomic_dec(&p->user->processes);
security_ops->task_free_security(p);
free_uid(p->user);
+ if (unlikely(p->ptrace)) {
+ write_lock_irq(&tasklist_lock);
+ ptrace_unlink(p);
+ write_unlock_irq(&tasklist_lock);
+ }
BUG_ON(!list_empty(&p->ptrace_list) || !list_empty(&p->ptrace_children));
unhash_process(p);
===== ptrace.c 1.16 vs edited =====
*** /tmp/ptrace.c-1.16-26998 Mon Aug 19 14:12:27 2002
--- ptrace.c Thu Sep 5 14:18:05 2002
*************** void __ptrace_link(task_t *child, task_t
*** 29,35 ****
if (!list_empty(&child->ptrace_list))
BUG();
if (child->parent == new_parent)
! BUG();
list_add(&child->ptrace_list, &child->parent->ptrace_children);
REMOVE_LINKS(child);
child->parent = new_parent;
--- 29,35 ----
if (!list_empty(&child->ptrace_list))
BUG();
if (child->parent == new_parent)
! return;
list_add(&child->ptrace_list, &child->parent->ptrace_children);
REMOVE_LINKS(child);
child->parent = new_parent;
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
next prev parent reply other threads:[~2002-09-05 18:31 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-09-05 15:35 Ingo Molnar
2002-09-05 17:08 ` OGAWA Hirofumi
2002-09-05 18:36 ` Daniel Jacobowitz [this message]
2002-09-05 20:06 ` Ingo Molnar
2002-09-05 21:44 ` Daniel Jacobowitz
2002-09-05 22:12 ` Daniel Jacobowitz
2002-09-05 22:09 Ingo Molnar
2002-09-05 22:15 ` Daniel Jacobowitz
2002-09-05 22:25 ` Ingo Molnar
2002-09-05 22:29 ` Daniel Jacobowitz
2002-09-05 22:39 ` Ingo Molnar
2002-09-05 22:50 ` Daniel Jacobowitz
2002-09-05 22:58 ` Ingo Molnar
2002-09-06 15:27 ` OGAWA Hirofumi
2002-09-06 15:45 ` Daniel Jacobowitz
2002-09-06 15:57 ` Ingo Molnar
2002-09-06 20:44 ` OGAWA Hirofumi
2002-09-05 22:41 ` Ingo Molnar
2002-09-05 22:52 ` Daniel Jacobowitz
2002-09-05 22:35 ` Ingo Molnar
2002-09-05 23:02 ` Daniel Jacobowitz
2002-09-05 23:08 ` Ingo Molnar
2002-09-05 22:10 Ingo Molnar
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=20020905183609.GA26898@nevyn.them.org \
--to=dan@debian.org \
--cc=hirofumi@mail.parknet.co.jp \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--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
all inboxes | Powered by JetHome®