Skip to content

Delayed effects 2#213

Open
iluuu1994 wants to merge 26 commits into
masterfrom
delayed-effects-2
Open

Delayed effects 2#213
iluuu1994 wants to merge 26 commits into
masterfrom
delayed-effects-2

Conversation

@iluuu1994

Copy link
Copy Markdown
Owner

No description provided.

nikic and others added 25 commits May 19, 2026 18:25
This is a prototype for fixing a long-standing source of interrupt
vulnerabilities: A notice is emitted during execution of an opcode,
resulting in an error handling being run. The error handler modifies
some data structure the opcode is working on, resulting in UAF or
other memory corruption.

The idea here is to instead collect notices and only process them
after the opcode. This is implemented similarly to exception
handling, by switching to a ZEND_HANDLE_DELAYED_ERROR opcode,
which will then switch back to the normal opcode stream.

Unfortunately, what this prototype implements is not sufficient.
Opcodes that acquire direct (INDIRECT) references to zvals require
that no interrupts occur between the producing and the consuming
opcode. Chains of W/RW opcodes should be executed without interrupt.
Currently, the notice is only delayed until after the first opcode,
which still results in an illegal interrupt (bug78598.phpt shows
a UAF with this change).

I'm not sure how to best handle that issue.
There are 3 categories of failing tests here:

 - Many are throwing in a user error handlers, therefore relied on non-delayed
   behavior. Fixed these by installing the error handler with
   promote_to_exception: true.
 - Some are just printing the error message. Their output changes due to delay.
   These are fixed by updating the EXPECT section.
 - And finally, many are testing the adverse effects of mutations in error
   handlers. These are now irrelevant, but these are also fixed by updating the
   EXPECT section.
@coderabbitai

coderabbitai Bot commented May 28, 2026

Copy link
Copy Markdown

Important

Review skipped

Too many files!

This PR contains 244 files, which is 94 over the limit of 150.

To get a review, narrow the scope:
• coderabbit review --type committed # exclude uncommitted changes
• coderabbit review --dir # limit to a subdirectory
• coderabbit review --base # compare against a closer base

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a2b3e42a-81ed-43a6-8970-ddb614dbb9a0

📥 Commits

Reviewing files that changed from the base of the PR and between 4e7661b and a63cd81.

📒 Files selected for processing (244)
  • .coderabbit.yaml
  • Zend/tests/ArrayAccess/bug41209.phpt
  • Zend/tests/attributes/deprecated/class_constants/deprecated_constant_as_message_002.phpt
  • Zend/tests/attributes/deprecated/constants/deprecated_constant_as_message_002.phpt
  • Zend/tests/attributes/deprecated/functions/throwing_error_handler_001.phpt
  • Zend/tests/backtrace/debug_backtrace_with_include_and_this.phpt
  • Zend/tests/bind_static_exception.phpt
  • Zend/tests/bitwise_not_precision_exception.phpt
  • Zend/tests/bug29896.phpt
  • Zend/tests/bug38220.phpt
  • Zend/tests/bug49893.phpt
  • Zend/tests/bug52041.phpt
  • Zend/tests/bug60909_1.phpt
  • Zend/tests/bug61767.phpt
  • Zend/tests/bug63206.phpt
  • Zend/tests/bug70662.phpt
  • Zend/tests/bug70785.phpt
  • Zend/tests/bug72101.phpt
  • Zend/tests/bug74164.phpt
  • Zend/tests/bug76534.phpt
  • Zend/tests/bug78598.phpt
  • Zend/tests/bug79599.phpt
  • Zend/tests/bug79784.phpt
  • Zend/tests/bug79793.phpt
  • Zend/tests/closures/closure_031.phpt
  • Zend/tests/coalesce/assign_coalesce_002.phpt
  • Zend/tests/compound_assign_failure.phpt
  • Zend/tests/concat/bug81705.phpt
  • Zend/tests/constants/gh18463-class-constant.phpt
  • Zend/tests/debug_info/recursion_return_null.phpt
  • Zend/tests/delayed_error_001.phpt
  • Zend/tests/delayed_error_004.phpt
  • Zend/tests/dynamic_prop_deprecation_002.phpt
  • Zend/tests/ex_func_null_during_property_write.phpt
  • Zend/tests/exception_in_nested_rope.phpt
  • Zend/tests/exception_in_rope_end.phpt
  • Zend/tests/exceptions/bug45805.phpt
  • Zend/tests/exceptions/bug51394.phpt
  • Zend/tests/exceptions/bug53511.phpt
  • Zend/tests/exceptions/bug76025.phpt
  • Zend/tests/exceptions/bug78239.phpt
  • Zend/tests/exceptions/exception_008.phpt
  • Zend/tests/exceptions/exception_026.phpt
  • Zend/tests/exceptions/exception_before_fatal.phpt
  • Zend/tests/falsetoarray_002.phpt
  • Zend/tests/falsetoarray_003.phpt
  • Zend/tests/fe_fetch_dtor_exception.phpt
  • Zend/tests/fibers/gh9735-008.phpt
  • Zend/tests/fibers/throw-in-multiple-destroyed-fibers-after-shutdown.phpt
  • Zend/tests/fibers/unfinished-fiber-with-finally.phpt
  • Zend/tests/fibers/unfinished-fiber-with-nested-try-catch.phpt
  • Zend/tests/fibers/unfinished-fiber-with-suspend-in-finally.phpt
  • Zend/tests/fibers/unfinished-fiber-with-throw-in-finally.phpt
  • Zend/tests/first_class_callable/constexpr/error_static_call_trait_method_002.phpt
  • Zend/tests/frameless_throwing_destructor.phpt
  • Zend/tests/frameless_undefined_var.phpt
  • Zend/tests/function_arguments/sensitive_parameter_value_keeps_object_alive.phpt
  • Zend/tests/functions/zend_call_function_deprecated_frame.phpt
  • Zend/tests/gc/bug64960.phpt
  • Zend/tests/gc_053.phpt
  • Zend/tests/generators/bug71601.phpt
  • Zend/tests/generators/errors/yield_in_force_closed_finally_error.phpt
  • Zend/tests/generators/generator_closure_collection.phpt
  • Zend/tests/generators/gh9750-001.phpt
  • Zend/tests/generators/gh9750-002.phpt
  • Zend/tests/generators/gh9750-003.phpt
  • Zend/tests/generators/gh9750-004.phpt
  • Zend/tests/generators/gh9750-005.phpt
  • Zend/tests/generators/gh9750-006.phpt
  • Zend/tests/generators/gh9750-007.phpt
  • Zend/tests/generators/gh9750-008.phpt
  • Zend/tests/generators/gh9750-009.phpt
  • Zend/tests/generators/gh9750-010.phpt
  • Zend/tests/generators/gh9750-011.phpt
  • Zend/tests/generators/yield_from_force_closed.phpt
  • Zend/tests/get_class_basic.phpt
  • Zend/tests/gh10168/assign_prop_ref.phpt
  • Zend/tests/gh10168/assign_prop_ref_with_prop_ref.phpt
  • Zend/tests/gh10168/assign_ref.phpt
  • Zend/tests/gh10168/assign_ref_with_prop_ref.phpt
  • Zend/tests/gh10168/assign_static_prop_ref.phpt
  • Zend/tests/gh10168/assign_static_untyped_prop_ref.phpt
  • Zend/tests/gh10168/assign_untyped_prop_ref.phpt
  • Zend/tests/gh10168/assign_untyped_prop_ref_with_prop_ref.phpt
  • Zend/tests/gh16799.phpt
  • Zend/tests/gh17162.phpt
  • Zend/tests/gh20183_001.phpt
  • Zend/tests/gh20183_002.phpt
  • Zend/tests/gh_21699.phpt
  • Zend/tests/gh_21699_parent.phpt
  • Zend/tests/gh_21699_static.phpt
  • Zend/tests/in-de-crement/incdec_bool_exception.phpt
  • Zend/tests/in-de-crement/incdec_strings_exception.phpt
  • Zend/tests/in-de-crement/incdec_undef.phpt
  • Zend/tests/in-de-crement/increment_diagnostic_change_type.phpt
  • Zend/tests/in-de-crement/oss-fuzz-60709_globals_unset_after_undef_warning.phpt
  • Zend/tests/in-de-crement/oss-fuzz-62294_globals_unset_after_string_warning.phpt
  • Zend/tests/in-de-crement/unset_globals_in_error_handler.phpt
  • Zend/tests/in-de-crement/unset_object_property_in_error_handler.phpt
  • Zend/tests/in-de-crement/unset_property_converted_to_obj_in_error_handler.phpt
  • Zend/tests/inheritance/deprecation_to_exception_during_inheritance.phpt
  • Zend/tests/inheritance/deprecation_to_exception_during_inheritance_can_be_caught.phpt
  • Zend/tests/inheritance/gh15907.phpt
  • Zend/tests/lazy_objects/gh15999_001.phpt
  • Zend/tests/lazy_objects/reset_as_lazy_calls_destructor.phpt
  • Zend/tests/lazy_objects/reset_as_lazy_can_reset_initialized_proxies.phpt
  • Zend/tests/lazy_objects/reset_as_lazy_may_skip_destructor.phpt
  • Zend/tests/magic_methods/bug29368_2.phpt
  • Zend/tests/magic_methods/bug29368_3.phpt
  • Zend/tests/magic_methods/bug32596.phpt
  • Zend/tests/offsets/array_offset_002.phpt
  • Zend/tests/offsets/null_offset_dep_promoted.phpt
  • Zend/tests/offsets/null_offset_no_uaf.phpt
  • Zend/tests/offsets/null_offset_unset_via_error_handler.phpt
  • Zend/tests/operator_unsupported_types.phpt
  • Zend/tests/oss_fuzz_54325.phpt
  • Zend/tests/oss_fuzz_61712.phpt
  • Zend/tests/oss_fuzz_61712b.phpt
  • Zend/tests/require_once_warning_to_exception.phpt
  • Zend/tests/stack_limit/stack_limit_001.phpt
  • Zend/tests/stack_limit/stack_limit_002.phpt
  • Zend/tests/stack_limit/stack_limit_003.phpt
  • Zend/tests/stack_limit/stack_limit_004.phpt
  • Zend/tests/stack_limit/stack_limit_006.phpt
  • Zend/tests/static_variables/static_variables_destructor.phpt
  • Zend/tests/str_offset_006.phpt
  • Zend/tests/str_offset_007.phpt
  • Zend/tests/str_offset_008.phpt
  • Zend/tests/strlen_deprecation_to_exception.phpt
  • Zend/tests/temporary_cleaning/temporary_cleaning_011.phpt
  • Zend/tests/temporary_cleaning/temporary_cleaning_013.phpt
  • Zend/tests/temporary_cleaning/temporary_cleaning_015.phpt
  • Zend/tests/temporary_cleaning/temporary_cleaning_016.phpt
  • Zend/tests/temporary_cleaning/temporary_cleaning_017.phpt
  • Zend/tests/traits/gh_17728.phpt
  • Zend/tests/try/bug71604_2.phpt
  • Zend/tests/try/bug71604_3.phpt
  • Zend/tests/try/catch_novar_2.phpt
  • Zend/tests/try/try_finally_017.phpt
  • Zend/tests/try/try_finally_020.phpt
  • Zend/tests/try/try_finally_022.phpt
  • Zend/tests/try/try_finally_023.phpt
  • Zend/tests/type_coercion/float_to_int/non-rep-float-as-int-extra1.phpt
  • Zend/tests/type_coercion/float_to_int/non-rep-float-as-int-extra3.phpt
  • Zend/tests/type_coercion/float_to_int/non-rep-float-as-int-extra4.phpt
  • Zend/tests/type_coercion/settype/settype_array_nan_with_error_handler.phpt
  • Zend/tests/type_coercion/settype/settype_array_nan_with_error_handler3.phpt
  • Zend/tests/type_coercion/settype/settype_bool_nan_with_error_handler.phpt
  • Zend/tests/type_coercion/settype/settype_bool_nan_with_error_handler3.phpt
  • Zend/tests/type_coercion/settype/settype_int_nan_with_error_handler.phpt
  • Zend/tests/type_coercion/settype/settype_int_nan_with_error_handler3.phpt
  • Zend/tests/type_coercion/settype/settype_null_nan_with_error_handler.phpt
  • Zend/tests/type_coercion/settype/settype_null_nan_with_error_handler3.phpt
  • Zend/tests/type_coercion/settype/settype_object_nan_with_error_handler.phpt
  • Zend/tests/type_coercion/settype/settype_object_nan_with_error_handler3.phpt
  • Zend/tests/type_coercion/settype/settype_string_nan_with_error_handler.phpt
  • Zend/tests/type_coercion/settype/settype_string_nan_with_error_handler3.phpt
  • Zend/tests/type_coercion/type_casts/cast_to_void_destructor.phpt
  • Zend/tests/undef_index_to_exception.phpt
  • Zend/tests/undef_var_in_verify_return.phpt
  • Zend/tests/unset/unset_prop_recursion.phpt
  • Zend/tests/weakrefs/gh13612.phpt
  • Zend/tests/weakrefs/gh17442_1.phpt
  • Zend/tests/weakrefs/weakmap_iteration.phpt
  • Zend/tests/weakrefs/weakmap_weakness.phpt
  • Zend/tests/weakrefs/weakrefs_006.phpt
  • Zend/zend.c
  • Zend/zend.h
  • Zend/zend_builtin_functions.c
  • Zend/zend_builtin_functions.stub.php
  • Zend/zend_builtin_functions_arginfo.h
  • Zend/zend_compile.h
  • Zend/zend_errors.h
  • Zend/zend_exceptions.c
  • Zend/zend_exceptions.h
  • Zend/zend_exceptions.stub.php
  • Zend/zend_exceptions_arginfo.h
  • Zend/zend_execute.c
  • Zend/zend_execute.h
  • Zend/zend_execute_API.c
  • Zend/zend_globals.h
  • Zend/zend_objects_API.c
  • Zend/zend_opcode.c
  • Zend/zend_vm_def.h
  • Zend/zend_vm_execute.h
  • Zend/zend_vm_gen.php
  • ext/opcache/tests/gh17422/001.phpt
  • ext/opcache/tests/gh17422/002.phpt
  • ext/opcache/tests/gh17422/003.phpt
  • ext/opcache/tests/gh17422/004.phpt
  • ext/opcache/tests/gh17422/005.phpt
  • ext/opcache/tests/gh17422/006.phpt
  • ext/opcache/tests/jit/assign_055.phpt
  • ext/opcache/tests/jit/assign_dim_005.phpt
  • ext/opcache/tests/jit/assign_dim_007.phpt
  • ext/opcache/tests/jit/assign_dim_011.phpt
  • ext/opcache/tests/jit/assign_dim_014.phpt
  • ext/opcache/tests/jit/assign_dim_015.phpt
  • ext/opcache/tests/jit/assign_dim_op_006.phpt
  • ext/opcache/tests/jit/count_001.phpt
  • ext/opcache/tests/jit/fetch_dim_rw_004.phpt
  • ext/opcache/tests/jit/gh18262-002.phpt
  • ext/opcache/tests/jit/gh18262-003.phpt
  • ext/opcache/tests/jit/gh18262-004.phpt
  • ext/opcache/tests/jit/not_003.phpt
  • ext/reflection/tests/bug71018.phpt
  • ext/spl/tests/ArrayObject/bug74669.phpt
  • ext/spl/tests/ArrayObject/gh16646.phpt
  • ext/spl/tests/SplFileinfo_debugInfo_basic.phpt
  • ext/spl/tests/SplFixedArray_immediate_gc.phpt
  • ext/spl/tests/SplObjectStorage/SplObjectStorage_unset.phpt
  • ext/spl/tests/SplObjectStorage/observer_006.phpt
  • ext/spl/tests/bug73423.phpt
  • ext/spl/tests/bug81992b.phpt
  • ext/spl/tests/gh16464.phpt
  • ext/spl/tests/gh16478.phpt
  • ext/spl/tests/iterator_041a.phpt
  • ext/spl/tests/iterator_041b.phpt
  • ext/spl/tests/iterator_044.phpt
  • ext/standard/tests/array/gh16649/array_splice_uaf_array_deallocated.phpt
  • ext/standard/tests/array/gh16649/array_splice_uaf_complex_modification.phpt
  • ext/standard/tests/array/gh16649/array_splice_uaf_multiple_destructors.phpt
  • ext/standard/tests/array/gh16649/array_splice_uaf_original_case.phpt
  • ext/standard/tests/array/gh16649/array_splice_uaf_packed_to_hash.phpt
  • ext/standard/tests/array/gh16649/array_splice_with_replacement.phpt
  • ext/standard/tests/class_object/method_exists_variation_001.phpt
  • main/main.c
  • tests/classes/bug27468.phpt
  • tests/classes/ctor_dtor.phpt
  • tests/classes/ctor_dtor_inheritance.phpt
  • tests/classes/destructor_and_exceptions.phpt
  • tests/classes/destructor_inheritance.phpt
  • tests/classes/destructor_visibility_001.phpt
  • tests/classes/factory_and_singleton_001.phpt
  • tests/classes/factory_and_singleton_005.phpt
  • tests/classes/factory_and_singleton_006.phpt
  • tests/classes/iterators_002.phpt
  • tests/classes/tostring_002.phpt
  • tests/classes/tostring_003.phpt
  • tests/lang/bug22592.phpt
  • tests/lang/bug25547.phpt
  • tests/lang/bug25922.phpt
  • tests/lang/bug28213.phpt
  • tests/output/gh20352.phpt

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch delayed-effects-2

Comment @coderabbitai help to get the list of available commands and usage tips.

@iluuu1994

Copy link
Copy Markdown
Owner Author

@coderabbitai help

@coderabbitai

coderabbitai Bot commented May 28, 2026

Copy link
Copy Markdown

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

CodeRabbit commands

These commands are invoked using PR/Issue comments.

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai rate limit to show your current review rate limit status.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai evaluate custom pre-merge check --instructions <custom-checks-instructions> --name <custom-checks-title> [--mode <error|warning>] to validate the custom pre-merge checks instructions. Defaults to error when --mode is omitted.
  • @coderabbitai ignore pre-merge checks to override pre-merge checks and get an approval on PR.
  • @coderabbitai run pre-merge checks to run pre-merge checks on the pull request.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai emit path instructions to emit generated path-specific review instructions for this repository.
  • @coderabbitai resolve merge conflict to automatically resolve merge conflicts.
  • @coderabbitai autofix to automatically fix issues identified in unresolved review comments.
  • @coderabbitai resolve to resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai generate configuration to create a PR that adds the current resolved configuration as .coderabbit.yaml (or show it if already present).
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit configuration file (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, support, documentation and community

  • Visit our status page to check the current availability of CodeRabbit.
  • Create a ticket on our support page for assistance with any issues or questions.
  • Visit our documentation site for detailed information on how to use CodeRabbit.
  • Join our Discord community to connect with other users and get help from the community.
  • Follow us on X/Twitter for updates and announcements.

@iluuu1994

Copy link
Copy Markdown
Owner Author

@CodeRabbit review --dir Zend

@coderabbitai

coderabbitai Bot commented May 28, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

@iluuu1994 The --dir flag isn't a supported option for the review command. The available review commands are:

  • @coderabbitai review — triggers an incremental review of the PR.
  • @coderabbitai full review — redoes the entire review from scratch.

If you'd like to focus reviews on the Zend directory, you can configure path-based instructions in a .coderabbit.yaml file. For example:

reviews:
  path_instructions:
    - path: "Zend/**"
      instructions: "Focus the review on this directory."

You can find more details in the path-based instructions documentation.

In the meantime, shall I trigger a full review of the PR?

@iluuu1994

Copy link
Copy Markdown
Owner Author

@CodeRabbit full review

@coderabbitai

coderabbitai Bot commented May 28, 2026

Copy link
Copy Markdown
✅ Actions performed

Full review triggered.

@iluuu1994

Copy link
Copy Markdown
Owner Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented May 28, 2026

Copy link
Copy Markdown
✅ Actions performed

Full review triggered.

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.

3 participants