[Bug 268318] www/apache24 with www/mod_php8{0,1,2,3?}: opcache + ASLR turned on crashes Apache
- In reply to: bugzilla-noreply_a_freebsd.org: "[Bug 268318] www/apache24: dumps core when rotating logs"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 28 Nov 2026 09:18:17 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=268318 --- Comment #113 from Jochen Neumeister <joneum@FreeBSD.org> --- Created attachment 277857 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=277857&action=edit oatch Reproduced and analysed from the apache24 side. This is not an apache24 port problem, so I am handing the PR over to the maintainer of lang/php8x and www/mod_php8x (bofh@). Setup: FreeBSD 15.1, apache24-2.4.71_1, prefork MPM, ASLR enabled, opcache enabled. Result with the packages from the repository (mod_php83 8.3.37, mod_php84 8.4.28): the first graceful restart (SIGUSR1) kills the httpd parent with signal 11. Cause: on a graceful restart httpd unloads and reloads all modules. libphp.so is dlclose()d, but opcache (zend_extension) keeps pointers into the library. The library is mapped again at a different address (ASLR), and the parent crashes on the stale pointers. Fix: link the mod_php library with -Wl,-z,nodelete (DF_1_NODELETE), so dlclose() does not unmap it. The idea comes from Dan Mahoney. Patch attached, it only touches the mod_php build block of lang/php83 and lang/php84 and bumps PORTREVISION, as www/mod_php8x uses the master Makefile. Testing (mod_php83-8.3.37_2 and mod_php84-8.4.28_2 built from the patched ports, check-plist clean, readelf shows FLAGS_1 NODELETE in libphp.so): 12 consecutive graceful restarts each, opcache on after every restart, no crash. Same test with the unpatched packages crashes on the first restart. Not tested: php82 (EOL 31.12.), php85, threaded MPMs, other FreeBSD versions. Replacing libphp.so on a running server (package upgrade) still needs a full stop/start instead of a graceful restart. bofh@, could you please take this over? -- You are receiving this mail because: You are the assignee for the bug.