Skip to content

php-in-php: VmRandomNative — drop libc getrandom FFI, VmRandomPure SSOT (#1492) #12181

Description

@PurHur

Category

php-in-php | runtime-shrink

Problem

ext/standard/VmRandomNative.php still opens libc getrandom/open/read FFI even though #8921 added VmRandomPure as fallback. Self-host M5 should not link libc FFI for random_bytes() / openssl_random_pseudo_bytes() when /dev/urandom is readable via compiled stream read.

php-src reference

Repro

grep -c "FFI::cdef" ext/standard/VmRandomNative.php

Scope

Layer Path
PHP impl ext/standard/VmRandomPure.php — SSOT via /dev/urandom read
VM ext/standard/VmRandomNative.php — thin delegate, no FFI::cdef
Tests Update test/unit/VmRandomNativeRuntimeShrinkTest.php

Done when (php-src-strict)

  • VmRandomNative.php has no libc FFI
  • random_bytes(16) repro with PHP_COMPILER_DISABLE_FFI=1 matches Zend length
  • make bootstrap-selfhost-vm-driver-execute-probe green

Refs #8921, #1492

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 & DevExphase-4:stdlibPhase 4 – stdlib for web apps

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions