[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110228135312.GC9326@htj.dyndns.org>
Date: Mon, 28 Feb 2011 14:53:12 +0100
From: Tejun Heo <tj@...nel.org>
To: Denys Vlasenko <vda.linux@...glemail.com>
Cc: Oleg Nesterov <oleg@...hat.com>,
Roland McGrath <roland@...hat.com>, jan.kratochvil@...hat.com,
linux-kernel@...r.kernel.org, torvalds@...ux-foundation.org,
akpm@...ux-foundation.org
Subject: Re: [PATCH 1/1] ptrace: make sure do_wait() won't hang after
PTRACE_ATTACH
Hello,
On Mon, Feb 28, 2011 at 02:41:29PM +0100, Denys Vlasenko wrote:
> > There's no reason to make the tracee re-enter group stop after pulling
> > it out to execute 'print getpid()'.
>
> If we want to execute 'print getpid()', you are right, we don't want
> to enter group stop. That's use case #1. But there is use case #2:
> "strace sleep" + ^Z. if we want to continue stracing sleep
> without continuing, our PTRACE_SYSCALL(0) *must* make sleep
> enter group stop. Otherwise, sleep won't be stopped. It will
> continue sleeping and will exit, which is not what we want. Right?
I don't really follow the distinction you're trying to make. It
doesn't matter what you're trying to do. All that's necessary is for
the debugger to find out whether group stop is in effect or not and a
way to control the tracee's execution. Nothing else is necessary.
The debugger already knows when the tracee enters group stop. We just
need a way for the debugger to find out when group stop stops.
> > The only thing necessary is a way
> > for the debugger to find out that group stop has been lifted.
>
> What do you mean by "has been *lifted*"?
Somebody sent SIGCONT.
> > The debugger then can resume the tracee if it wishes so. ie. group stop
> > becomes a trap point + a state which the debugger can monitor. If the
> > debugger wants the tracee to follow the jctl behavior, it can do so by
> > resuming the tracee as it sees fit.
>
> Can you describe this in more details? Do you propose that
> debugger can detect that we are in group stop (it is already sort-of
> possible with PTRACE_GETSIGINFO) and if it doesn't want to
> restart tracee, it simply doesn't do any PTRACE_SYSCALL/CONT?
> I tried that. This makes tracee sit in *ptrace* stop, not group stop.
> Meaning: debugger is never be able to see waking SIGCONT:
> waitpid doesn't report it to the debugger.
A tracee should _always_ enter ptrace trap whenever stopping while
ptraced. The stop here or stop there depending on the type of stop
behavior is hardly useful and very fragile (I think it's inherently
fragile that way). Again, the only missing thing is a way for the
debugger to find out when task stop stops. BTW, I'm not talking about
the current behavior. There's no way to make jctl work properly as it
is. We need to improve the kernel one way or another.
Thanks.
--
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists