Re: Apache segmentation fault when loading libphp7.so

[email protected] (Kai Fürstenberg) Mon, 17 Aug 2020 09:41:39 +0200
Newsgroups php.install
Message-ID <[email protected]>
Hello Christoph and Keith,

as the apache module is still not starting, I have accepted a suggestion
from the httpd mailing list to try php-fpm instead.

This now works great and I have already transferred it from testing to
production.

Thank you for your help.

Kai



Am 13.08.2020 um 16:40 schrieb Kai F=C3=BCrstenberg:
> Am 13.08.2020 um 15:28 schrieb Christoph M. Becker:
>> On 13.08.2020 at 14:47, Kai F=C3=BCrstenberg wrote:
>>
>>> Am 13.08.2020 um 14:34 schrieb Christoph M. Becker:
>>>
>>>> On 13.08.2020 at 13:47, Kai F=C3=BCrstenberg wrote:
>>>>
>>>>> Am 13.08.2020 um 12:53 schrieb Christoph M. Becker:
>>>>>
>>>>>> On 13.08.2020 at 11:52, Kai F=C3=BCrstenberg wrote:
>>>>>>
>>>>>>> Am 13.08.2020 um 10:31 schrieb Christoph M. Becker:
>>>>>>>
>>>>>>>> On 12.08.2020 at 18:09, Kai F=C3=BCrstenberg wrote:
>>>>>>>>
>>>>>>>>> Hello everybody,
>>>>>>>>>
>>>>>>>>> and thank you for you help so far.
>>>>>>>>>
>>>>>>>>> I played around with gdb a little bit.
>>>>>>>>>
>>>>>>>>> I re-configured php the way I did in 7.2 (just with some slight=

>>>>>>>>> modifications), to use mysql, gd and some other things.
>>>>>>>>>
>>>>>>>>> But this time, httpd stops with
>>>>>>>>>
>>>>>>>>> Program received signal SIGSEGV, Segmentation fault.
>>>>>>>>> resolve_stripslashes () at
>>>>>>>>> /usr/src/apache_testing/php-7.4.9/Zend/zend_cpuinfo.h:157
>>>>>>>>> 157=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0 __builtin_cpu_init();
>>>>>>>>>
>>>>>>>>> Before I had the fault
>>>>>>>>>
>>>>>>>>> #0=C2=A0 resolve_base64_decode () at
>>>>>>>>> /usr/src/apache_testing/php-7.4.9/Zend/zend_cpuinfo.h:141
>>>>>>>>>
>>>>>>>>> Line 141 of zend_cpuinfo.h is the very same command
>>>>>>>>> __builtin_cpu_init()
>>>>>>>>>
>>>>>>>>> It seems, that exactly this command __builtin_cpu_init() fails =
for some
>>>>>>>>> reason...
>>>>>>>>
>>>>>>>> Did you check config.log?  There is a test for __builtin_cpu_ini=
t()
>>>>>>>> availability[1] which apparently succeeds on your system, but it=
's worth
>>>>>>>> to actually look that up in config.log.  Maybe this test should =
use
>>>>>>>> AC_RUN_IFELSE instead of AC_LINK_IFELSE (and have the then and e=
lse
>>>>>>>> branch of the ternary operator swapped)?
>>>>>>>>
>>>>>>>> [1]
>>>>>>>> <https://github.com/php/php-src/blob/php-7.3.21/acinclude.m4#L32=
61-L3278>
>>>>>>>
>>>>>>> config.log:
>>>>>>> configure:13702: checking for __builtin_cpu_init
>>>>>>> configure:13718: cc -o conftest -g -O2 -fvisibility=3Dhidden -pth=
read
>>>>>>> -D_REENTRANT  conftest.c -lm -ldl  -lpthread >&5
>>>>>>> configure:13718: $? =3D 0
>>>>>>> configure:13721: result: yes
>>>>>>> configure:13741: checking for __builtin_cpu_supports
>>>>>>> configure:13757: cc -o conftest -g -O2 -fvisibility=3Dhidden -pth=
read
>>>>>>> -D_REENTRANT  conftest.c -lm -ldl  -lpthread >&5
>>>>>>> configure:13757: $? =3D 0
>>>>>>> configure:13760: result: yes
>>>>>>>
>>>>>>> I just don't understand what you mean with the link...
>>>>>>
>>>>>> I basically suggested to apply
>>>>>> <https://gist.github.com/cmb69/3fd0106ce78446c9e10e54eec21a4d82>, =
and to
>>>>>> run ./configure again.  Would the result still be "yes"?
>>>>>
>>>>> OK, so far so good.
>>>>>
>>>>> I just wonder, which file you want me to patch, because my acinclud=
e.m4
>>>>> (in Zend subfolder, v7.3) only has about 200 lines (the mentioned p=
art
>>>>> is missing in this file) and in 7.4 this file is completely missing=
=2E..
>>>>
>>>> The patch is about acinclude.m4 in the toplevel folder:
>>>> <https://github.com/php/php-src/blob/php-7.3.21/acinclude.m4>.
>>>
>>> This file is not available in 7.4. In 7.3 it's there, but not 7.4.
>>> I can try 7.3 with your patch. Just gimme some time and see if this w=
orks.
>>
>> For PHP 7.4, the relevant code has been moved to build/php.m4, where y=
ou
>> could apply the patch manually.
>=20
> found it, patched it, no success :-(
>=20
> gdb sais during start:
>=20
> (gdb) run -X -e debug -k start
> Starting program: /usr/local/httpd-test/bin/httpd -X -e debug -k start
> [Thread debugging using libthread_db enabled]
> Using host libthread_db library "/lib/i386-linux-gnu/libthread_db.so.1"=
=2E
> [Thu Aug 13 16:37:33.167001 2020] [so:debug] [pid 25320:tid 3083007424]=

> mod_so.c(266): AH01575: loaded module authn_file_module from
> /usr/local/httpd-test/modules/mod_authn_file.so
> [Thu Aug 13 16:37:33.172838 2020] [so:debug] [pid 25320:tid 3083007424]=

> mod_so.c(266): AH01575: loaded module authn_core_module from
> /usr/local/httpd-test/modules/mod_authn_core.so
> [Thu Aug 13 16:37:33.180461 2020] [so:debug] [pid 25320:tid 3083007424]=

> mod_so.c(266): AH01575: loaded module authz_host_module from
> /usr/local/httpd-test/modules/mod_authz_host.so
> [Thu Aug 13 16:37:33.188699 2020] [so:debug] [pid 25320:tid 3083007424]=

> mod_so.c(266): AH01575: loaded module authz_groupfile_module from
> /usr/local/httpd-test/modules/mod_authz_groupfile.so
> [Thu Aug 13 16:37:33.192880 2020] [so:debug] [pid 25320:tid 3083007424]=

> mod_so.c(266): AH01575: loaded module authz_user_module from
> /usr/local/httpd-test/modules/mod_authz_user.so
> [Thu Aug 13 16:37:33.198609 2020] [so:debug] [pid 25320:tid 3083007424]=

> mod_so.c(266): AH01575: loaded module authz_core_module from
> /usr/local/httpd-test/modules/mod_authz_core.so
> [Thu Aug 13 16:37:33.203728 2020] [so:debug] [pid 25320:tid 3083007424]=

> mod_so.c(266): AH01575: loaded module access_compat_module from
> /usr/local/httpd-test/modules/mod_access_compat.so
> [Thu Aug 13 16:37:33.209049 2020] [so:debug] [pid 25320:tid 3083007424]=

> mod_so.c(266): AH01575: loaded module auth_basic_module from
> /usr/local/httpd-test/modules/mod_auth_basic.so
> [Thu Aug 13 16:37:33.214484 2020] [so:debug] [pid 25320:tid 3083007424]=

> mod_so.c(266): AH01575: loaded module reqtimeout_module from
> /usr/local/httpd-test/modules/mod_reqtimeout.so
> [Thu Aug 13 16:37:33.219988 2020] [so:debug] [pid 25320:tid 3083007424]=

> mod_so.c(266): AH01575: loaded module filter_module from
> /usr/local/httpd-test/modules/mod_filter.so
> [Thu Aug 13 16:37:33.225700 2020] [so:debug] [pid 25320:tid 3083007424]=

> mod_so.c(266): AH01575: loaded module mime_module from
> /usr/local/httpd-test/modules/mod_mime.so
> [Thu Aug 13 16:37:33.233384 2020] [so:debug] [pid 25320:tid 3083007424]=

> mod_so.c(266): AH01575: loaded module log_config_module from
> /usr/local/httpd-test/modules/mod_log_config.so
> [Thu Aug 13 16:37:33.238389 2020] [so:debug] [pid 25320:tid 3083007424]=

> mod_so.c(266): AH01575: loaded module env_module from
> /usr/local/httpd-test/modules/mod_env.so
> [Thu Aug 13 16:37:33.244778 2020] [so:debug] [pid 25320:tid 3083007424]=

> mod_so.c(266): AH01575: loaded module headers_module from
> /usr/local/httpd-test/modules/mod_headers.so
> [Thu Aug 13 16:37:33.250135 2020] [so:debug] [pid 25320:tid 3083007424]=

> mod_so.c(266): AH01575: loaded module setenvif_module from
> /usr/local/httpd-test/modules/mod_setenvif.so
> [Thu Aug 13 16:37:33.254650 2020] [so:debug] [pid 25320:tid 3083007424]=

> mod_so.c(266): AH01575: loaded module version_module from
> /usr/local/httpd-test/modules/mod_version.so
> [Thu Aug 13 16:37:33.259923 2020] [so:debug] [pid 25320:tid 3083007424]=

> mod_so.c(266): AH01575: loaded module unixd_module from
> /usr/local/httpd-test/modules/mod_unixd.so
> [Thu Aug 13 16:37:33.266106 2020] [so:debug] [pid 25320:tid 3083007424]=

> mod_so.c(266): AH01575: loaded module status_module from
> /usr/local/httpd-test/modules/mod_status.so
> [Thu Aug 13 16:37:33.272127 2020] [so:debug] [pid 25320:tid 3083007424]=

> mod_so.c(266): AH01575: loaded module autoindex_module from
> /usr/local/httpd-test/modules/mod_autoindex.so
> [Thu Aug 13 16:37:33.276585 2020] [so:debug] [pid 25320:tid 3083007424]=

> mod_so.c(266): AH01575: loaded module dir_module from
> /usr/local/httpd-test/modules/mod_dir.so
> [Thu Aug 13 16:37:33.282635 2020] [so:debug] [pid 25320:tid 3083007424]=

> mod_so.c(266): AH01575: loaded module alias_module from
> /usr/local/httpd-test/modules/mod_alias.so
>=20
> Program received signal SIGSEGV, Segmentation fault.
> resolve_stripslashes () at
> /usr/src/apache_testing/php-7.4.9/Zend/zend_cpuinfo.h:157
> 157             __builtin_cpu_init();
>=20
>=20
>=20
> (gdb) bt
> #0  resolve_stripslashes () at
> /usr/src/apache_testing/php-7.4.9/Zend/zend_cpuinfo.h:157
> #1  0xb7fe2aa2 in elf_machine_rel (skip_ifunc=3D<optimized out>,
> reloc_addr_arg=3D<optimized out>, version=3D<optimized out>, sym=3D<opt=
imized
> out>, reloc=3D0xb6eabe48, map=3D0x4eaa40)
>     at ../sysdeps/i386/dl-machine.h:353
> #2  elf_dynamic_do_Rel (skip_ifunc=3D<optimized out>, lazy=3D<optimized=

> out>, nrelative=3D<optimized out>, relsize=3D<optimized out>,
> reladdr=3D<optimized out>, map=3D<optimized out>)
>     at do-rel.h:137
> #3  _dl_relocate_object (scope=3D<optimized out>, reloc_mode=3D<optimiz=
ed
> out>, consider_profiling=3D<optimized out>) at dl-reloc.c:258
> #4  0xb7fe9efa in dl_open_worker (a=3D<optimized out>) at dl-open.c:377=

> #5  0xb7da0a9c in __GI__dl_catch_exception (exception=3D<optimized out>=
,
> operate=3D<optimized out>, args=3D<optimized out>) at dl-error-skeleton=
=2Ec:196
> #6  0xb7fe98fe in _dl_open (file=3D0x4db670
> "/usr/local/httpd-test/modules/libphp7.so", mode=3D-2147483390,
> caller_dlopen=3D0xb7ec6934 <apr_dso_load+36>, nsid=3D<optimized out>, a=
rgc=3D6,
>     argv=3D0xbffffc14, env=3D0xbffffc30) at dl-open.c:599
> #7  0xb7e4a2c8 in dlopen_doit (a=3D0xbffff4dc) at dlopen.c:66
> #8  0xb7da0a9c in __GI__dl_catch_exception (exception=3D<optimized out>=
,
> operate=3D<optimized out>, args=3D<optimized out>) at dl-error-skeleton=
=2Ec:196
> #9  0xb7da0b40 in __GI__dl_catch_error (objname=3D0x4df47c,
> errstring=3D0x4df480, mallocedp=3D0x4df478, operate=3D0xb7e4a250
> <dlopen_doit>, args=3D0xbffff4dc) at dl-error-skeleton.c:215
> #10 0xb7e4aa71 in _dlerror_run (operate=3D0xb7e4a250 <dlopen_doit>,
> args=3D0xbffff4dc) at dlerror.c:163
> #11 0xb7e4a366 in __dlopen (file=3D0x4db670
> "/usr/local/httpd-test/modules/libphp7.so", mode=3D258) at dlopen.c:87
> #12 0xb7ec6934 in apr_dso_load (res_handle=3D0xbffff694, path=3D0x4db67=
0
> "/usr/local/httpd-test/modules/libphp7.so", pool=3D0x4b0218) at
> dso/unix/dso.c:139
> #13 0x0045d295 in dso_load (cmd=3Dcmd@entry=3D0xbffff9fc,
> modhandlep=3Dmodhandlep@entry=3D0xbffff694, filename=3Dfilename@entry=3D=
0x4e8a18
> "modules/libphp7.so", used_filename=3D0xbffff69c)
>     at mod_so.c:162
> #14 0x0045d53a in load_module (cmd=3D0xbffff9fc, dummy=3D0xbffff93c,
> modname=3D0x4e8a08 "php7_module", filename=3D0x4e8a18 "modules/libphp7.=
so")
> at mod_so.c:263
> #15 0x00449ff2 in invoke_cmd (cmd=3D<optimized out>,
> parms=3Dparms@entry=3D0xbffff9fc, mconfig=3Dmconfig@entry=3D0xbffff93c,=

> args=3D<optimized out>) at config.c:895
> #16 0x0044ac98 in execute_now (p=3D0xbffff984, ptemp=3D0xbffff988,
> parent=3D<optimized out>, sub_tree=3D<optimized out>, parms=3D<optimize=
d out>,
>     args=3D0x4dad03 "php7_module        modules/libphp7.so",
> cmd_line=3D<optimized out>) at config.c:1707
> #17 ap_build_config_sub (p=3Dp@entry=3D0x4b0218,
> temp_pool=3Dtemp_pool@entry=3D0x4dabe8, l=3D<optimized out>, parms=3D<o=
ptimized
> out>, current=3D<optimized out>, curr_parent=3D<optimized out>,
>     conftree=3D<optimized out>) at config.c:1171
> #18 0x0044cba2 in ap_build_config (parms=3D0xbffff9fc, p=3D0x4b0218,
> temp_pool=3D0x4dabe8, conftree=3D0x4a6628 <ap_conftree>) at config.c:14=
28
> #19 0x0044d342 in ap_process_resource_config (s=3D0x4d7930, fname=3D0x4=
dd990
> "/usr/local/httpd-test/conf/httpd.conf", conftree=3D0x4a6628
> <ap_conftree>, p=3D<optimized out>,
>     ptemp=3D0x4dabe8) at config.c:1877
> #20 0x0044e135 in ap_read_config (process=3D<optimized out>,
> ptemp=3D<optimized out>, filename=3D<optimized out>, conftree=3D<optimi=
zed
> out>) at config.c:2339
> #21 0x00425c33 in main (argc=3D<optimized out>, argv=3D<optimized out>)=
 at
> main.c:659
>=20
> Kai
>=20