From owner-freebsd-current Tue Oct 1 0:30:19 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B3BAB37B401; Tue, 1 Oct 2002 00:30:17 -0700 (PDT) Received: from gw.catspoiler.org (217-ip-163.nccn.net [209.79.217.163]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4571043E75; Tue, 1 Oct 2002 00:30:16 -0700 (PDT) (envelope-from dl-freebsd@catspoiler.org) Received: from mousie.catspoiler.org (mousie.catspoiler.org [192.168.101.2]) by gw.catspoiler.org (8.12.5/8.12.5) with ESMTP id g917U4vU012350; Tue, 1 Oct 2002 00:30:08 -0700 (PDT) (envelope-from dl-freebsd@catspoiler.org) Message-Id: <200210010730.g917U4vU012350@gw.catspoiler.org> Date: Tue, 1 Oct 2002 00:30:04 -0700 (PDT) From: Don Lewis Subject: Re: World broken at libkvm To: jmallett@FreeBSD.ORG Cc: freebsd-current@FreeBSD.ORG In-Reply-To: <20020930224942.A73940@FreeBSD.org> MIME-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On 30 Sep, Juli Mallett wrote: > * De: Don Lewis [ Data: 2002-09-30 ] >> I suggest looking especially closely at the sigio stuff. Even the old >> code has a lock order reversal problem when I/O to a pipe wants to >> signal the process at the other end of the pipe. I thought a lot about >> that problem and never found a clean fix. >> >> The sigio stuff could be even nastier if you need to allocate memory in >> the signal code because the sigio can be invoked by the reception of a >> packet from the network, which is not handled in a process context ... > > No locks except for the lock of the process being signalled should be > held when sending signals, IMHO, though I am mostly ignorant of the SIGIO > locking. As I recall, the sigio code needs to hold a lock to prevent the sigio structure from being ripped out from underneath it while it is sending a signal to the target process or process group by any of: An explicit fcntl(fd, F_SETOWN, ...) by the recpient process or a member of its process group, or some other process that shares the associated descriptor. An implicit fcntl(fd, F_SETOWN, 0) caused by the descriptor being closed. The target process exiting. The target process group disappearing because its last member is exiting. The pipe I/O code can call pgsigio() in various places while holding the pipe lock. It looks to me like dropping the pipe lock could introduce some race condition problems in the SMP case. In particular if we dropped the lock to send the signal before calling msleep() to wait for the process at the other end of the pipe to do some I/O, the I/O could happen after we dropped the lock but before we went to sleep and we'd never get woken up. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message