Skip to content

Regression: AOT password_hash(PASSWORD_BCRYPT) segfaults after build — VM/JIT match Zend (re-#26773, ext/standard/password.c) #26861

Description

@PurHur

Category

bug · php-src-strict · stdlib · user-script AOT · pillar 4

Problem

password_hash(..., PASSWORD_BCRYPT, ['cost' => 4]) + password_verify match Zend on VM and JIT (ok / ok), but user-script AOT builds then segfaults at run time (fatal signal after c:main_before_php, exit 139). Reproduced 3/3 runs on the same binary — not intermittent.

Prior closed AOT gap #26773 was PASSWORD_ARGON2ID LLVM verify / dominate-uses; this is the bcrypt path segfaulting after a successful link.

Probed 2026-08-02 @ d72ac27fd.

Repro Zend / VM / JIT AOT (2026-08-02)
password_hash('secret', PASSWORD_BCRYPT, ['cost'=>4]) + verify ok / ok build OK (~25 MB); run exit 139 ×3

php-src reference

PHP implementation target

  • ext/standard/ password helpers + lib/JIT/Builtin/ password lowering — AOT must not leave a null/broken crypto trampoline; prefer PHP-in-PHP / existing VmPassword path over new runtime/*.c
  • Confirm thin AOT execute links the same helper as JIT (no VmClosureCall-style stub)

Repro

./script/docker-exec.sh -- bash -lc '
cat > /tmp/issue_pwd_aot.php <<'"'"'PHP'"'"'
<?php
$h = password_hash("secret", PASSWORD_BCRYPT, ["cost" => 4]);
echo password_verify("secret", $h) ? "ok" : "bad", "\n";
echo password_verify("wrong", $h) ? "bad" : "ok", "\n";
PHP
php /tmp/issue_pwd_aot.php
php bin/vm.php /tmp/issue_pwd_aot.php
php bin/jit.php /tmp/issue_pwd_aot.php
php bin/compile.php -o /tmp/issue_pwd_aot /tmp/issue_pwd_aot.php
/tmp/issue_pwd_aot; echo exit:$?
'

Done when

  • AOT binary prints ok / ok matching Zend/VM/JIT (no segfault)
  • Re-run binary ≥3× (or script/differential-sweep.sh --aot --repeat 3 equivalent) — all match
  • Compliance or unit guard under test/ covering bcrypt password_hash+password_verify AOT execute
  • php-src-strict; no php-compiler-strict shortcut

Activity

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-4:stdlibPhase 4 – stdlib for web appsstdlib

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions