Repository navigation
Conversation
On OpenBSD, pthread_stackseg_np() returns the top of the stack in ss_sp, not the bottom. zend_call_stack_get_openbsd_pthread() subtracted ss_size from it, so the base ended up one stack size below the real stack and the limit was never reached. Close phpGH-25635
* PHP-8.4: Zend: Fix stack limit on OpenBSD threads other than the main one
zend_jit_trace_handler() runs some opcodes, such as COALESCE, through their VM handler and stores the returned opline in IP. When the handler takes a jump while an interrupt is pending, zend_interrupt_helper runs the interrupt function and returns the jump target with ZEND_VM_ENTER_BIT set. The opline guard after the handler then fails, and the trace exits to the fall-through branch, so e.g. `$arr[$k] ?? 'default'` returns the default although the key exists. Clear ZEND_VM_ENTER_BIT when an interrupt function is installed, as zend_jit_handler() already does for the function JIT. Only the CALL and TAILCALL VMs are affected.
bm1549
force-pushed
the
brian.marks/trace-jit-vm-interrupt-jmp
branch
from
November 20, 2026 22:45
4f2d5f9 to
30c6bd9
Compare
Fix phpGH-25501 The bundled lexbor CSS tokenizer missed the U+00B7, U+00C0 to U+00F6 and U+037D ident code points, swallowed a rejected code point at the end of an ident, and tested UTF-8 lead bytes against its ASCII name table. Backport the upstream fixes 3a5217afde, 70b790f828, 7e56383173 and ce777c50f2. Close phpGH-25520
* PHP-8.4: ext/dom: querySelector() rejects a non-ASCII leading identifier. # Conflicts: # ext/lexbor/patches/0001-Expose-line-and-column-information-for-use-in-PHP.patch # ext/lexbor/patches/0002-Track-implied-added-nodes-for-options-use-in-PHP.patch # ext/lexbor/patches/0003-Patch-utilities-and-data-structure-to-be-able-to-gen.patch # ext/lexbor/patches/0004-Remove-unused-upper-case-tag-static-data.patch # ext/lexbor/patches/0005-Shrink-size-of-static-binary-search-tree.patch # ext/lexbor/patches/0006-Patch-out-unused-CSS-style-code.patch # ext/lexbor/patches/0009-CSS-Syntax-fixed-non-ASCII-ident-code-point-ranges.patch # ext/lexbor/patches/0010-iCSS-Syntax-fixed-U-FFFD-replacement-boundaries-for-.patch # ext/lexbor/patches/0011-CSS-Syntax-fixed-UTF-8-escapes-in-ident-sequences.patch # ext/lexbor/patches/0011-CSS-fixed-heap-buffer-overflow-in-lexbor-contains-pa.patch # ext/lexbor/patches/0012-CSS-Syntax-fixed-non-ASCII-ident-code-points.patch # ext/lexbor/patches/0012-Encoding-fixed-buffer-overflows-in-malformed-decode-.patch
… item php_dom_iterator_current_key() read the object out of iterator->curobj for attribute and DTD named node maps without checking that the iterator has a current item. On an empty attribute map the object pointer is NULL and InternalIterator::key() crashes; once the iterator has moved past the last item it reads the wrapper move_forward() has already released. Return null in that case, as valid() and current() already treat an undefined curobj as the end. An entity or notation map of a DTD without an internal subset has no hash table and was keyed like a node list, returning int(0); select the name-keyed maps by node type instead, as move_forward() does. Integer-keyed node lists are unaffected. Closes phpGH-25595
* PHP-8.4: ext/dom: Fix crash in named node map iterator key() without a current item
libthr gives threads a 2 MiB stack on 64-bit (1 MiB on 32-bit), not 4 MiB, therefore the fallback limit was past the end of the stack. Close phpGH-25643
* PHP-8.4: Zend: Fix stack limit fallback on FreeBSD threads
Tokyo Cabinet treats text after "#" as tuning parameters. That means tcadb could open a different file from the one PHP uses for locking. Reject paths containing "#" before initializing the tcadb handle, because Tokyo Cabinet provides no way to escape the character. Closes php#24656
* PHP-8.4: Fix phpGH-24640: Reject "#" in tcadb paths (php#24656)
…n non-array containers (phpGH-24665) Report an undefined OP_DATA only when the value is assigned, after the false to array deprecation, and never report an undefined dim before "Cannot use a scalar value as an array", matching the VM. Closes phpGH-24665
SQLite keeps bindings across sqlite3_reset() and can still read them while fetching rows. Bind strings and LOBs with SQLITE_TRANSIENT so the statement owns a copy when PDO releases or replaces the parameter. Report blob binding errors through PDO as for text. Fixes phpGH-25588 Closes phpGH-25597
* PHP-8.4: ext/pdo_sqlite: Fix use-after-free of bound string and LOB parameters
Phar's OpenSSL signing code held a pointer into the private key argument. A later write to the archive could read freed memory after that argument went out of scope. Hold a reference to the zend_string and release it when the key is replaced or the request ends. Closes php#25529
* PHP-8.4: Fix phpGH-25528: Retain the Phar OpenSSL signing key (php#25529)
In the test, we check whether ini_cafile/ini_capath are empty or not. But these values can be affected by configuration and may be not empty. As long as this is not important for this test, let's keep the check of the structure of the array and allow different values for the properties Closes phpGH-11278
* PHP-8.4: Make test accept different outputs
* PHP-8.4: Fix propagation of public(set) of readonly trait property
* PHP-8.2: [skip ci] Backport test-suite.yml changes from master
* PHP-8.3: [skip ci] Backport test-suite.yml changes from master
* PHP-8.4: [skip ci] Backport test-suite.yml changes from master
- Drop opcache.protect_memory - Drop USE_TRACKED_ALLOC - Disable USE_ZEND_ALLOC for verify_type_inference
* PHP-8.2: [skip ci] Speed up community build
* PHP-8.3: [skip ci] Speed up community build
* PHP-8.4: [skip ci] Speed up community build
* PHP-8.4: ext/intl: Reject non-finite timestamps in IntlCalendar::setTime() (php#25668)
Drop the obsolete fourth argument to intl_errors_set() when reporting a non-finite timestamp. The argument was removed in PHP 8.5. Follow-up to php#25668.
Flushing closed the archive stream while a handle on a deleted entry still referenced it. The open handle check now covers deleted entries. Close phpGH-25649
* PHP-8.4: ext/phar: unset() of an entry with an open handle use-after-free. # Conflicts: # ext/phar/phar.c
…in newInstance(Args)() Normally, an object whose ctor failed would never run its dtor, but for reflection it did when the ctor was not public. To solve this we mark the object as ctor-failed. Closes phpGH-25653.
* PHP-8.4: ext/reflection: Don't call destructor when constructor is not public in newInstance(Args)()
…attribute Remove detached ID attributes from the document's ID table before freeing their children. libxml needs the children to look up the ID, so freeing them first leaves a stale entry. Closes phpGH-25351
* PHP-8.4: ext/dom: Fix use-after-free in getElementById() after removing an ID attribute
…phpGH-25661) Since 63e0b9c the function can be resolved from the SOAPAction header when the Body has no function element, leaving func NULL. Closes phpGH-25661
The call was guarded by #ifndef OPENSSL_NO_ENGINE until the v1/v3 backend split in d662ab5 moved it from ext/openssl/openssl.c into ext/openssl/openssl_backend_v1.c, where only the surrounding #ifdef LIBRESSL_VERSION_NUMBER was kept. LibreSSL defines OPENSSL_NO_ENGINE, so <openssl/engine.h> is not included and ENGINE_cleanup() ends up being called without a prototype. That is a warning with older compilers and an error with GCC 14 and later, which default to C23. Restore the guard so that the call matches the condition of its include. Closes phpGH-23689
PKCS7_NO_DUAL_CONTENT was only added in LibreSSL 4.3.0, so the generated registration in openssl_arginfo.h fails to compile against older releases. Guard the constant on the macro itself rather than on LIBRESSL_VERSION_NUMBER so that LibreSSL 4.3.0 and later, which added the macro in response to this report, keep exposing the constant. Closes phpGH-23689
Correctly free both stacks, sk and stack, in the exit path and transfer ownership of stack to ret on success. Don't free the members of sk in the loop, only steal the certs after successful sk_X509_push(), which is error checked as it always should be. Switch from sk_new_reserve() back to the much saner sk_X509_new_null(). This makes ownership in this code easier to reason about and more robust to future modifications. Closes phpGH-21430
OPENSSL_strndup() is not available in LibreSSL so the build fails at link time since it started to be used in 4f2f489. Use estrndup() instead. The embedded NUL check keeps working because the copy is compared against the ASN.1 string length.
…filter _php_stream_filter_flush() grew the read buffer without updating readbuflen, so the next fill computed readbuflen - writepos as a wrapped size and handed it to the read handler. Keep readbuflen in sync with the reallocated size. Fix phpGH-25464 Close phpGH-25500
* PHP-8.4: streams: fix stale readbuflen after stream_filter_remove() on a read filter
Deprecation warnings make the job fail.
* PHP-8.2: [skip ci] Add APP_DEBUG=0 for Symfony Preloading test
* PHP-8.3: [skip ci] Add APP_DEBUG=0 for Symfony Preloading test
* PHP-8.4: [skip ci] Add APP_DEBUG=0 for Symfony Preloading test
* PHP-8.5: (25 commits) [skip ci] Add APP_DEBUG=0 for Symfony Preloading test streams: fix stale readbuflen after stream_filter_remove() on a read filter Update NEWS for phpGH-20920 LibreSSL build fix Fix phpGH-20920: do not use OPENSSL_strndup() for peer CN matching Simplify php_openssl_load_all_certs_from_file() Fix phpGH-20920: only register PKCS7_NO_DUAL_CONTENT when it is defined Fix phpGH-20920: guard ENGINE_cleanup() with OPENSSL_NO_ENGINE again ext/soap: Fix NULL dereference on empty Body with matching SOAPAction (phpGH-25661) ext/dom: Fix use-after-free in getElementById() after removing an ID attribute ext/reflection: Don't call destructor when constructor is not public in newInstance(Args)() ext/phar: unset() of an entry with an open handle use-after-free. ext/intl: Fix IntlCalendar::setTime() build on PHP 8.5 and later ext/intl: Reject non-finite timestamps in IntlCalendar::setTime() (php#25668) [skip ci] Speed up community build [skip ci] Backport test-suite.yml changes from master Fix propagation of public(set) of readonly trait property Make test accept different outputs Fix phpGH-25528: Retain the Phar OpenSSL signing key (php#25529) ext/pdo_sqlite: Fix use-after-free of bound string and LOB parameters ext/opcache: Fix JIT ASSIGN_DIM undefined OP_DATA and dim reporting on non-array containers (phpGH-24665) ...
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
zend_jit_trace_handler()runs some opcodes, such asCOALESCE, through their VM handler and stores the returned opline in IP. If the handler takes a jump while an interrupt is pending,zend_interrupt_helperruns the interrupt function and returns the jump target withZEND_VM_ENTER_BITset. The opline guard after the handler then fails, and the trace exits to the fall-through branch, so$arr[$k] ?? 'MISSING'returns'MISSING'even though the key exists.This clears
ZEND_VM_ENTER_BITwhen an interrupt function is installed, the same way php#24793 did for the function JIT inzend_jit_handler(). Only the CALL and TAILCALL VMs are affected; HYBRID doesn't tag the returned opline.The new test,
ext/opcache/tests/jit/trace_vm_interrupt_jmp_001.phpt, uses zend_test'sVmInterruptComparableandzend_test.observer.set_vm_interrupt_on_begin=1to raise the interrupt deterministically. Without the fix it printsint(0)and then"MISSING"four times.Tested on 8.6.0RC7 ZTS (clang, TAILCALL VM, arm64):
EG(vm_interrupt)every 1–200 µs): 10–86 failures in 200 runs before, 0 after.ext/opcache/tests/jit: all 549 tests pass with the fix.Full write-up with the repro tools (Datadog internal): https://chonk.us1.prod.dog/v3/brian.marks/php-tracing-jit-vm-interrupt-coalesce.html