Skip to content

Zend: Add opt-in request-scoped allocation no-reuse mode - #24473

Open
jvoisin wants to merge 1 commit into
php:masterfrom
jvoisin:noreuse
Open

jvoisin wants to merge 1 commit into
php:masterfrom
jvoisin:noreuse

Conversation

@jvoisin

@jvoisin jvoisin commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Enable with ZEND_MM_NO_REUSE=1 before engine startup.

Clear and retain freed small allocations, page runs, and huge mappings until heap shutdown. Move reallocations to fresh storage and prevent allocator GC from reclaiming retired ranges.

Keep retained mappings charged against memory_limit and reject incompatible allocator overrides rather than silently allowing reuse.

This mitigates UAF exploitation through allocation reclamation like CVE-2026-109618 and CVE-2026-109619, at the cost of memory usage approaching cumulative allocation volume per request.

Add tests for address non-overlap, clearing, reallocations, shutdown, accounting, and configuration errors. Document usage and limitations.

This provides a nice alternative to #14304.

Enable with ZEND_MM_NO_REUSE=1 before engine startup.

Clear and retain freed small allocations, page runs, and huge mappings
until heap shutdown. Move reallocations to fresh storage and prevent
allocator GC from reclaiming retired ranges.

Keep retained mappings charged against memory_limit and reject
incompatible allocator overrides rather than silently allowing reuse.

This mitigates UAF exploitation through allocation reclamation like
CVE-2026-109618 and CVE-2026-109619, at the cost of memory usage approaching
cumulative allocation volume per request.

Add tests for address non-overlap, clearing, reallocations, shutdown,
accounting, and configuration errors. Document usage and limitations.

This provides a nice alternative to php#14304.
@jvoisin

jvoisin commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

cc @arnaud-lb

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.

1 participant