From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752997Ab1BNSJQ (ORCPT ); Mon, 14 Feb 2011 13:09:16 -0500 Received: from mx1.redhat.com ([209.132.183.28]:9073 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752711Ab1BNSJN (ORCPT ); Mon, 14 Feb 2011 13:09:13 -0500 Date: Mon, 14 Feb 2011 19:00:34 +0100 From: Oleg Nesterov To: Denys Vlasenko Cc: Tejun Heo , Roland McGrath , jan.kratochvil@redhat.com, linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, akpm@linux-foundation.org Subject: Re: [PATCH 1/1] ptrace: make sure do_wait() won't hang after PTRACE_ATTACH Message-ID: <20110214180034.GD15847@redhat.com> References: <20110204105343.GA12133@htj.dyndns.org> <20110207174821.GA1237@redhat.com> <20110209141803.GH3770@htj.dyndns.org> <201102132325.55353.vda.linux@googlemail.com> <20110214153149.GB8761@redhat.com> <20110214173910.GA15847@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/14, Denys Vlasenko wrote: > > On Mon, Feb 14, 2011 at 6:39 PM, Oleg Nesterov wrote: > > On 02/14, Denys Vlasenko wrote: > >> > >> On Mon, Feb 14, 2011 at 4:31 PM, Oleg Nesterov wrote: > >> > On 02/13, Denys Vlasenko wrote: > >> >> > >> >> $ strace -tt sleep 30 > >> >> 23:02:15.619262 execve("/bin/sleep", ["sleep", "30"], [/* 30 vars */]) = 0 > >> >> ... > >> >> 23:02:15.622112 nanosleep({30, 0}, NULL) = ? ERESTART_RESTARTBLOCK (To be restarted) > >> >> 23:02:23.781165 --- SIGSTOP (Stopped (signal)) @ 0 (0) --- > >> >> 23:02:23.781251 --- SIGSTOP (Stopped (signal)) @ 0 (0) --- > >> >>     (I forgot again why we see it twice. Another quirk I guess...) > >> > > >> >      (this is correct, the tracee reports the signal=SIGSTOP, then > >> >       it reports it actually stopps with exit_code=SIGSTOP) > >> > >> Ah, I see. Is there any way debugger can distinguish between these two > >> different stops? > > > > IIRC, the (only?) way to distinguish is to check last_siginfo != NULL > > via ptrace(PTRACE_GETSIGINFO). > > What do you think strace needs to do when it sees second SIGSTOP > (meaning "in theory", not "on current kernel which may be buggy")? > > ptrace(PTRACE_SYSCALL, $PID, 0x1, 0)? proably this, or even ptrace(PTRACE_SYSCALL, $PID, 0x1, SIGSTOP). I think. (assuming that ptrace_resume() respects TASK_STOPPED) Oleg.