Skip to content

php-in-php: drop always-on Builtin\Type getrandom after NestedJIT urandom migration (#29531 shape) #32139

Description

@PurHur

Category

php-in-php · runtime-shrink (#1492, peer #32110 sprintf / #29531 random_bytes)

Problem

Always-on Builtin\Type still registers libc getrandom(3) (Type::register() addFunction('getrandom')) even though:

  1. User-script random_bytes() already lives in PHP (RandomBytesJitHelper / StringRandomBytes / __compiler_random_bytes) — not this always-on libc row.
  2. NestedJIT JitRandomBytesKernel already reads /dev/urandom via module-local open/read (LibcExtern::ensurePosixFd, php-in-php: drop always-on LibcExtern open/close/read/write after NestedJIT declares module-locally (#31764 shape) #31817 / php-in-php: RandomBytesJitHelper → @random_bytes NestedJIT leaf; delete phpc_random_bytes_kernel (re-#29364 / gethostname) #29531). It does not call getrandom(3).
  3. There are zero lookupFunction('getrandom') consumers under lib/ + ext/. The always-on row is dead C surface on every JIT/AOT module.
Path Today Target
User-script random_bytes() PHP helpers (RandomBytesJitHelper / StringRandomBytes) unchanged
NestedJIT kernel /dev/urandom via open/read unchanged
Builtin\Type always-on libc getrandom drop declare
VM VmRandomPure / VmRandomNative (no getrandom FFI, #8921 / #12181) unchanged

php-src reference

PHP implementation target

  • lib/JIT/Builtin/Type.php — drop always-on libc getrandom declare
  • test/unit/GetrandomRuntimeShrinkTest.php — assert Type no longer addFunction('getrandom'); no NestedJIT lookupFunction('getrandom') remains

Repro

./script/phpunit.sh --filter 'GetrandomRuntimeShrinkTest|StringRandomBytesRuntimeShrinkTest|VmRandomPureRuntimeShrinkTest'

Done when

  • Builtin\Type has no always-on libc getrandom declare
  • No NestedJIT lookupFunction('getrandom') remains
  • User-script random_bytes() still goes through PHP helpers / /dev/urandom kernel
  • php-src-strict; user-script random_bytes() behavior unchanged
  • exit/abort always-on decls remain (live consumers)

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 / JITenhancementNew feature or requestimplementation-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