summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6264cf4)
raw | patch | inline | side by side (parent: 6264cf4)
author | Sebastian Harl <sh@tokkee.org> | |
Sun, 23 Nov 2014 12:38:51 +0000 (13:38 +0100) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Sun, 23 Nov 2014 12:38:51 +0000 (13:38 +0100) |
Upstream fix for a segfault in plugins using libcurl caused by concurrent
memory access. Thanks to Marc Fournier for reporting this.
Closes: #770683
Cf. #735173
memory access. Thanks to Marc Fournier for reporting this.
Closes: #770683
Cf. #735173
debian/changelog | patch | blob | history | |
debian/patches/00list | patch | blob | history | |
debian/patches/bts770683_curl_init.dpatch | [new file with mode: 0755] | patch | blob |
diff --git a/debian/changelog b/debian/changelog
index f192cfe5a715cef72646d67fe9c4b651530b15b0..dc739f29ddcf4c51724e384c6fb1c0ee63d0b1a2 100644 (file)
--- a/debian/changelog
+++ b/debian/changelog
- Added bts747093_lvm_segfault: upstream fix for a segfault in the LVM
plugin; thanks to Bernd Zeimetz and Marc Fournier for reporting this
(Closes: #747093).
+ - Added bts770683_curl_init: upstream fix for a segfault in plugins using
+ libcurl caused by concurrent memory access; thanks to Marc Fournier for
+ reporting this (Closes: #770683, cf. #735173).
-- Sebastian Harl <tokkee@debian.org> Sun, 23 Nov 2014 13:04:03 +0100
diff --git a/debian/patches/00list b/debian/patches/00list
index f1f07e7581417a36c9e878480dd7dea7f76333fe..5046f3e3482a4cb901bdf09fe6bc45f3a24fb613 100644 (file)
--- a/debian/patches/00list
+++ b/debian/patches/00list
bts559801_plugin_find_fix.dpatch
bts770681_riemann_ack.dpatch
bts747093_lvm_segfault.dpatch
+bts770683_curl_init.dpatch
diff --git a/debian/patches/bts770683_curl_init.dpatch b/debian/patches/bts770683_curl_init.dpatch
--- /dev/null
@@ -0,0 +1,117 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## bts770683_curl_init.dpatch by Jeremy Katz <jeremy@katzbox.net>
+##
+## DP: Call curl_global_init() in _init of plugins using curl.
+## DP:
+## DP: curl_global_init() or curl_easy_init() has to be called in the init
+## DP: callback of plugins using curl while collectd still runs single
+## DP: threaded. Else, collectd may crash with a segfault due to concurrent
+## DP: memory access by curl.
+## DP:
+## DP: Upstream bug report:
+## DP: https://github.com/collectd/collectd/issues/526
+
+@DPATCH@
+
+diff a/src/apache.c b/src/apache.c
+--- a/src/apache.c
++++ b/src/apache.c
+@@ -702,9 +702,18 @@ static int apache_read_host (user_data_t *user_data) /* {{{ */
+ return (0);
+ } /* }}} int apache_read_host */
+
++static int apache_init (void) /* {{{ */
++{
++ /* Call this while collectd is still single-threaded to avoid
++ * initialization issues in libgcrypt. */
++ curl_global_init (CURL_GLOBAL_SSL);
++ return (0);
++} /* }}} int apache_init */
++
+ void module_register (void)
+ {
+ plugin_register_complex_config ("apache", config);
++ plugin_register_init ("apache", apache_init);
+ } /* void module_register */
+
+ /* vim: set sw=8 noet fdm=marker : */
+diff a/src/curl.c b/src/curl.c
+--- a/src/curl.c
++++ b/src/curl.c
+@@ -566,6 +566,7 @@ static int cc_init (void) /* {{{ */
+ INFO ("curl plugin: No pages have been defined.");
+ return (-1);
+ }
++ curl_global_init (CURL_GLOBAL_SSL);
+ return (0);
+ } /* }}} int cc_init */
+
+diff --git a/src/curl_json.c b/src/curl_json.c
+index 24e1df1..0948962 100644
+--- a/src/curl_json.c
++++ b/src/curl_json.c
+@@ -882,9 +882,18 @@ static int cj_read (user_data_t *ud) /* {{{ */
+ return cj_curl_perform (db, db->curl);
+ } /* }}} int cj_read */
+
++static int cj_init (void) /* {{{ */
++{
++ /* Call this while collectd is still single-threaded to avoid
++ * initialization issues in libgcrypt. */
++ curl_global_init (CURL_GLOBAL_SSL);
++ return (0);
++} /* }}} int cj_init */
++
+ void module_register (void)
+ {
+ plugin_register_complex_config ("curl_json", cj_config);
++ plugin_register_init ("curl_json", cj_init);
+ } /* void module_register */
+
+ /* vim: set sw=2 sts=2 et fdm=marker : */
+diff --git a/src/curl_xml.c b/src/curl_xml.c
+index b941f02..e31e73d 100644
+--- a/src/curl_xml.c
++++ b/src/curl_xml.c
+@@ -926,9 +926,18 @@ static int cx_config (oconfig_item_t *ci) /* {{{ */
+ return (0);
+ } /* }}} int cx_config */
+
++static int cx_init (void) /* {{{ */
++{
++ /* Call this while collectd is still single-threaded to avoid
++ * initialization issues in libgcrypt. */
++ curl_global_init (CURL_GLOBAL_SSL);
++ return (0);
++} /* }}} int cx_init */
++
+ void module_register (void)
+ {
+ plugin_register_complex_config ("curl_xml", cx_config);
++ plugin_register_init ("curl_xml", cx_init);
+ } /* void module_register */
+
+ /* vim: set sw=2 sts=2 et fdm=marker : */
+diff --git a/src/write_http.c b/src/write_http.c
+index 62c73b0..04c637b 100644
+--- a/src/write_http.c
++++ b/src/write_http.c
+@@ -656,9 +656,18 @@ static int wh_config (oconfig_item_t *ci) /* {{{ */
+ return (0);
+ } /* }}} int wh_config */
+
++static int wh_init (void) /* {{{ */
++{
++ /* Call this while collectd is still single-threaded to avoid
++ * initialization issues in libgcrypt. */
++ curl_global_init (CURL_GLOBAL_SSL);
++ return (0);
++} /* }}} int wh_init */
++
+ void module_register (void) /* {{{ */
+ {
+ plugin_register_complex_config ("write_http", wh_config);
++ plugin_register_init ("write_http", wh_init);
+ } /* }}} void module_register */
+
+ /* vim: set fdm=marker sw=8 ts=8 tw=78 et : */