From owner-freebsd-arch@FreeBSD.ORG Thu Jan 1 08:48:26 2004 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 45DA516A4CE; Thu, 1 Jan 2004 08:48:26 -0800 (PST) Received: from mail.pcnet.com (mail.pcnet.com [204.213.232.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id 35F7843D54; Thu, 1 Jan 2004 08:48:25 -0800 (PST) (envelope-from eischen@vigrid.com) Received: from mail.pcnet.com (mail.pcnet.com [204.213.232.4]) by mail.pcnet.com (8.12.10/8.12.1) with ESMTP id i01GmOiw020728; Thu, 1 Jan 2004 11:48:24 -0500 (EST) Date: Thu, 1 Jan 2004 11:48:24 -0500 (EST) From: Daniel Eischen X-Sender: eischen@pcnet5.pcnet.com To: David Xu In-Reply-To: <3FF43B93.5060209@freebsd.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: arch@freebsd.org Subject: Re: sigaltstack with threads X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Jan 2004 16:48:26 -0000 On Thu, 1 Jan 2004, David Xu wrote: > Doug Rabson wrote: > > I think that if its supported at all in threaded programs, it must be > > per-thread state otherwise you can't prevent two different threads > > colliding on the same signal stack. I can't quite see how this maps to > > KSE/KSEG since I only have the most hazy model of that stuff in my head > > right now. > > > > Anyway, I've worked around things by not setting SA_ONSTACK for the > > handlers that I want to run on the thread stack. > > > > > I have worked out a patch to support per-thread sigaltstack() state, > in most cases, it is just a literally replacement. > > http://people.freebsd.org/~davidxu/kse/kern_sigaltstack.diffs Looks good, but I have a question. You removed the proc lock in kern_sig.c:osigstack() and kern_sig.c:kern_sigaltstack(). What prevents a signal from being sent to the current thread while it is mucking with the altsigstack? Is it possible for an interrupt to swap out the current thread and have a signal installed for it sometime later before it can complete sigaltstack()? Or do signals only get installed on the way out of the kernel? -- Dan Eischen