Edit report at https://bugs.php.net/bug.php?id=78303&edit=1
ID: 78303
Comment by: theultramage at gmail dot com
Reported by: theultramage at gmail dot com
Summary: repeating crashes in php_basename with
event-mpm+mod_php
Status: Feedback
Type: Bug
Package: *General Issues
Operating System: FreeBSD 12.0
PHP Version: 7.3.7
Assigned To: nikita
Block user comment: N
Private report: N
New Comment:
Ah, it's been a while. Back then I did contact the maintainer and they did undo the most
problematic edit, but left in the disabling of PTHREADS_CHECK section because it was supposedly
malfunctioning and aborting for php74. The patch is still there for php80. Afterwards the segfaults
still kept happening, just in other places, so I gave up.
The most recent version I've been running is PHP 7.3.20 with ZTS and DEBUG. Since aug6 I have
logged a segfault on aug8, oct1, oct12, oct17, nov22. None since then. There have been no changes to
the system or my usage pattern since aug6, so I cannot give effective feedback on why it seemingly
stopped crashing. Either it's just luck, or whatever crawler or exploitbot was directly causing
the crash or causing cpu load that was triggering a race condition, has stopped targeting the
server.
At this point in time, the version numbers have gone up a bit, and this report might not be relevant
anymore. I will add a plan to ugprade to 8.0 (as long as everything installed is confirmed
compatible), but it will take time to get results (or lack of thereof).
Previous Comments:
------------------------------------------------------------------------
[2021-02-23 11:25:21] cmb@php.net
Any update here? Has this been fixed in the FreeBSD ports? Do we
still want to apply an improvement to php-src?
------------------------------------------------------------------------
[2019-07-17 15:24:40] nikic@php.net
If it's possible to restore that code in the FreeBSD port, that would be good. We should
probably also change the check on our side from defined(_REENTRANT) to defined(ZTS), as we perform
the availability check without _REENTRANT and I don't believe this symbol has a dependence on
it. The absence of _REENTRANT might affect other things as well though...
------------------------------------------------------------------------
[2019-07-17 11:46:31] theultramage at gmail dot com
The usage of the routines in the autoconf module you referenced, PTHREADS_FLAGS and PTHREADS_CHECK,
has been deliberately patched out in the freebsd ports tree. This is why the flag isn't being
applied.
I traced the port's svn history and it goes back all the way to 2004 and php 4.3.9. It says
"Fix compilation of thread-safe PHP after the PTHREAD_LIBS change" which might be
referring to some sort of systems code restructuring effort.
Originally, they just removed the freebsd piece of code in PTHREADS_FLAGS:
https://svnweb.freebsd.org/ports/head/lang/php4/files/patch-configure?revision=118610&view=markup&pathrev=160333
It was then changed to remove the invocation of the autoconf macros:
https://svnweb.freebsd.org/ports/head/lang/php4/files/patch-configure.in?revision=161492&view=markup&pathrev=170333
------------------------------------------------------------------------
[2019-07-17 11:03:34] nikic@php.net
I got confused here and mixed up CPPFLAGS and CXXFLAGS... adding to CPPFLAGS is right and should
work, so I'm not sure why it isn't happening.
------------------------------------------------------------------------
[2019-07-17 10:52:23] theultramage at gmail dot com
Good catch. On my end, I found a stackoverflow post, stating "Use g++ -pthread, it is
equivalent to g++ -lpthread -D_REENTRANT". So gcc (and it seems clang as well) have this fancy
helper parameter. The freebsd ports makefile only does "LIBS += -lpthread" and thus
apparently does not invoke this mechanism. I'll correct it from this end and see if it changes
anything.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=78303
--
Edit this bug report at https://bugs.php.net/bug.php?id=78303&edit=1