Bug: deadlock from msyslog

Gary E. Miller gem at rellim.com
Tue Mar 22 07:21:30 UTC 2016


Yo Hal!

On Mon, 21 Mar 2016 23:25:00 -0700
Hal Murray <hmurray at megapathdsl.net> wrote:

> gem at rellim.com said:
> > Check out "man 7 signal", almost nothing is legal to call from
> > within a signal.  You can't even open() of fopen() anything.  About
> > the best you can do is write(STDERR,) and exit().   
> 
> Right.  I was wondering if there was any software that would check
> that.

Well, there is some wetware that can do that.  Or better yet, as the
man page says, just don't use signal().

> For ntpd, writing to STDERR doesn't work since it's a daemon and has
> nuked STDOUT and STDERR.  syslog(3) isn't on the approved list.

Ain't it a bitch.

> The call restrictions mean that you can't longjmp out of a signal
> unless you know you were't doing anything dangerous when the signal
> went off.  After the jump, you are still in the signal handler.

Yup.  The best you can do is set a flag and return.

> On the other hand, it mostly works

Yeah, be sure to put that in your man page: It mostly works.

> so all sorts of web pages show you
> how to do it without mentioning the restrictions.  In the case of
> ntpq, it's likely to be doing a DNS lookup.

DNS lookups time out in 5 or 10 seconds, so easy to just set a flag and
return, then let the main loop commit suicide with dignity.

RGDS
GARY
---------------------------------------------------------------------------
Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703
	gem at rellim.com  Tel:+1 541 382 8588
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <http://lists.ntpsec.org/pipermail/devel/attachments/20160322/af4676ad/attachment.bin>


More information about the devel mailing list