Skip to content

Fix GH-25195: smm_shared_globals left dangling without an SHM backend - #25196

Closed
lazerg wants to merge 1 commit into
php:PHP-8.5from
lazerg:fix/gh-25195-no-shm-backend-globals
Closed

lazerg wants to merge 1 commit into
php:PHP-8.5from
lazerg:fix/gh-25195-no-shm-backend-globals

Conversation

@lazerg

@lazerg lazerg commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

When there is no SHM backend, zend_shared_alloc_startup() returned NO_SHM_BACKEND with smm_shared_globals still pointing at its local tmp_shared_globals. The other early returns already reset it to NULL. If the engine is started again in the same process with file_cache_only (embed SAPI), startup is skipped and zend_accel_in_shm() reads the dead stack frame. This resets it before that return too, as suggested in the issue.

The early return was added in e4078a6, so this targets PHP-8.5. I checked it with the embed reproducer from the issue on an ASan build without SHM backends: the stack-use-after-return is gone and opcache_compile_file() returns true.

Fixes #25195

@ndossche ndossche left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. 8.4 isn't affected because it fatal errors at that point

@ndossche ndossche closed this in f854ff9 Nov 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants