From owner-cvs-all@FreeBSD.ORG Fri Oct 28 15:45:36 2005 Return-Path: X-Original-To: cvs-all@freebsd.org Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 27CC316A420; Fri, 28 Oct 2005 15:45:36 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from mv.twc.weather.com (mv.twc.weather.com [65.212.71.225]) by mx1.FreeBSD.org (Postfix) with ESMTP id A1A9A43D78; Fri, 28 Oct 2005 15:45:26 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from [10.50.41.234] (Not Verified[10.50.41.234]) by mv.twc.weather.com with NetIQ MailMarshal (v6, 0, 3, 8) id ; Fri, 28 Oct 2005 12:02:13 -0400 From: John Baldwin To: Stefan Farfeleder Date: Fri, 28 Oct 2005 10:33:46 -0400 User-Agent: KMail/1.8.2 References: <200510281045.j9SAjJmR096150@repoman.freebsd.org> In-Reply-To: <200510281045.j9SAjJmR096150@repoman.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-6" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200510281033.48001.jhb@freebsd.org> Cc: cvs-src@freebsd.org, src-committers@freebsd.org, cvs-all@freebsd.org Subject: Re: cvs commit: src/bin/sh memalloc.c memalloc.h miscbltin.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Oct 2005 15:45:36 -0000 On Friday 28 October 2005 06:45 am, Stefan Farfeleder wrote: > stefanf 2005-10-28 10:45:19 UTC > > FreeBSD src repository > > Modified files: > bin/sh memalloc.c memalloc.h miscbltin.c > Log: > Protect malloc, realloc and free calls with INT{ON,OFF} directly in > chkalloc, ckrealloc and ckfree (added), respectively. sh jumps out of the > signal handler using longjmp which is obviously a bad idea during malloc > calls. > > Note: I think there is still a small race here because volatile > sig_atomic_t only guarantees atomic reads and writes while we're doing > increments and decrements. > > Protect a setmode call with INT{ON,OFF} as it calls malloc internally. > > PR: 45478 > Patch from: Nate Eldredge If you are just doing a simple reference count you can use an int and use either the refcount API from sys/refcount.h or the atomic_foo_int() operations directly from machine/atomic.h. Those should all work fine in userland. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org