Skip to content

Commit

Permalink
Fix process crash on Apache startup due to incorrect use of memory po…
Browse files Browse the repository at this point in the history
…ols.
  • Loading branch information
GrahamDumpleton committed Oct 4, 2020
1 parent 4a6c2a7 commit 9509e17
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
13 changes: 13 additions & 0 deletions docs/release-notes/version-4.8.0.rst
Expand Up @@ -5,3 +5,16 @@ Version 4.8.0
Version 4.8.0 of mod_wsgi can be obtained from:

https://codeload.github.com/GrahamDumpleton/mod_wsgi/tar.gz/4.8.0

Bugs Fixed
----------

* Fixed potential for process crash on Apache startup when the WSGI script
file or other Python script file were being preloaded. This was triggered
when ``WSGIImportScript`` was used, or if ``WSGIScriptAlias`` or
``WSGIScriptAliasMatch`` were used and both the ``process-group`` and
``application-group`` options were used with those directives.

The potential for this problem arising was extremely high on Alpine Linux,
but seem to be very rare on a full Linux of macOS distribution where glibc
was being used.
11 changes: 10 additions & 1 deletion src/server/mod_wsgi.c
Expand Up @@ -4753,8 +4753,11 @@ static const char *wsgi_add_script_alias(cmd_parms *cmd, void *mconfig,
WSGIScriptFile *object = NULL;

if (!wsgi_import_list) {
wsgi_import_list = apr_array_make(sconfig->pool, 20,
wsgi_import_list = apr_array_make(cmd->pool, 20,
sizeof(WSGIScriptFile));
apr_pool_cleanup_register(cmd->pool, &wsgi_import_list,
ap_pool_cleanup_set_null,
apr_pool_cleanup_null);
}

object = (WSGIScriptFile *)apr_array_push(wsgi_import_list);
Expand Down Expand Up @@ -5247,6 +5250,9 @@ static const char *wsgi_add_import_script(cmd_parms *cmd, void *mconfig,
if (!wsgi_import_list) {
wsgi_import_list = apr_array_make(cmd->pool, 20,
sizeof(WSGIScriptFile));
apr_pool_cleanup_register(cmd->pool, &wsgi_import_list,
ap_pool_cleanup_set_null,
apr_pool_cleanup_null);
}

object = (WSGIScriptFile *)apr_array_push(wsgi_import_list);
Expand Down Expand Up @@ -7900,6 +7906,9 @@ static const char *wsgi_add_daemon_process(cmd_parms *cmd, void *mconfig,
if (!wsgi_daemon_list) {
wsgi_daemon_list = apr_array_make(cmd->pool, 20,
sizeof(WSGIProcessGroup));
apr_pool_cleanup_register(cmd->pool, &wsgi_daemon_list,
ap_pool_cleanup_set_null,
apr_pool_cleanup_null);
}

entries = (WSGIProcessGroup *)wsgi_daemon_list->elts;
Expand Down

0 comments on commit 9509e17

Please sign in to comment.