From owner-freebsd-arch@FreeBSD.ORG Fri Sep 7 18:22:30 2012 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 064521065675; Fri, 7 Sep 2012 18:22:29 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-ob0-f182.google.com (mail-ob0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 821268FC0C; Fri, 7 Sep 2012 18:22:29 +0000 (UTC) Received: by obbun3 with SMTP id un3so6469764obb.13 for ; Fri, 07 Sep 2012 11:22:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=kxM3mO77U7ZNp0utZtVcyUCwrRQHDHGGoi6IzJR9dCI=; b=vPXmydu6u6E+AmRYcc7hDcw7Sqtc+WRnwHA+sxkPJKsc2mxb0NJ+BhwtFtnkn4YfOA AuRFehdkY+H3QiC3ljXfz46XWB+nM3FxgvgA0Mm7JCmxVGYaAfzXQYArecLnpsjFN6yL rwv3Th09PJ5V1ialqHbQqEptE9Tr0wViRHuRP7bqQuNBMKP2EoWtuewPpVRvHCImFFe/ HcFWxlk5yk/gaB5uZkkteRHsheDLxcwaBaRH2UWnp2dgxXIG0odbDccpcPQKz41Np/hP xF8KD65/p3j1bZCovo6UXDL5d1gJBLcc0AnKRAVeNEwlgrGXq3j9kW/po+6FhdBYwePH 9iDA== MIME-Version: 1.0 Received: by 10.182.222.39 with SMTP id qj7mr7144912obc.16.1347042143309; Fri, 07 Sep 2012 11:22:23 -0700 (PDT) Received: by 10.76.142.201 with HTTP; Fri, 7 Sep 2012 11:22:23 -0700 (PDT) In-Reply-To: <201209071416.24970.jhb@freebsd.org> References: <201209071217.47439.jhb@freebsd.org> <201209071416.24970.jhb@freebsd.org> Date: Fri, 7 Sep 2012 11:22:23 -0700 Message-ID: From: Garrett Cooper To: John Baldwin Content-Type: text/plain; charset=ISO-8859-1 Cc: arch@freebsd.org Subject: Re: [PATCH] Close a race between exit1() and SIGSTOP X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Sep 2012 18:22:30 -0000 On Fri, Sep 7, 2012 at 11:16 AM, John Baldwin wrote: > On Friday, September 07, 2012 12:35:52 pm Garrett Cooper wrote: >> Does this case continue to function normally? >> >> $ sh -c 'while :; do sleep 1; done' >> ^Z >> [1]+ Stopped sh -c 'while :; do sleep 1; done' >> $ kill %1 >> $ fg >> bash: fg: job has terminated >> [1]+ Terminated: 15 sh -c 'while :; do sleep 1; done' >> >> $ sh -c 'while :; do sleep 1; done' >> ^Z >> [1]+ Stopped sh -c 'while :; do sleep 1; done' >> $ kill %1 >> $ kill %1 >> bash: kill: (3522) - No such process >> [1]+ Terminated: 15 sh -c 'while :; do sleep 1; done' >> >> In particular, a single kill results in the signal being sent after >> the process wakes up, and a double kill results in the immediate death >> of the process (in this case a shell job) (in part because of the >> signals /bin/sh masks). > > This still works in bash: > >> bash > $ sh -c 'while :; do sleep 1; done' > ^Z > [1]+ Stopped sh -c 'while :; do sleep 1; done' > $ kill %1 > $ fg > bash: fg: job has terminated > [1]+ Terminated: 15 sh -c 'while :; do sleep 1; done' > $ sh -c 'while :; do sleep 1; done' > ^Z > [1]+ Stopped sh -c 'while :; do sleep 1; done' > $ kill %1 > $ kill %1 > bash: kill: (61009) - No such process > [1]+ Terminated: 15 sh -c 'while :; do sleep 1; done' > > I get different behavior in tcsh: > >> sh -c 'while :; do sleep 1; done' > ^Z > Suspended >> kill %1 >> > [1] Terminated sh -c while :; do sleep 1; done > > Note that this patch merey inhibits SIGSTOP from having an effect while > a process is exiting, it does not affect SIGTERM at all, so I don't think > it could have any effect on this case anyway. I should have said /bin/sh (I don't use tcsh by choice anymore because of its fun bugs). Good point.. I'd need to do more digging to better understand what is trying to be resolved here. Thanks! -Garrett