Re: Apache segmentation fault when loading libphp7.so

[email protected] (Keith Roberts) Thu, 13 Aug 2020 09:20:54 +0100
Newsgroups php.install
Message-ID <[email protected]>
Could this be a bug in the PHP code:

https://bugs.php.net/bug.php?id=78769

Is __builtin_cpu_init part of PHP source code and what does 
__builtin_cpu_init function do?

Is it trying to check for some CPU flags that are not existent on your 
particular CPU?

Keith

On 13/08/2020 09:03, Kai Fürstenberg wrote:
> Am 12.08.2020 um 22:54 schrieb Keith Roberts:
>> Hi Kai,
>>
>> Have you uninstalled the debian default distro versions of httpd and PHP
>> as well?
>>
>> I have had issues when compiling apache and PHP with the distro versions
>> installed.
>>
>> They don't always work well side by side.
> Hi Keith,
>
> I never installed them. The initial installation was a minimal one and I
> always compiled these programs from source.
>
> But I re-checked and I have no distro versions of them.
>
> While checking distro or old versions of programs, I deleted any older
> version of gcc (in case of some lib confusion), but no change.
>
> I also checked the source code of PHP: The function __builtin_cpu_init
> was first used in the 7.3 versions, which explaines why I am not able to
> use any newer version as 7.2.x atm. In 7.2.33 this function is not used.
>
> Kai
>
>
>> Keith
>>
>> On 12/08/2020 17: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...
>>>
>>> Kai
>>>
>>>
>>>
>>>
>>> Am 11.08.2020 um 20:24 schrieb [email protected]:
>>>> Hi Keith,
>>>>
>>>> Am 11.08.2020 um 16:51 schrieb Keith Roberts:
>>>>> You could try logging PHP startup errors:
>>>>>
>>>>> https://www.php.net/manual/en/errorfunc.configuration.php#ini.display-startup-errors
>>>>
>>>>
>>>> this did not work. I have nothing on my screen or in any log.
>>>> php -i sais I used the correct php.ini
>>>>
>>>>> Or try running Apache daemon using valgrind:
>>>>>
>>>>> https://www.valgrind.org/docs/manual/quick-start.html
>>>> This was REALLY strange. I don't know if this is expected behaviour,
>>>> but using valgrind, the server is up and running.
>>>>
>>>> I created a full output, ...
>>>>
>>>> (valgrind --leak-check=full --show-leak-kinds=all -v
>>>> /usr/local/httpd-test/bin/httpd -k start)
>>>>
>>>> ... which you can find here:
>>>> https://pastebin.com/Dwgjxjgj
>>>>
>>>> Greets
>>>> Kai
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>> HTH
>>>>>
>>>>> Keith
>>>>>
>>>>> On 11/08/2020 13:54, Kai Fürstenberg wrote:
>>>>>> Hello Keith,
>>>>>>
>>>>>> no, it's not mod_alias, because debug log sais the module is loaded.
>>>>>> Without mod_alias it looks like below.
>>>>>>
>>>>>> When I comment out phplib7.so, the server starts and is online.
>>>>>>
>>>>>> I don't know if it helps: httpd sends a return code 139.
>>>>>> PHP in the CLI works.
>>>>>>
>>>>>>
>>>>>> [Tue Aug 11 14:49:21.635494 2020] [so:debug] [pid 25863:tid
>>>>>> 3082425792]
>>>>>> mod_so.c(266): AH01575: loaded module authn_file_module from
>>>>>> /usr/local/httpd-test/modules/mod_authn_file.so
>>>>>> [Tue Aug 11 14:49:21.635606 2020] [so:debug] [pid 25863:tid
>>>>>> 3082425792]
>>>>>> mod_so.c(266): AH01575: loaded module authn_core_module from
>>>>>> /usr/local/httpd-test/modules/mod_authn_core.so
>>>>>> [Tue Aug 11 14:49:21.635688 2020] [so:debug] [pid 25863:tid
>>>>>> 3082425792]
>>>>>> mod_so.c(266): AH01575: loaded module authz_host_module from
>>>>>> /usr/local/httpd-test/modules/mod_authz_host.so
>>>>>> [Tue Aug 11 14:49:21.635796 2020] [so:debug] [pid 25863:tid
>>>>>> 3082425792]
>>>>>> mod_so.c(266): AH01575: loaded module authz_groupfile_module from
>>>>>> /usr/local/httpd-test/modules/mod_authz_groupfile.so
>>>>>> [Tue Aug 11 14:49:21.635874 2020] [so:debug] [pid 25863:tid
>>>>>> 3082425792]
>>>>>> mod_so.c(266): AH01575: loaded module authz_user_module from
>>>>>> /usr/local/httpd-test/modules/mod_authz_user.so
>>>>>> [Tue Aug 11 14:49:21.666338 2020] [so:debug] [pid 25863:tid
>>>>>> 3082425792]
>>>>>> mod_so.c(266): AH01575: loaded module authz_core_module from
>>>>>> /usr/local/httpd-test/modules/mod_authz_core.so
>>>>>> [Tue Aug 11 14:49:21.666433 2020] [so:debug] [pid 25863:tid
>>>>>> 3082425792]
>>>>>> mod_so.c(266): AH01575: loaded module access_compat_module from
>>>>>> /usr/local/httpd-test/modules/mod_access_compat.so
>>>>>> [Tue Aug 11 14:49:21.666522 2020] [so:debug] [pid 25863:tid
>>>>>> 3082425792]
>>>>>> mod_so.c(266): AH01575: loaded module auth_basic_module from
>>>>>> /usr/local/httpd-test/modules/mod_auth_basic.so
>>>>>> [Tue Aug 11 14:49:21.666617 2020] [so:debug] [pid 25863:tid
>>>>>> 3082425792]
>>>>>> mod_so.c(266): AH01575: loaded module reqtimeout_module from
>>>>>> /usr/local/httpd-test/modules/mod_reqtimeout.so
>>>>>> [Tue Aug 11 14:49:21.666713 2020] [so:debug] [pid 25863:tid
>>>>>> 3082425792]
>>>>>> mod_so.c(266): AH01575: loaded module filter_module from
>>>>>> /usr/local/httpd-test/modules/mod_filter.so
>>>>>> [Tue Aug 11 14:49:21.666805 2020] [so:debug] [pid 25863:tid
>>>>>> 3082425792]
>>>>>> mod_so.c(266): AH01575: loaded module mime_module from
>>>>>> /usr/local/httpd-test/modules/mod_mime.so
>>>>>> [Tue Aug 11 14:49:21.666907 2020] [so:debug] [pid 25863:tid
>>>>>> 3082425792]
>>>>>> mod_so.c(266): AH01575: loaded module log_config_module from
>>>>>> /usr/local/httpd-test/modules/mod_log_config.so
>>>>>> [Tue Aug 11 14:49:21.666999 2020] [so:debug] [pid 25863:tid
>>>>>> 3082425792]
>>>>>> mod_so.c(266): AH01575: loaded module env_module from
>>>>>> /usr/local/httpd-test/modules/mod_env.so
>>>>>> [Tue Aug 11 14:49:21.667102 2020] [so:debug] [pid 25863:tid
>>>>>> 3082425792]
>>>>>> mod_so.c(266): AH01575: loaded module headers_module from
>>>>>> /usr/local/httpd-test/modules/mod_headers.so
>>>>>> [Tue Aug 11 14:49:21.667195 2020] [so:debug] [pid 25863:tid
>>>>>> 3082425792]
>>>>>> mod_so.c(266): AH01575: loaded module setenvif_module from
>>>>>> /usr/local/httpd-test/modules/mod_setenvif.so
>>>>>> [Tue Aug 11 14:49:21.667298 2020] [so:debug] [pid 25863:tid
>>>>>> 3082425792]
>>>>>> mod_so.c(266): AH01575: loaded module version_module from
>>>>>> /usr/local/httpd-test/modules/mod_version.so
>>>>>> [Tue Aug 11 14:49:21.667395 2020] [so:debug] [pid 25863:tid
>>>>>> 3082425792]
>>>>>> mod_so.c(266): AH01575: loaded module unixd_module from
>>>>>> /usr/local/httpd-test/modules/mod_unixd.so
>>>>>> [Tue Aug 11 14:49:21.667484 2020] [so:debug] [pid 25863:tid
>>>>>> 3082425792]
>>>>>> mod_so.c(266): AH01575: loaded module status_module from
>>>>>> /usr/local/httpd-test/modules/mod_status.so
>>>>>> [Tue Aug 11 14:49:21.667588 2020] [so:debug] [pid 25863:tid
>>>>>> 3082425792]
>>>>>> mod_so.c(266): AH01575: loaded module autoindex_module from
>>>>>> /usr/local/httpd-test/modules/mod_autoindex.so
>>>>>> [Tue Aug 11 14:49:21.667680 2020] [so:debug] [pid 25863:tid
>>>>>> 3082425792]
>>>>>> mod_so.c(266): AH01575: loaded module dir_module from
>>>>>> /usr/local/httpd-test/modules/mod_dir.so
>>>>>> Speicherzugriffsfehler
>>>>>>
>>>>>> Kai
>>>>>>
>>>>>>
>>>>>> Am 11.08.2020 um 14:05 schrieb Keith Roberts:
>>>>>>> Hi Kai,
>>>>>>>
>>>>>>> Is it seg faulting when the mod_alias mod is loaded?
>>>>>>>
>>>>>>> Can you try to run apache and PHP module without the mod_alias
>>>>>>> module to
>>>>>>> see if it happens then?
>>>>>>>
>>>>>>> Kind Regards,
>>>>>>>
>>>>>>> Keith Roberts
>>>>>>>
>>>>>>> On 11/08/2020 11:21, Kai Fürstenberg wrote:
>>>>>>>> /usr/local/httpd-test/modules/mod_dir.so
>>>>>>>> [Tue Aug 11 12:04:48.058215 2020] [so:debug] [pid 24664:tid
>>>>>>>> 3083007424]
>>>>>>>> mod_so.c(266): AH01575: loaded module alias_module from
>>>>>>>> /usr/local/httpd-test/modules/mod_alias.so
>>>>>>>> Speicherzugriffsfehler
>>>>>>>>
>>>>>>>> "Speicherzugrifftsfehler" = "Segmentation fault"