projects/php.projeny is a URL-based projeny project for the php.net release tarball. The patch, ported from filnix's PHP 8.4 port, keeps capabilities that PHP and ext/dom's lexbor round-trip through integers (weak references, WeakMap keys, typed-property source lists, lexbor name IDs, C14N/schema namespace fixups), replaces inline assembly Fil-C cannot run or compile (wordwise string compare, zend_safe_address, the asm goto overflow arithmetic whose callbr crashes FilPizlonatorPass, raw xgetbv bytes, .debug_gdb_scripts), measures the Zend stack limit of ucontext fibers from their first frame, and maps opcache's cache privately (capabilities are per process, so a pointer one FPM worker caches is unusable in another) without the MAP_32BIT huge-page remap. build_php.sh builds CLI, CGI, FPM and phpdbg plus opcache, intl, dom, gd, mbstring, curl, openssl, sqlite and friends, with the PCRE and opcache JITs and the fiber assembly disabled, then runs a smoke test of the patched areas. It runs from build_glibc_extras.sh because Fil-C's ucontext (needed by --disable-fiber-asm) is only in user glibc; under musl the link fails on pizlonated_swapcontext. Amp-Thread-ID: https://ampcode.com/threads/T-01a15d2c-1d54-71bb-9384-cdd1921c2969 Co-authored-by: Amp <amp@ampcode.com>
Zend's allocator carves request memory out of 2 MiB chunks, so Fil-C bounds a PHP value only by its chunk and reuses freed values' memory inside it. The var_destroy use after free in unserialize() runs to completion on Zend's allocator and panics on the system allocator. Default to PHP's tracked system allocator (the one its ASan CI uses) so memory_limit keeps working; USE_ZEND_ALLOC=1 restores Zend's. Under Fil-C, leave the tracked allocator's end-of-request frees (by integer keys, which carry no capability) to the collector, and record peaks for memory_get_peak_usage(). Per-value bounds exposed zend_str_tolower_dup_ex() and zend_str_toupper_dup_ex() writing the copy through the source string's capability, which broke strip_tags() and Dom attribute lookups; offset the copy instead. Core tests: 15027 pass, pcntl_unshare_02 fails as before; opcache 859 of 860 (gh9164, as before). Amp-Thread-ID: https://ampcode.com/threads/T-01a15ce7-1e2f-76ab-8c1e-fb4f3eacb8ac Co-authored-by: Amp <amp@ampcode.com>
approved these changes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters