Skip to content

test(tracing): fake-closure hook teardown ASAN regression#3626

Draft
morrisonlevi wants to merge 1 commit intomasterfrom
levi/php81-asan
Draft

test(tracing): fake-closure hook teardown ASAN regression#3626
morrisonlevi wants to merge 1 commit intomasterfrom
levi/php81-asan

Conversation

@morrisonlevi
Copy link
Collaborator

@morrisonlevi morrisonlevi commented Feb 5, 2026

PROF-13687

Description

Add a (somewhat) minimal PHPT that installs HOOK_INSTANCE hooks on Reflection-created fake closures and removes the hook from the posthook (self-removal while unwinding). This reproduces deterministic ASAN SEGVs seen on PHP 8.1 debug-zts-asan in zai_hook_install_address() for me locally.

Reviewer checklist

  • Test coverage seems ok.
  • Appropriate labels assigned.

Add a (somewhat) minimal PHPT that installs HOOK_INSTANCE hooks on
Reflection-created fake closures and removes the hook from the
posthook (self-removal while unwinding). This reproduces deterministic
ASAN SEGVs seen on PHP 8.1 debug-zts-asan in
`zai_hook_install_address()` for me locally.

Keep runtime noise low by disabling root spans, auto-flush, sidecar sending,
telemetry, and opcache.
@datadog-official
Copy link

datadog-official bot commented Feb 5, 2026

⚠️ Tests

Fix all issues with Cursor

⚠️ Warnings

❄️ 2 New flaky tests detected

tmp/build_extension/tests/ext/sandbox/install_hook/self_remove_fake_closure_teardown_asan_php81.phpt (ASAN regression: self-removing HOOK_INSTANCE on fake closures) from php.tmp.build_extension.tests.ext.sandbox.install_hook (Datadog) (Fix with Cursor)
001+ AddressSanitizer:DEADLYSIGNAL
001- ok
002+ =================================================================
003+ ==4253==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0xfe46f9d9c3ac bp 0xffffeff86e40 sp 0xffffeff86e10 T0)
004+ ==4253==The signal is caused by a READ memory access.
005+ ==4253==Hint: address points to the zero page.
006+     #0 0xfe46f9d9c3ac in zai_hook_install_address tmp/build_extension/zend_abstract_interface/hook/hook.h:146:19
007+     #1 0xfe46f9d9a374 in zai_hook_frame_address tmp/build_extension/zend_abstract_interface/hook/hook.h:154:12
008+     #2 0xfe46f9d9a98c in zai_hook_finish tmp/build_extension/zend_abstract_interface/hook/hook.c:1121:34
009+     #3 0xfe46f9d6ad04 in zai_interceptor_execute_internal_impl tmp/build_extension/zend_abstract_interface/interceptor/php8/interceptor.c:897:9
...
tmp/build_extension/tests/ext/sandbox/install_hook/self_remove_fake_closure_teardown_asan_php81.phpt (ASAN regression: self-removing HOOK_INSTANCE on fake closures) from PHP.tmp.build_extension.tests.ext.sandbox.install_hook (Datadog) (Fix with Cursor)
001+ AddressSanitizer:DEADLYSIGNAL
001- ok
002+ =================================================================
003+ ==3166==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0xe78a4f59af14 bp 0xffffdc440620 sp 0xffffdc4405f0 T0)
004+ ==3166==The signal is caused by a READ memory access.
005+ ==3166==Hint: address points to the zero page.
006+     #0 0xe78a4f59af14 in zai_hook_install_address tmp/build_extension/zend_abstract_interface/hook/hook.h:146:19
007+     #1 0xe78a4f598edc in zai_hook_frame_address tmp/build_extension/zend_abstract_interface/hook/hook.h:154:12
008+     #2 0xe78a4f5994f4 in zai_hook_finish tmp/build_extension/zend_abstract_interface/hook/hook.c:1121:34
009+     #3 0xe78a4f569804 in zai_interceptor_execute_internal_impl tmp/build_extension/zend_abstract_interface/interceptor/php8/interceptor.c:897:9
...

🧪 1024 Tests failed

    testSearchPhpBinaries from integration.DDTrace\Tests\Integration\PHPInstallerTest (Fix with Cursor)

    testSimplePushAndProcess from laravel-58-test.DDTrace\Tests\Integrations\Laravel\V5_8\QueueTest (Fix with Cursor)

testSimplePushAndProcess from laravel-8x-test.DDTrace\Tests\Integrations\Laravel\V8_x\QueueTest (Datadog) (Fix with Cursor)
DDTrace\Tests\Integrations\Laravel\V8_x\QueueTest::testSimplePushAndProcess
Test code or tested code printed unexpected output: spanLinksTraceId: 6984db3300000000db92c03abc93f66d
tid: 6984db3300000000
hexProcessTraceId: db92c03abc93f66d
hexProcessSpanId: b9121a30fa1cf1a3
processTraceId: 15821919799410423405
processSpanId: 13335750244254413219

phpvfscomposer://tests/vendor/phpunit/phpunit/phpunit:106
View all
This comment will be updated automatically if new data arrives.
🔗 Commit SHA: b73e7cc | Docs | Datadog PR Page | Was this helpful? Give us feedback!

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