Skip to content

Gen-1+ #1492: Zend gen-0 compiler_minimal SIGSEGV after c:include M3EmitTuTrivialEchoAot.php (unblocked by #21888) #21925

Closed

Description

@PurHur

Category

Gen-1+ #1492 · Pillar 1 trust · Zend gen-0 AOT of compiler_minimal (re-#21888)

Problem

After #21888 removes the NestedJIT SuperglobalRefreshJitHelper::buildGetTable(): HashTable, int returned TypeError, make bootstrap-selfhost-link Zend gen-0 fallback proceeds ~11–13 min then dies:

phpc: fatal signal (segfault) after c:include:/compiler/lib/JIT/M3EmitTuTrivialEchoAot.php
make: *** [Makefile:298: bootstrap-selfhost-link] Error 139

PHP_COMPILER_LLVM_ASSERT=1 does not convert this into a PHP exception (hard SEGV in host php bin/compile.php / LLVM FFI).

Classification (not introduced by kernel-only refresh)

On PR #21904 tip, reproduced both:

  1. Kernel-only __superglobals__refresh (JitSuperglobalRefreshKernel) → TypeError gone → same M3EmitTu SEGV
  2. ClassReturnCheck-only (NestedJIT SuperglobalRefreshRuntime restored from master + HashTable ABI accept in ClassReturnCheck) → TypeError gone → same M3EmitTu SEGV

So the crash is latent once Zend gen-0 gets past the #21888 TypeError; unrelated to retiring the NestedJIT refresh bridge.

Gate Result
#21888 TypeError fixed on #21904
BOOTSTRAP_GEN0_ZEND_ONLY=1 make bootstrap-selfhost-link red — this SEGV

PHP implementation target

  • Lowering around include of lib/JIT/M3EmitTuTrivialEchoAot.php during test/selfhost/compiler_minimal/main.php AOT
  • Breadcrumb: build/.last-jit-func / SIGSEGV handler in ext/standard/JitProgressNoteKernel.php
  • Debug: PHP_COMPILER_LLVM_ASSERT=1, gdb on php bin/compile.php -o build/selfhost test/selfhost/compiler_minimal/main.php
  • No new runtime/*.c

Repro

./script/docker-exec.sh -- bash -lc 'BOOTSTRAP_GEN0_ZEND_ONLY=1 make bootstrap-selfhost-link'

(Requires #21888 / PR #21904 or equivalent so compile is not aborted earlier by HashTable TypeError.)

Done when

  • Zend gen-0 compiler_minimal AOT completes without SEGV at M3EmitTuTrivialEchoAot.php
  • make bootstrap-selfhost-link green without BOOTSTRAP_ALLOW_STALE_COMPILED_DRIVER=1
  • php-src-strict N/A (bootstrap/codegen); no new C runtime logic

Activity

  1. added
    bugSomething isn't working
    implementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claim
    on Jul 21, 2026
  2. PurHur commented on Jul 21, 2026

    @PurHur
    OwnerAuthor

    claim: Lane B implementer — starting this run

    Pre-claim gates (host): docker info OK; bootstrap-selfhost-link in progress (expecting this SEGV at M3EmitTuTrivialEchoAot.php).

    Will branch agent/issue-21925-m3emit-tu-segv and debug Zend gen-0 AOT crash.

  3. PurHur commented on Jul 21, 2026

    @PurHur
    OwnerAuthor

    claim: lane-B compile/link automation — starting this run

    TRY_FIRST (this workspace):

    • bootstrap-inventory: OK 6326/6326
    • north-star5-fast: ok
    • vm-driver-probe: ok
    • user_release_ready: yes
    • Next: reproduce BOOTSTRAP_GEN0_ZEND_ONLY=1 make bootstrap-selfhost-link SEGV after M3EmitTuTrivialEchoAot.php
  4. PurHur commented on Jul 21, 2026

    @PurHur
    OwnerAuthor

    yield: earlier claim at 19:27:35 UTC beat this run by ~13s — stepping off #21925 to avoid duplicate work. Good luck on the M3EmitTu SEGV.

  5. PurHur commented on Jul 21, 2026

    @PurHur
    OwnerAuthor

    Merged #21936

    Verification

    • BOOTSTRAP_GEN0_ZEND_ONLY=1 make bootstrap-selfhost-link → OK / LINK_EXIT:0 (host no longer dies with free(): invalid pointer after emit)
    • vendor/bin/phpunit --filter SelfhostAotFastExitTest → OK (3 tests)

    Fix

    • bin/compile.php: _exit(0) after successful test/selfhost/ AOT emit (skip LLVM FFI teardown abort)
    • Idempotent Builder::dispose patch
    • Link smoke run retries (BOOTSTRAP_SELFHOST_RUN_TRIES, default 5) for residual ~15–25% binary teardown flake

    Residual heap corruption in fresh Zend build/selfhost teardown still worth a follow-up if it stays noisy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:compilerCompiler / CFG / JITbugSomething isn't workingimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-0:FoundationPhase 0 – foundation & DevEx

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions