Bug #1926
closedlighttpd 1.4.21 crashes on receipt of SIGINT on Solaris
Description
Solaris 10 x86, lighttpd 1.4.21
config file:
server.document-root = "/var/www"
server.port = 8001
after hitting ^C, lighttpd crashes as follows:
$ lighttpd -f lighttpd.conf -D
2009-03-04 11:41:03: (log.c.97) server started
^CSegmentation Fault (core dumped)
GDB output:
91 last_sigterm_info = *si;
(gdb) bt
#0 sigaction_handler (sig=0, si=0x0, context=0x80471dc) at server.c:91
#1 0xfecbd31f in __sighndlr () from /lib/libc.so.1
#2 0xfecb3980 in call_user_handler () from /lib/libc.so.1
#3 <signal handler called>
#4 0xfecbdc57 in __pollsys () from /lib/libc.so.1
#5 0xfecb2ac6 in _pollsys () from /lib/libc.so.1
#6 0xfec68536 in poll () from /lib/libc.so.1
#7 0x0806b872 in fdevent_poll_poll (ev=0x80473f0, timeout_ms=4) at fdevent_poll.c:105
#8 0x08056d20 in main (argc=1000, argv=0x8047790) at server.c:1382
Problem appears to be that si is NULL, and sigaction_handler doesn't check for that case. I changed line 91 to:
if (si) last_sigterm_info = *si;
which seems to work, though I didn't look for what last_sigterm_info is used for elsewhere.
Files
Updated by acd over 15 years ago
Oh, one more thing worth noting, the signal received by sigaction_handler is 2 -- SIGINT. I'm not sure why GDB can't see that, perhaps it's in a register or something, but I added a printf statement in sigaction_handler to display sig and the value is 2.
Updated by stbuehler over 15 years ago
- File solaris_sigint_segfault.patch solaris_sigint_segfault.patch added
- Target version changed from 1.4.21 to 1.4.22
Some background info: http://fixunix.com/274252-post5.html
I prefer setting the struct to 0 (that seems to reflect the behavior on my system). Could you please try the attached patch?
Updated by stbuehler over 15 years ago
- Status changed from New to Fixed
- % Done changed from 0 to 100
Applied in changeset r2409.
Updated by acd over 15 years ago
This seems like a good workaround but shouldn't empty_siginfo be initialized? It looks like lighttpd is only using si_uid and si_pid from last_sigterm_info for logging, so it won't cause any negative behavior, but it doesn't seem clean to me.
Updated by stbuehler over 15 years ago
http://flash-gordon.me.uk/ansi.c.txt
If an object that has static storage duration is not initialized
explicitly, it is initialized implicitly as if every member that has
arithmetic type were assigned 0 and every member that has pointer type
were assigned a null pointer constant.
Updated by acd over 15 years ago
Maybe this patch is better...?
Updated by acd over 15 years ago
stbuehler wrote:
http://flash-gordon.me.uk/ansi.c.txt
If an object that has static storage duration is not initialized
explicitly, it is initialized implicitly as if every member that has
arithmetic type were assigned 0 and every member that has pointer type
were assigned a null pointer constant.
Well I learn something new every day :). Didn't realize that about static structs. Thanks for the info.
Also available in: Atom