https://redmine.lighttpd.net/https://redmine.lighttpd.net/favicon.ico?13667327412018-03-15T23:41:30Zlighty labsLighttpd - Bug #2876: segfault with fastcgi apphttps://redmine.lighttpd.net/issues/2876?journal_id=113532018-03-15T23:41:30Zgstrauss
<ul><li><strong>Category</strong> set to <i>core</i></li><li><strong>Target version</strong> changed from <i>1.4.x</i> to <i>1.4.50</i></li></ul><p>Thank you for the info. It's clear that the error is a NULL pointer dereference, since 'host' has not been set in the fastcgi.server definition. Would you please share the fastcgi.server config from your lighttpd config?</p> Lighttpd - Bug #2876: segfault with fastcgi apphttps://redmine.lighttpd.net/issues/2876?journal_id=113542018-03-15T23:46:33Zgstrauss
<ul></ul><p>If 'host' is not specified, what behavior are you expecting? Listen on "localhost" 127.0.0.1? Listen on "::1" Listen on "0.0.0.0"? Listen on "::" ? other?</p> Lighttpd - Bug #2876: segfault with fastcgi apphttps://redmine.lighttpd.net/issues/2876?journal_id=113552018-03-16T02:55:02Zgstrauss
<ul></ul><p>A quick look at commit <a class="changeset" title="[core] resolve DNS at startup for socket backends resolve DNS at startup and use the first IP ad..." href="https://redmine.lighttpd.net/projects/lighttpd/repository/14/revisions/1836309209e1bc4268df02b7aaf06d2e89329581">18363092</a> looks like localhost 127.0.0.1 was the default if 'host' was not provided.</p> Lighttpd - Bug #2876: segfault with fastcgi apphttps://redmine.lighttpd.net/issues/2876?journal_id=113562018-03-16T03:22:40Zgstrauss
<ul><li><strong>Status</strong> changed from <i>New</i> to <i>Patch Pending</i></li></ul><p>Workaround is to set <code>"host" => "localhost"</code> in the fastcgi.server config (or <code>"host" => "127.0.0.1"</code>)</p>
<p>Next release of lighttpd will have this:<br /><pre>
--- a/src/gw_backend.c
+++ b/src/gw_backend.c
@@ -1399,8 +1399,12 @@ int gw_set_defaults_backend(server *srv, gw_plugin_data *p, data_unset *du, size
host->port = 80;
}
- host->family = (!buffer_string_is_empty(host->host)
- && NULL != strchr(host->host->ptr, ':'))
+ if (buffer_string_is_empty(host->host)) {
+ buffer_copy_string_len(host->host,
+ CONST_STR_LEN("127.0.0.1"));
+ }
+
+ host->family = (NULL != strchr(host->host->ptr, ':'))
? AF_INET6
: AF_INET;
}
</pre></p> Lighttpd - Bug #2876: segfault with fastcgi apphttps://redmine.lighttpd.net/issues/2876?journal_id=113572018-03-16T07:33:13Zarekm
<ul></ul><p>Indeed, no host.</p>
<pre>
fastcgi.server = (
"/" => (
"rt" => (
"port" => "9000",
"bin-path" => "/usr/sbin/rt-server.fcgi",
"check-local" => "disable",
"disable-time" => 0,
"min-procs" => 2,
"max-procs" => 20,
"fix-root-scriptname" => "enable",
)
)
)
}
</pre>
<p>Adding host like that:</p>
<pre>
fastcgi.server = (
"/" => (
"rt" => (
"host" => "127.0.0.1",
"port" => "9000",
"bin-path" => "/usr/sbin/rt-server.fcgi",
"check-local" => "disable",
"disable-time" => 0,
"min-procs" => 2,
"max-procs" => 20,
"fix-root-scriptname" => "enable",
)
)
)
}
</pre>
<p>doesn't seem to fix it, still segfaults. valgrind/gdb info in 1-2 days, can't play with it at this moment.</p> Lighttpd - Bug #2876: segfault with fastcgi apphttps://redmine.lighttpd.net/issues/2876?journal_id=113612018-03-17T15:56:40Zgstrauss
<ul></ul><p>Taking the examples you gave, I can reproduce the crash.<br />If I add "host" => "127.0.0.1", the crash no longer occurs.<br />If I use the patch I provided above, the crash no longer occurs.</p>
<p>Please check that you have updated the config, are using that config, have restarted lighttpd, and are hitting that instance of lighttpd with your test request.</p> Lighttpd - Bug #2876: segfault with fastcgi apphttps://redmine.lighttpd.net/issues/2876?journal_id=113622018-03-17T16:05:05Zgstrauss
<ul><li><strong>Status</strong> changed from <i>Patch Pending</i> to <i>Fixed</i></li><li><strong>% Done</strong> changed from <i>0</i> to <i>100</i></li></ul><p>Applied in changeset <a class="changeset" title="[core] fix crash if 'host' empty in config (fixes #2876) x-ref: "segfault with fastcgi app" h..." href="https://redmine.lighttpd.net/projects/lighttpd/repository/14/revisions/e21906b3b41cda3cefebcc8b96ae6ad08549e504">e21906b3b41cda3cefebcc8b96ae6ad08549e504</a>.</p> Lighttpd - Bug #2876: segfault with fastcgi apphttps://redmine.lighttpd.net/issues/2876?journal_id=113842018-03-18T18:23:03Zarekm
<ul></ul><p>Patch fixes it for me.</p>
<p>Had one more fastcgi section (without host) which caused segfault.</p>