Date: Mon, 14 Dec 1998 06:53:53 +0100 (CET) From: List User <listuser@netspace.net.au> To: freebsd-current@FreeBSD.org Message-ID: <199812140553.GAA06687@doorway.home.lan>
next in thread | raw e-mail | index | archive | help
Newsgroups: freebsd.current
Path: root
From: Terry Lambert <tlambert@primenet.com>
Subject: Re: inetd: realloc/free bug
Content-Type: text/plain; charset=US-ASCII
Received: (from tlambert@localhost)
by usr09.primenet.com (8.8.5/8.8.5) id PAA10799;
Sun, 13 Dec 1998 15:53:54 -0700 (MST)
To: archie (Archie Cobbs)
Sender: owner-freebsd-current@FreeBSD.ORG
Content-Transfer-Encoding: 7bit
Organization: Private News Host
Precedence: bulk
Message-ID: <199812132253.PAA10799@usr09.primenet.com>
X-Mailer: ELM [version 2.4 PL25]
Delivered-To: vmailer-current@freebsd.org
X-Uidl: c91810ec79230b03092ce6e89e303611
X-Loop: FreeBSD.ORG
Mime-Version: 1.0
In-Reply-To: <199812111940.LAA27652@bubba.whistle.com> from "Archie Cobbs" at Dec 11, 98 11:40:58 am
Cc: peter.edwards, dillon, jwd, freebsd-current
Date: Sun, 13 Dec 1998 22:53:54 GMT
> I guess I was thinking in terms of the event library model; that is,
> you don't handle the signal event in the signal handler (because in
> general the event handler could call malloc(), etc), but rather you
> simply set a flag (call it "signalFlag").
>
> The race condition is getting a signal between the first and second
> lines below:
>
> sigprocmask(SIG_UNBLOCK ..) /* unblock signals */
> r = select(...) /* wait for event */
> sigprocmask(SIG_BLOCK ..) /* block signals */
>
> if (signalFlag || r > 0) {
> ... /* handle event(s) */
> }
>
> But there are probably smarter ways to do it than this.
Yes. Don't block signals, use a setjmp for the select, and choose
system call restart behaviour.
The race you are concerned with is a signal occurring before the
select starts, and the resulting EINTR.
Terry Lambert
terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199812140553.GAA06687>
