comp.lang.ada
 help / color / mirror / Atom feed
From: Florian Weimer <fw@deneb.enyo.de>
Subject: Re: GNAT: Setting SIGPIPE to SIG_IGN
Date: Tue, 03 Sep 2002 00:39:58 +0200
Date: 2002-09-02T22:39:53+00:00	[thread overview]
Message-ID: <87sn0suibl.fsf@deneb.enyo.de> (raw)
In-Reply-To: 3D72CC97.7000805@cogeco.ca

"Warren W. Gay VE3WWG" <ve3wwg@cogeco.ca> writes:

> Is there anything useful you can learn from the "GNAT compensation"
> that might help?

> I'm afraid I don't see an easy solution. I think the approach
> I would take is to attempt to solve the "problematic side effects" in
> the "tasking run-time library".

Ugh, I can't do that.  If tasking is activated, setuid(2) and similar
system calls do not work reliable on GNU/Linux: Credentials are thread
attributes, not process attributes as required.  And there's somethign
which makes matters even worse: The pthreads library uses signals
for communication with the management thread, and if I change the
credentials, the signals cannot be delivered any longer because the
permission check fails, and the program just stops.  This problem is
triggered not only by the active use of tasking, it's sufficient to
declare a single protected object.

> But this probably doesn't work well for a project that must "port"
> to multiple platforms (you haven't said much about the project
> requirements),

I'd like to have as few as GNU/Linux dependencies as possible.  In
fact, last weekend, I've made some changes (see my other message about
C expression evaluation using autoconf) which should port my little
pet project to any POSIX platform on which GNAT binaries can run.

> or port to many future releases of Linux.

Linux isn't the problem here, it's the threading implementation in GNU
libc.  I wouldn't have to face this problem if I was using FSU
Threads, for example, or if I'd wait a few months (years?) until the
GNU libc implementation is conforming to POSIX.

> (One possibly useless suggestion is to try FreeBSD instead ;-)

Perhaps after the first big security incident Debian has to
experience. ;-)

> Beyond that, I can't think of any further useful advice. I do
> believe that you do have an interesting problem.

Well, fortunately my fundamental assumption is wrong: signal handlers
are not thread specific, although signals are always thread-specific
(which differs from what POSIX says).  As a result, I can call
signal(SIGPIPE, SIG_IGN) during elaboration.  Case closed.

(Well, I better write a test case for that, but looking at the actual
source code, I think this should work, and all the complexity isn't
required.)



      reply	other threads:[~2002-09-02 22:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-31  9:36 GNAT: Setting SIGPIPE to SIG_IGN Florian Weimer
2002-08-31 21:13 ` Warren W. Gay VE3WWG
2002-09-01  0:20   ` Darren New
2002-09-01 10:16   ` Florian Weimer
2002-09-02  2:27     ` Warren W. Gay VE3WWG
2002-09-02 22:39       ` Florian Weimer [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox