[Bug 268318] www/apache24 with www/mod_php8{0,1,2,3?}: opcache + ASLR turned on crashes Apache

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 26 Nov 2026 21:13:17 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=268318

--- Comment #108 from Dan Mahoney <freebsd@gushi.org> ---
(In reply to Michael Osipov from comment #106)

Fair question. It's a fix at the packaging level, not in PHP's code.

The bug needs two things: opcache.so staying loaded (it sets its own
handle to 0 so PHP never dlcloses it), and libphp.so being unloaded and
reloaded somewhere else. NODELETE removes the second, so opcache's
resolved pointers into libphp stay valid. It doesn't hide the crash; the
condition that causes it no longer exists.

It's also not new territory for PHP. On Linux, glibc already keeps
libphp mapped across Apache restarts, because opcache has bound symbols
in it. So NODELETE makes FreeBSD behave the way mod_php has behaved on
Linux all along. PHP already copes with being started again in a library
image that stayed loaded: opcache does exactly that today. In my test,
opcache came back working after each of 25 restarts.

The cost is that libphp stays mapped in the Apache parent for its whole
lifetime, so replacing libphp.so on disk needs a full stop/start rather
than a graceful. In practice that's already the advice after upgrading
PHP.

A "proper" fix would be upstream in opcache: either don't pin itself,
or pin its host as well. I can ask Ondrej Sury (a coworker of mine at
ISC, who packages PHP for Debian/Ubuntu) whether that's worth raising,
but I wouldn't hold the port fix for it. 8.2 reaches upstream EOL on
2026-12-31, and lang/php82 is already marked DEPRECATED with that
expiration date. 8.3 and 8.4 are maintenance-only. 8.5 makes opcache a
mandatory built-in, so it's never dlopen()ed and this can't happen
there.

So the one-line port change is the practical fix. It matters most for
lang/php83 and lang/php84, which will be around for a while yet. For
lang/php82 it's just harmless to include before the port expires.

-- 
You are receiving this mail because:
You are the assignee for the bug.