All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] curl: enable threaded resolver
@ 2017-09-04  7:57 André Draszik
  2017-09-04  9:37 ` Burton, Ross
  2017-09-04  9:42 ` [PATCH v2] " André Draszik
  0 siblings, 2 replies; 3+ messages in thread
From: André Draszik @ 2017-09-04  7:57 UTC (permalink / raw)
  To: openembedded-core

From: André Draszik <adraszik@tycoint.com>

Multi-threaded applications using libcurl crash
on DNS timeouts when built using OE.

The reason is as follows:
By default, libcurl implements DNS timeouts using a
timer (alarm()) and a pair of setjmp()/longjmp().
This approach is unsafe in multi-threaded applications
for various reasons, as e.g. explained in the relevant
man-pages.

To avoid this, libcurl can be compiled with a built-in
threaded resolver, or against the c-ares asynchronous
resolver library.

To keep extra dependencies to a minimum, and to mimic
other distributions (debian at least), and because
c-ares is not available in OE-core, add a PACKAGECONFIG
to be able to enable use of of the built-in threaded
resolver and enable it by default.

Signed-off-by: André Draszik <adraszik@tycoint.com>
---
 meta/recipes-support/curl/curl_7.54.1.bb | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/meta/recipes-support/curl/curl_7.54.1.bb b/meta/recipes-support/curl/curl_7.54.1.bb
index f42582a9f0..4cd5d09fef 100644
--- a/meta/recipes-support/curl/curl_7.54.1.bb
+++ b/meta/recipes-support/curl/curl_7.54.1.bb
@@ -20,9 +20,9 @@ SRC_URI[sha256sum] = "fdfc4df2d001ee0c44ec071186e770046249263c491fcae48df0e1a3ca
 CVE_PRODUCT = "libcurl"
 inherit autotools pkgconfig binconfig multilib_header
 
-PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)} gnutls proxy zlib"
-PACKAGECONFIG_class-native = "ipv6 proxy ssl zlib"
-PACKAGECONFIG_class-nativesdk = "ipv6 proxy ssl zlib"
+PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)} gnutls proxy thres zlib"
+PACKAGECONFIG_class-native = "ipv6 proxy ssl thres zlib"
+PACKAGECONFIG_class-nativesdk = "ipv6 proxy ssl thres zlib"
 
 PACKAGECONFIG[dict] = "--enable-dict,--disable-dict,"
 PACKAGECONFIG[gnutls] = "--with-gnutls,--without-gnutls,gnutls"
@@ -42,6 +42,7 @@ PACKAGECONFIG[smtp] = "--enable-smtp,--disable-smtp,"
 PACKAGECONFIG[ssl] = "--with-ssl --with-random=/dev/urandom,--without-ssl,openssl"
 PACKAGECONFIG[telnet] = "--enable-telnet,--disable-telnet,"
 PACKAGECONFIG[tftp] = "--enable-tftp,--disable-tftp,"
+PACKAGECONFIG[thres] = "--enable-threaded-resolver, --disable-threaded-resolver"
 PACKAGECONFIG[zlib] = "--with-zlib=${STAGING_LIBDIR}/../,--without-zlib,zlib"
 PACKAGECONFIG[krb5] = "--with-gssapi,--without-gssapi,krb5"
 
-- 
2.14.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] curl: enable threaded resolver
  2017-09-04  7:57 [PATCH] curl: enable threaded resolver André Draszik
@ 2017-09-04  9:37 ` Burton, Ross
  2017-09-04  9:42 ` [PATCH v2] " André Draszik
  1 sibling, 0 replies; 3+ messages in thread
From: Burton, Ross @ 2017-09-04  9:37 UTC (permalink / raw)
  To: André Draszik; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 277 bytes --]

On 4 September 2017 at 08:57, André Draszik <git@andred.net> wrote:

> +PACKAGECONFIG[thres] = "--enable-threaded-resolver,
> --disable-threaded-resolver"
>

That's not the most obvious name for the option, how about just
"threaded-resolver" to make it clear?

Ross

[-- Attachment #2: Type: text/html, Size: 621 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2] curl: enable threaded resolver
  2017-09-04  7:57 [PATCH] curl: enable threaded resolver André Draszik
  2017-09-04  9:37 ` Burton, Ross
@ 2017-09-04  9:42 ` André Draszik
  1 sibling, 0 replies; 3+ messages in thread
From: André Draszik @ 2017-09-04  9:42 UTC (permalink / raw)
  To: openembedded-core

From: André Draszik <adraszik@tycoint.com>

Multi-threaded applications using libcurl crash
on DNS timeouts when built using OE.

The reason is as follows:
By default, libcurl implements DNS timeouts using a
timer (alarm()) and a pair of setjmp()/longjmp().
This approach is unsafe in multi-threaded applications
for various reasons, as e.g. explained in the relevant
man-pages.

To avoid this, libcurl can be compiled with a built-in
threaded resolver, or against the c-ares asynchronous
resolver library.

To keep extra dependencies to a minimum, and to mimic
other distributions (debian at least), and because
c-ares is not available in OE-core, add a PACKAGECONFIG
to be able to enable use of of the built-in threaded
resolver and enable it by default.

Signed-off-by: André Draszik <adraszik@tycoint.com>

---
v2: rename PACKAGECONFIG option from thres to threaded-resolver
---
 meta/recipes-support/curl/curl_7.54.1.bb | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/meta/recipes-support/curl/curl_7.54.1.bb b/meta/recipes-support/curl/curl_7.54.1.bb
index f42582a9f0..5c8072fc65 100644
--- a/meta/recipes-support/curl/curl_7.54.1.bb
+++ b/meta/recipes-support/curl/curl_7.54.1.bb
@@ -20,9 +20,9 @@ SRC_URI[sha256sum] = "fdfc4df2d001ee0c44ec071186e770046249263c491fcae48df0e1a3ca
 CVE_PRODUCT = "libcurl"
 inherit autotools pkgconfig binconfig multilib_header
 
-PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)} gnutls proxy zlib"
-PACKAGECONFIG_class-native = "ipv6 proxy ssl zlib"
-PACKAGECONFIG_class-nativesdk = "ipv6 proxy ssl zlib"
+PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)} gnutls proxy threaded-resolver zlib"
+PACKAGECONFIG_class-native = "ipv6 proxy ssl threaded-resolver zlib"
+PACKAGECONFIG_class-nativesdk = "ipv6 proxy ssl threaded-resolver zlib"
 
 PACKAGECONFIG[dict] = "--enable-dict,--disable-dict,"
 PACKAGECONFIG[gnutls] = "--with-gnutls,--without-gnutls,gnutls"
@@ -42,6 +42,7 @@ PACKAGECONFIG[smtp] = "--enable-smtp,--disable-smtp,"
 PACKAGECONFIG[ssl] = "--with-ssl --with-random=/dev/urandom,--without-ssl,openssl"
 PACKAGECONFIG[telnet] = "--enable-telnet,--disable-telnet,"
 PACKAGECONFIG[tftp] = "--enable-tftp,--disable-tftp,"
+PACKAGECONFIG[threaded-resolver] = "--enable-threaded-resolver,--disable-threaded-resolver"
 PACKAGECONFIG[zlib] = "--with-zlib=${STAGING_LIBDIR}/../,--without-zlib,zlib"
 PACKAGECONFIG[krb5] = "--with-gssapi,--without-gssapi,krb5"
 
-- 
2.14.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-09-04  9:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-04  7:57 [PATCH] curl: enable threaded resolver André Draszik
2017-09-04  9:37 ` Burton, Ross
2017-09-04  9:42 ` [PATCH v2] " André Draszik

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.