From owner-cvs-src@FreeBSD.ORG Thu Mar 3 13:11:02 2005 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CB41E16A4D2 for ; Thu, 3 Mar 2005 13:11:02 +0000 (GMT) Received: from mail28.sea5.speakeasy.net (mail28.sea5.speakeasy.net [69.17.117.30]) by mx1.FreeBSD.org (Postfix) with ESMTP id F3F2043D53 for ; Thu, 3 Mar 2005 13:11:01 +0000 (GMT) (envelope-from jhb@FreeBSD.org) Received: (qmail 26577 invoked from network); 3 Mar 2005 13:11:01 -0000 Received: from server.baldwin.cx ([216.27.160.63]) (envelope-sender )AES256-SHA encrypted SMTP for ; 3 Mar 2005 13:11:01 -0000 Received: from [192.168.0.15] (osx.baldwin.cx [192.168.0.15]) (authenticated bits=0) by server.baldwin.cx (8.13.1/8.13.1) with ESMTP id j23DAvhF089506; Thu, 3 Mar 2005 08:10:57 -0500 (EST) (envelope-from jhb@FreeBSD.org) In-Reply-To: <4226446B.7020406@freebsd.org> References: <200503021343.j22DhpQ3075008@repoman.freebsd.org> <200503020915.28512.jhb@FreeBSD.org> <4226446B.7020406@freebsd.org> Mime-Version: 1.0 (Apple Message framework v619.2) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <61ac46c154aa515a692308440dd1141d@FreeBSD.org> Content-Transfer-Encoding: 7bit From: John Baldwin Date: Thu, 3 Mar 2005 08:10:56 -0500 To: David Xu X-Mailer: Apple Mail (2.619.2) X-Spam-Status: No, score=-2.8 required=4.2 tests=ALL_TRUSTED autolearn=failed version=3.0.2 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on server.baldwin.cx cc: cvs-src@FreeBSD.org cc: src-committers@FreeBSD.org cc: cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/kern kern_sig.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Mar 2005 13:11:03 -0000 On Mar 2, 2005, at 5:55 PM, David Xu wrote: > John Baldwin wrote: > >> On Wednesday 02 March 2005 08:43 am, David Xu wrote: >> >>> davidxu 2005-03-02 13:43:51 UTC >>> >>> FreeBSD src repository >>> >>> Modified files: >>> sys/kern kern_sig.c >>> Log: >>> In kern_sigtimedwait, remove waitset bits for td_sigmask before >>> sleeping, so in do_tdsignal, we no longer need to test td_waitset. >>> now td_waitset is only used to give a thread higher priority when >>> delivering signal to multithreads process. >>> This also fixes a bug: >>> when a thread in sigwait states was suspended and later resumed >>> by SIGCONT, it can no longer receive signals belong to waitset. >>> >> >> Is this related at all to Peter Holm's panic where sigwait() + >> swapping invokes a panic? >> >> > No. Peter Holm's found is a swapping problem. vm swaps out sleeping > thread's stack under memory stressing case. but I think that's not > safe, > that means, following code can not be used in kernel: > > int *p; > > func() > { > int n; > > n = 0; > p = &n; > msleep(p); > /* check variable n ... > } > > func2() > { > *p = 2; > wakeup(p); > } > > unless million lines of kernel code are reviewed, I don't think the > vm code is safe. The following patch should avoid the problem: Note that swapping out the stack is the default behavior in 4.x, so I actually think that the million lines of kernel code are indeed safe, only sigwait() is broken and should be fixed. :) -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org