textproc/libxml: remove --without-threads option

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

textproc/libxml: remove --without-threads option

Sebastien Marie-3
Hi,

The following diff removes --without-threads option from libxml2 build.

The reason is it makes libxml2 not thread safe, and we are using it
in threaded programs, resulting possible memory corruption.

I found it while chasing a bug (corrupted canary/double free reported by
free(3)) on program of mine, from python to lxml to libxml.

With the current textproc/libxml build, the testsuite of
textproc/py-lxml doesn't pass. It fails on test_thread_error_log test
case (passing MALLOC_OPTIONS=S helps a lot for the reproductibility).

The lxml test calls in loop, and in several threads, XML parsing on
errornous documents and check the error. The test dies because free(3)
detects memory corruption and call abort(3).

Without the option --without-threads on libxml, the lxml's test passes.

I checked on amd64 that no symbols were added/removed on libxml2.so, and
WANTLIB is still the same too (pthread was already here). The testsuite
of libxml still pass and the one from py-lxml passes (whereas it wasn't
the case before).

I would be interested to know any downside of enabling thread safety on
libxml2.

Thanks.
--
Sebastien Marie


Index: Makefile
===================================================================
RCS file: /cvs/ports/textproc/libxml/Makefile,v
retrieving revision 1.175
diff -u -p -r1.175 Makefile
--- Makefile 30 Jun 2018 11:41:36 -0000 1.175
+++ Makefile 12 Jan 2019 15:06:13 -0000
@@ -10,7 +10,7 @@ PKGNAME-python= py-libxml-${VERSION}
 SHARED_LIBS += xml2                 16.1     # 11.8
 CATEGORIES= textproc
 MASTER_SITES= ftp://xmlsoft.org/libxml/
-REVISION-main= 0
+REVISION-main= 1
 
 HOMEPAGE= http://xmlsoft.org/
 
@@ -28,8 +28,8 @@ CONFIGURE_ARGS+= --enable-static \
  --with-html-dir="${PREFIX}/share/doc" \
  --with-html-subdir="libxml2/html" \
  --with-iconv="${LOCALBASE}" \
- --with-lzma="${LOCALBASE}" \
- --without-threads
+ --with-lzma="${LOCALBASE}"
+
 # only used to fetch data during regression test
 CONFIGURE_ENV= WGET=/usr/bin/ftp
 

Reply | Threaded
Open this post in threaded view
|

Re: textproc/libxml: remove --without-threads option

Matthias Kilian
Hi,

On Sat, Jan 12, 2019 at 07:24:59PM +0100, Sebastien Marie wrote:

> The lxml test calls in loop, and in several threads, XML parsing on
> errornous documents and check the error. The test dies because free(3)
> detects memory corruption and call abort(3).
>
> Without the option --without-threads on libxml, the lxml's test passes.
>
> I checked on amd64 that no symbols were added/removed on libxml2.so, and
> WANTLIB is still the same too (pthread was already here). The testsuite
> of libxml still pass and the one from py-lxml passes (whereas it wasn't
> the case before).
>
> I would be interested to know any downside of enabling thread safety on
> libxml2.

I'd say, just let's try it. The --without-threads had been added a long
time before we got rthreads, and it may be that nobody since then tried
to remove it:

----------------------------
revision 1.67
date: 2003/08/26 16:33:11;  author: marcm;  state: Exp;  lines: +3 -2;
branches:  1.67.2;
Update again to 2.5.10 and this time *disable threading*.  Reports are
that this fixes a whole range of breakage with other ports that were
confused by the threading option.

ok naddy@
=============================================================================

Ciao,
        Kili