Re: Apache segmentation fault when loading libphp7.so

[email protected] (Kai Fürstenberg)
Newsgroups php.install
Message-ID <[email protected]>
Am 13.08.2020 um 15:28 schrieb Christoph M. Becker:
> On 13.08.2020 at 14:47, Kai Fürstenberg wrote:
> 
>> Am 13.08.2020 um 14:34 schrieb Christoph M. Becker:
>>
>>> On 13.08.2020 at 13:47, Kai Fürstenberg wrote:
>>>
>>>> Am 13.08.2020 um 12:53 schrieb Christoph M. Becker:
>>>>
>>>>> On 13.08.2020 at 11:52, Kai Fürstenberg wrote:
>>>>>
>>>>>> Am 13.08.2020 um 10:31 schrieb Christoph M. Becker:
>>>>>>
>>>>>>> On 12.08.2020 at 18:09, Kai Fürstenberg 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             __builtin_cpu_init();
>>>>>>>>
>>>>>>>> Before I had the fault
>>>>>>>>
>>>>>>>> #0  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_init()
>>>>>>> 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 else
>>>>>>> branch of the ternary operator swapped)?
>>>>>>>
>>>>>>> [1]
>>>>>>> <https://github.com/php/php-src/blob/php-7.3.21/acinclude.m4#L3261-L3278>
>>>>>>
>>>>>> config.log:
>>>>>> configure:13702: checking for __builtin_cpu_init
>>>>>> configure:13718: cc -o conftest -g -O2 -fvisibility=hidden -pthread
>>>>>> -D_REENTRANT  conftest.c -lm -ldl  -lpthread >&5
>>>>>> configure:13718: $? = 0
>>>>>> configure:13721: result: yes
>>>>>> configure:13741: checking for __builtin_cpu_supports
>>>>>> configure:13757: cc -o conftest -g -O2 -fvisibility=hidden -pthread
>>>>>> -D_REENTRANT  conftest.c -lm -ldl  -lpthread >&5
>>>>>> configure:13757: $? = 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 acinclude.m4
>>>> (in Zend subfolder, v7.3) only has about 200 lines (the mentioned part
>>>> is missing in this file) and in 7.4 this file is completely missing...
>>>
>>> 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 works.
> 
> For PHP 7.4, the relevant code has been moved to build/php.m4, where you
> could apply the patch manually.

found it, patched it, no success :-(

gdb sais during start:

(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".
[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

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();



(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=<optimized out>,
reloc_addr_arg=<optimized out>, version=<optimized out>, sym=<optimized
out>, reloc=0xb6eabe48, map=0x4eaa40)
    at ../sysdeps/i386/dl-machine.h:353
#2  elf_dynamic_do_Rel (skip_ifunc=<optimized out>, lazy=<optimized
out>, nrelative=<optimized out>, relsize=<optimized out>,
reladdr=<optimized out>, map=<optimized out>)
    at do-rel.h:137
#3  _dl_relocate_object (scope=<optimized out>, reloc_mode=<optimized
out>, consider_profiling=<optimized out>) at dl-reloc.c:258
#4  0xb7fe9efa in dl_open_worker (a=<optimized out>) at dl-open.c:377
#5  0xb7da0a9c in __GI__dl_catch_exception (exception=<optimized out>,
operate=<optimized out>, args=<optimized out>) at dl-error-skeleton.c:196
#6  0xb7fe98fe in _dl_open (file=0x4db670
"/usr/local/httpd-test/modules/libphp7.so", mode=-2147483390,
caller_dlopen=0xb7ec6934 <apr_dso_load+36>, nsid=<optimized out>, argc=6,
    argv=0xbffffc14, env=0xbffffc30) at dl-open.c:599
#7  0xb7e4a2c8 in dlopen_doit (a=0xbffff4dc) at dlopen.c:66
#8  0xb7da0a9c in __GI__dl_catch_exception (exception=<optimized out>,
operate=<optimized out>, args=<optimized out>) at dl-error-skeleton.c:196
#9  0xb7da0b40 in __GI__dl_catch_error (objname=0x4df47c,
errstring=0x4df480, mallocedp=0x4df478, operate=0xb7e4a250
<dlopen_doit>, args=0xbffff4dc) at dl-error-skeleton.c:215
#10 0xb7e4aa71 in _dlerror_run (operate=0xb7e4a250 <dlopen_doit>,
args=0xbffff4dc) at dlerror.c:163
#11 0xb7e4a366 in __dlopen (file=0x4db670
"/usr/local/httpd-test/modules/libphp7.so", mode=258) at dlopen.c:87
#12 0xb7ec6934 in apr_dso_load (res_handle=0xbffff694, path=0x4db670
"/usr/local/httpd-test/modules/libphp7.so", pool=0x4b0218) at
dso/unix/dso.c:139
#13 0x0045d295 in dso_load (cmd=cmd@entry=0xbffff9fc,
modhandlep=modhandlep@entry=0xbffff694, filename=filename@entry=0x4e8a18
"modules/libphp7.so", used_filename=0xbffff69c)
    at mod_so.c:162
#14 0x0045d53a in load_module (cmd=0xbffff9fc, dummy=0xbffff93c,
modname=0x4e8a08 "php7_module", filename=0x4e8a18 "modules/libphp7.so")
at mod_so.c:263
#15 0x00449ff2 in invoke_cmd (cmd=<optimized out>,
parms=parms@entry=0xbffff9fc, mconfig=mconfig@entry=0xbffff93c,
args=<optimized out>) at config.c:895
#16 0x0044ac98 in execute_now (p=0xbffff984, ptemp=0xbffff988,
parent=<optimized out>, sub_tree=<optimized out>, parms=<optimized out>,
    args=0x4dad03 "php7_module        modules/libphp7.so",
cmd_line=<optimized out>) at config.c:1707
#17 ap_build_config_sub (p=p@entry=0x4b0218,
temp_pool=temp_pool@entry=0x4dabe8, l=<optimized out>, parms=<optimized
out>, current=<optimized out>, curr_parent=<optimized out>,
    conftree=<optimized out>) at config.c:1171
#18 0x0044cba2 in ap_build_config (parms=0xbffff9fc, p=0x4b0218,
temp_pool=0x4dabe8, conftree=0x4a6628 <ap_conftree>) at config.c:1428
#19 0x0044d342 in ap_process_resource_config (s=0x4d7930, fname=0x4dd990
"/usr/local/httpd-test/conf/httpd.conf", conftree=0x4a6628
<ap_conftree>, p=<optimized out>,
    ptemp=0x4dabe8) at config.c:1877
#20 0x0044e135 in ap_read_config (process=<optimized out>,
ptemp=<optimized out>, filename=<optimized out>, conftree=<optimized
out>) at config.c:2339
#21 0x00425c33 in main (argc=<optimized out>, argv=<optimized out>) at
main.c:659

Kai
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.