Skip to content

mod_lua: Restrict LuaRoot to RSRC_CONF to fix per-dir pool lifetime bug - #1029

Open
fattylin0110 wants to merge 2 commits into
apache:trunkfrom
fattylin0110:patch-1
Open

fattylin0110 wants to merge 2 commits into
apache:trunkfrom
fattylin0110:patch-1

Conversation

@fattylin0110

@fattylin0110 fattylin0110 commented Nov 14, 2026 •

Copy link
Copy Markdown

register_root_dir() stores the resolved LuaRoot path pointer into the server-level configuration (ap_lua_server_cfg on parms->server->module_config) rather than the per-directory configuration.

When LuaRoot is used in an .htaccess file (permitted by OR_ALL), parms->pool is the transient request pool (r->pool), causing cross-request server config pollution and leaving a dangling pointer in server_cfg->root_path once the request pool is cleared.

Restrict LuaRoot to RSRC_CONF to match its server-scoped implementation.


  • This PR does not report or address a security vulnerability
    (see SECURITY.md and
    https://www.apache.org/security/#reporting-a-vulnerability).
  • Code follows the httpd style guide.
  • New log messages (level debug or higher) use an empty APLOGNO() tag;
    numbers are assigned by a committer at merge time (see docs/log-message-tags/README).
  • If the change is user-visible, a changes-entries/*.txt file is included,
    following the template in README.CHANGES (not needed otherwise).
  • Test cases based on pyhttpd are included where appropriate, in the
    test/modules/xxx directory matching the modules/xxx module source,
    or test/modules/core for core server changes. On Unix, verify these
    pass locally with e.g. make check-pytest PYTEST_DIRS=test/modules/xxx.

fattylin0110 and others added 2 commits November 14, 2026 18:58
register_root_dir() stores the resolved LuaRoot path pointer into the server-level configuration (ap_lua_server_cfg on parms->server->module_config) rather than the per-directory configuration.

When LuaRoot is used in an .htaccess file (permitted by OR_ALL), parms->pool is the transient request pool (r->pool), causing cross-request server config pollution and leaving a dangling pointer in server_cfg->root_path once the request pool is cleared.

Restrict LuaRoot to RSRC_CONF to match its server-scoped implementation.
Update the manual for the LuaRoot context change and add a CHANGES
entry, since existing configurations which used the directive in
<Directory> or .htaccess will now fail to start.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants