Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Apr 2019 17:07:26 -0300
From:      Marcel Bonnet <marcelbonnet@gmail.com>
To:        Stefan Bethke <stb@lassitu.de>
Cc:        Mathieu Arnold <mat@freebsd.org>, Kurt Jaeger <pi@freebsd.org>,  FreeBSD Ports <freebsd-ports@freebsd.org>
Subject:   Re: PHP 7.2: SIGSEGV in OpenSSL
Message-ID:  <CAPe0dB=hfz8gt3wZe2y8LXFU8w6ucfrXvJOjXxKefuz5ro-psg@mail.gmail.com>
In-Reply-To: <0AEC703C-5ACE-44BD-A9D3-70ABBA8785EB@lassitu.de>
References:  <67841009-B4BC-4F0A-BB53-77487EE19CBD@lassitu.de> <CAPe0dBk7DAq9cWSzjwcKGzadjeDtjcmz3KmQq2hD=sYf-JOgKQ@mail.gmail.com> <20190423160110.GS72200@home.opsec.eu> <0D187548-4221-4DA5-9A22-8478D9FB32F3@lassitu.de> <20190424205044.ll3rsu3hhfwxrxof@atuin.in.mat.cc> <0AEC703C-5ACE-44BD-A9D3-70ABBA8785EB@lassitu.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 24 Apr 2019 at 18:03, Stefan Bethke <stb@lassitu.de> wrote:

> Am 24.04.2019 um 22:50 schrieb Mathieu Arnold <mat@FreeBSD.org>:
>
> On Wed, Apr 24, 2019 at 06:34:06PM +0200, Stefan Bethke wrote:
>
> Am 23.04.2019 um 18:01 schrieb Kurt Jaeger <pi@freebsd.org>:
>
> Hi!
>
> Did you find a solution? Please let me know.
>
>
> There's a well-known problem in the sequence in which php modules
> are loaded. I don't know if this is the case here as well,
> but that's what we do:
>
> fetch -o fixphpextorder \
>       https://people.freebsd.org/~ohauer/scripts/fixphpextorder.sh
> chmod 755 fixphpextorder
>
> cd /usr/local/etc/php
> cat ext-*ini > extensions.ini
> fixphpextorder
> mv extensions.ini.new extensions.ini
> rm ext-*ini
>
> Please test and report if it fixes the problem.
>
>
> Thanks Kurt, it appears to fix (or at least work around) the problem.
>
> Why is the default load order broken? Why does it not affect everyone?
>
> I moved all the individual inis into a bak subdir, and now only have an
> extensions.ini.
>
> If I understand correctly, mod_php/PHP reads the individual inis in order=
.
> Why aren=E2=80=99t they in the right order? Can this be fixed in the port=
s for the
> PHP modules?
>
>
> Could you give the order that works for you, so that we can try to
> figure out which module is making it break ?
>
> Because there is no "right" order, there is an order that can work for
> most people, and from time to time, two libs have conflicting symbols,
> but it is not possible to detect that.  So I made up an order that
> should be ok, but some time is not.
>
>
> This is the order I=E2=80=99m actively using now:
> $ cat extensions.ini
> extension=3Dsession.so
> extension=3Dfileinfo.so
> extension=3Dldap.so
> extension=3Dsimplexml.so
> extension=3Dctype.so
> extension=3Dmbstring.so
> extension=3Dtokenizer.so
> extension=3Dfilter.so
> extension=3Dpgsql.so
> extension=3Dmcrypt.so
> extension=3Dgd.so
> extension=3Dgettext.so
> extension=3Diconv.so
> extension=3Dzlib.so
> extension=3Dcurl.so
> extension=3Dxmlrpc.so
> extension=3Dbz2.so
> extension=3Dopenssl.so
> extension=3Ddom.so
> extension=3Dhash.so
> extension=3Dwddx.so
> extension=3Dmemcache.so
> extension=3Dsoap.so
> extension=3Dpdo.so
> extension=3Dpdo_mysql.so
> extension=3Dmysqli.so
> extension=3Dsockets.so
> extension=3Dxml.so
> ; additional extension(s) not known by fixphpextorder.sh
> extension=3Dintl.so
> extension=3Djson.so
> extension=3Dsqlite3.so
> extension=3Dzip.so
> extension=3Dmemcached.so
> extension=3Dpdo_pgsql.so
> extension=3Dphar.so
>
> This is the order as installed by the ports (at least I think that=E2=80=
=99s the
> order PHP will read the files):
> $ cat $(echo bak/*.ini|sort)
> zend_extension=3Dopcache.so
> extension=3Dsession.so
> extension=3Dbz2.so
> extension=3Dctype.so
> extension=3Dcurl.so
> extension=3Ddom.so
> extension=3Dfileinfo.so
> extension=3Dfilter.so
> extension=3Dgd.so
> extension=3Dgettext.so
> extension=3Dhash.so
> extension=3Diconv.so
> extension=3Dintl.so
> extension=3Djson.so
> extension=3Dldap.so
> extension=3Dmbstring.so
> extension=3Dmcrypt.so
> extension=3Dmysqli.so
> extension=3Dopenssl.so
> extension=3Dpdo.so
> extension=3Dpgsql.so
> extension=3Dsimplexml.so
> extension=3Dsoap.so
> extension=3Dsockets.so
> extension=3Dsqlite3.so
> extension=3Dtokenizer.so
> extension=3Dxml.so
> extension=3Dzip.so
> extension=3Dzlib.so
> extension=3Dmemcache.so
> extension=3Dmemcached.so
> extension=3Dpdo_mysql.so
> extension=3Dpdo_pgsql.so
> extension=3Dphar.so
> extension=3Dwddx.so
> extension=3Dxmlrpc.so
>
> This is the contents of bak (the former contents of /usr/local/etc/php):
> $ ls bak
> ext-10-opcache.ini ext-20-intl.ini ext-20-sqlite3.ini
> ext-18-session.ini ext-20-json.ini ext-20-tokenizer.ini
> ext-20-bz2.ini ext-20-ldap.ini ext-20-xml.ini
> ext-20-ctype.ini ext-20-mbstring.ini ext-20-zip.ini
> ext-20-curl.ini ext-20-mcrypt.ini ext-20-zlib.ini
> ext-20-dom.ini ext-20-mysqli.ini ext-30-memcache.ini
> ext-20-fileinfo.ini ext-20-openssl.ini ext-30-memcached.ini
> ext-20-filter.ini ext-20-pdo.ini ext-30-pdo_mysql.ini
> ext-20-gd.ini ext-20-pgsql.ini ext-30-pdo_pgsql.ini
> ext-20-gettext.ini ext-20-simplexml.ini ext-30-phar.ini
> ext-20-hash.ini ext-20-soap.ini ext-30-wddx.ini
> ext-20-iconv.ini ext-20-sockets.ini ext-30-xmlrpc.ini
>
>
> These are the PHP packages I have installed, minus the web apps:
> $ pkg info -r php72
> php72-7.2.17_2:
> php72-xml-7.2.17_2
> php72-hash-7.2.17_2
> php72-session-7.2.17_2
> php72-openssl-7.2.17_2
> php72-xmlrpc-7.2.17_2
> php72-mysqli-7.2.17_2
> php72-mbstring-7.2.17_2
> php72-phar-7.2.17_2
> php72-ctype-7.2.17_2
> php72-tokenizer-7.2.17_2
> php72-json-7.2.17_2
> php72-filter-7.2.17_2
> php72-gd-7.2.17_2
> php72-zlib-7.2.17_2
> php72-zip-7.2.17_2
> php72-bz2-7.2.17_2
> php72-iconv-7.2.17_2
> php72-fileinfo-7.2.17_2
> php72-pgsql-7.2.17_2
> php72-opcache-7.2.17_2
> php72-wddx-7.2.17_2
> php72-simplexml-7.2.17_2
> php72-dom-7.2.17_2
> php72-pecl-mcrypt-1.0.2
> php72-soap-7.2.17_2
> php72-ldap-7.2.17_2
> php72-curl-7.2.17_2
> php72-sqlite3-7.2.17_2
> php72-pdo-7.2.17_2
> php72-memcache-4.0.3
> php72-pecl-memcached-3.1.3
> php72-sockets-7.2.17_2
> php72-intl-7.2.17_2
> php72-gettext-7.2.17_2
> php72-pdo_pgsql-7.2.17_2
> php72-pdo_mysql-7.2.17_2
>
>
>
> --
> Stefan Bethke <stb@lassitu.de>   Fon +49 151 14070811
>
> Thank you so much, fellows!

These are the extensions currently installed:
[@machine php #]  pkg info -iqox php73
lang/php73
devel/php-composer
textproc/php73-ctype
ftp/php73-curl
security/php73-filter
security/php73-hash
devel/php73-intl
devel/php73-json
converters/php73-mbstring
www/php73-opcache
security/php73-openssl
archivers/php73-phar

The fixphpextorder script did not work. So, I tried to change the order of
any extension that seemed to require openssl . Reading the coredump, I
supposed some lib was not finding openssl into the stack.
So I put curl.so below openssl.so , and now it works.

[@machine php #]  cat extensions.ini
extension=3Dctype.so
extension=3Dmbstring.so
extension=3Dfilter.so
extension=3Dopenssl.so
extension=3Dcurl.so
extension=3Dhash.so
; additional extension(s) not known by fixphpextorder.sh
extension=3Dintl.so
extension=3Djson.so
extension=3Dphar.so

Cheers,

--=20
Marcel Bonnet



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAPe0dB=hfz8gt3wZe2y8LXFU8w6ucfrXvJOjXxKefuz5ro-psg>