maintainer-feedback requested: [Bug 267435] www/apache24 core dumps when mod_perl, mod_php7, mod_dbd, and GD active

From: <bugzilla-noreply_at_freebsd.org>
Date: Sun, 30 Oct 2022 13:52:20 UTC
Bugzilla Automation <bugzilla@FreeBSD.org> has asked freebsd-apache (Nobody)
<apache@FreeBSD.org> for maintainer-feedback:
Bug 267435: www/apache24 core dumps when mod_perl, mod_php7, mod_dbd, and GD
active
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=267435



--- Description ---
Apache core dumps when mod_perl, mod_php and mod_dbd with MySQL support
are active.

The Perl CGI scripts which use GD to generate images now fail with a core dump.
But only if the mod_php or mod_dbd modules are active.

It appears that there are some problems with the Apache DSO support for
mod_dbd, mod_perl and/or mod_php.

See description.txt and SIM95.tar files for details and how to reproduce this
problem.

Details:

FreeBSD 13.1-RELEASE
FreeBSD 12.3-RELEASE
ports Oct 26, 2022
apache Apache/2.4.54 (FreeBSD)
mod_perl ap24-mod_perl2-2.0.12,3
mod_php  mod_php74-7.4.32_1

See attached file SIM95_WEB.tar for details and how to reproduce problem

I have a web based application which uses:
  mod_perl   - to run perl based CGI scripts.
	       Some of these use the Perl GD module to generate graphics.
  mod_php7   - to run PHP74 based php scripts
  mod_dbd    -	Authentication and password are done by the mod_dbd
	      using a MySQL database (details below).

I have been downloading binaries from the PKG server:
FreeBSD: { url: "pkg+http://pkg.FreeBSD.org/${ABI}/quarterly", }

I last downloaded a set of packages on Sept 14 2022.
This was done with a set of scripts and downloads and installs
the packages and package dependencies.
They were basically mod_perl, mod_php and their dependencies.
I also compiled devel/apr1, setting MYSQL with the 'make config'.
I installed the compiled devel/apr1 and the installed application
passed my tests.  This was installed on server sim97 and there
were no problems.

On Oct 10 2022 I set up a sim95, a new server (identical hardware to sim97),
installed FreeBSD 12.3-RELEASE, and repeated the package downloads and
installs.
Much to my surprise there was a problem with the Apache server.

As noted above,  the application uses mod_perl, mod_php, and mod_dbd.
The httpd.conf file has the following entries which load these modules
into the Apache server. (There is also a startup.pl file used to
set up mod_perl)

The Perl CGI scripts which use GD to generate images now fail with a core dump.
But only if the mod_php or mod_dbd modules are active.
httpd.conf pertinent entries:

   LoadModule authn_dbd_module libexec/apache24/mod_authn_dbd.so
   LoadModule authz_dbd_module libexec/apache24/mod_authz_dbd.so
   # TEST
   LoadModule dbd_module libexec/apache24/mod_dbd.so

   Virtual Host Entry
     <IfModule mod_dbd.c>
       DBDriver mysql	  # Line 920 in httpd.conf file
       DBDParams "host=127.0.0.1 dbname=password user=pwd pass=pwd"
     </IfModule>

  # TEST
  LoadModule perl_module	libexec/apache24/mod_perl.so
  LoadModule php7_module	libexec/apache24/libphp7.so

If the mod_dbd, perl_module, and php7_module lines are all present
THEN a web page which uses GD will cause apache to segment fault.
This message will be present in the /var/log/apache/httpd-error.log file:

  [Tue Oct 25 05:37:28.327954 2022] [core:notice] [pid 27255]
  AH00052: child pid 27371 exit signal Segmentation fault (11)

This message will be present in the /var/log/messages file:
Oct 25 06:02:28 sim95 kernel: pid 27583 (httpd), jid 0, uid 80:
  exited on signal 11