[PHP] Batch 2: PHPT platform and ABI fixes#871
Open
brandonpayton wants to merge 31 commits into
Open
Conversation
Port the PHP-specific harness, browser VFS/page wiring, PHP 8.3.15 package recipe, libiconv dependency package, and support fixtures from source PR #2 as a scoped checkpoint. General platform fixes and current validation evidence follow in later commits.
Sort fork-bearing regions before allocating locals and rewriting sequences so identical inputs produce identical output bytes. Preserve a shared module’s leading dylink.0 section across Walrus emission, and cover both contracts with focused regressions.
Build PHP and its native dependencies from verified sources in isolated workdirs, pin clang to its adjacent wasm-ld, and use target-correct configure cache values. Marshal POSIX timer notifications through a fixed-width libc contract and suppress SIGEV_NONE wakeups consistently across libc, kernel, and host. Keep the PHP timeout hook’s later Batch 2 ABI dependency explicit.
Layer PHP artifacts and maintained fixtures over the canonical rootfs, and fingerprint every image input so stale browser test images rebuild automatically. Use packaged ps and pgrep, resolve canonical lazy executable URLs, preserve observable PHPT filesystem state, and remove static OpenSSL policy data from the kernel.
Align section environments, cleanup, expectation matching, extension probing, source discovery, and retry behavior with PHP’s runner where Kandelo supports them. Keep unsupported boundaries, BORK, WARN, XPASS, timeouts, and warned mismatches visible in reports and exit status, with focused harness coverage and historical evidence labeled as such.
(cherry picked from commit 274a2ca)
(cherry picked from commit 05d6970)
(cherry picked from commit ea7c94c)
(cherry picked from commit cfa1cff)
Preserve logical binding owners, durable fork state, IPv6 and Unix socket identity, and bounded socket-option marshalling. Reject stale or unsupported datagram peers instead of silently redirecting data; machine-wide host-backed datagram routing remains a separate aggregate follow-up.
Apply one bounded decimal-IPv4 and ASCII hostname contract across Node TCP, browser Fetch/TLS, and local virtual networking. Keep browser DNS synthesis explicit and restrict virtual-network resolution to registered aliases.
Phase B-1 matrix build status —
|
| Package | Arch | Status | Sha |
|---|---|---|---|
| libcurl | wasm32 | built | 873f0298 |
| libcxx | wasm32 | built | 5009ca76 |
| libcxx | wasm64 | built | b81726d2 |
| libiconv | wasm32 | built | 912738bc |
| libpng | wasm32 | built | c06623bd |
| libxml2 | wasm32 | built | 72e9b8e6 |
| openssl | wasm32 | built | d180bd20 |
| openssl | wasm64 | built | d2bce644 |
| sqlite | wasm32 | built | 7f6b5db4 |
| sqlite | wasm64 | built | 31cfdd1e |
| zlib | wasm32 | built | 31462832 |
| zlib | wasm64 | built | ef001a95 |
| bc | wasm32 | built | a04c9d63 |
| bzip2 | wasm32 | built | 9a8e0ba0 |
| coreutils | wasm32 | built | 1324bdbd |
| curl | wasm32 | built | dbcad540 |
| dash | wasm32 | built | e236a704 |
| diffutils | wasm32 | built | 49ec62af |
| dinit | wasm32 | built | d3b3bb21 |
| fbdoom | wasm32 | built | da0d0acd |
| file | wasm32 | built | 72e9075f |
| findutils | wasm32 | built | 754bbe43 |
| gawk | wasm32 | built | b93bbd73 |
| git | wasm32 | built | 68281ae8 |
| grep | wasm32 | built | ef5f740c |
| gzip | wasm32 | built | b5be4abd |
| hello | wasm32 | built | 26179d3b |
| kandelo-sdk | wasm32 | built | c59ff562 |
| kernel | wasm32 | built | 76091ee0 |
| less | wasm32 | built | 6b0267f0 |
| lsof | wasm32 | built | 0a6b10ab |
| m4 | wasm32 | built | d51871a1 |
| make | wasm32 | built | f9479cbb |
| mariadb | wasm32 | built | e7b1d66a |
| mariadb | wasm64 | built | 3e32ca3c |
| modeset | wasm32 | built | d7914254 |
| msmtpd | wasm32 | built | 8a4c1bd1 |
| nano | wasm32 | built | 9c631e65 |
| ncurses | wasm32 | built | 835bc116 |
| netcat | wasm32 | built | 72d0bb72 |
| nginx | wasm32 | built | c021a0cf |
| php | wasm32 | built | c0cbce54 |
| posix-utils-lite | wasm32 | built | ad1c3a04 |
| sed | wasm32 | built | b3ef7bbc |
| spidermonkey | wasm32 | built | f6095bbd |
| tar | wasm32 | built | fda46d6e |
| tcl | wasm32 | built | a2f0fb11 |
| unzip | wasm32 | built | 56b0c5b0 |
| userspace | wasm32 | built | 8f5ae0d3 |
| vim | wasm32 | built | a82fcb97 |
| wget | wasm32 | built | a644c121 |
| xz | wasm32 | built | 4f2ac1f3 |
| zip | wasm32 | built | a5b4a020 |
| zstd | wasm32 | built | 300b21ee |
| bash | wasm32 | built | 7e29afe9 |
| mariadb-test | wasm32 | built | f15fb28b |
| mariadb-vfs | wasm32 | built | 5482ab12 |
| mariadb-vfs | wasm64 | built | 55ec8746 |
| nethack | wasm32 | built | 08844797 |
| node | wasm32 | built | ed4a6deb |
| spidermonkey-node | wasm32 | built | 2d4722d5 |
| vim-browser-bundle | wasm32 | built | 64129df8 |
| nethack-browser-bundle | wasm32 | built | 879d6625 |
| rootfs | wasm32 | built | 726bc8e6 |
| shell | wasm32 | built | b38678e4 |
| node-vfs | wasm32 | built | 3f692e41 |
Auto-generated; replaced on each push. Raw data in the publish-status workflow artifact.
Tie accepted connection lifetime to pipe ownership, retain inbound data across backpressure, wake blocked pipe I/O, and drain queued output before FIN. Model final TCP receive ownership as a discard sink, reject unsupported enabled SO_LINGER, and record the additive real-reader ABI export.
When the fixed internal AF_INET/AF_INET6 receive queue is full, discard the incoming datagram and preserve the order of datagrams already accepted. Keep AF_UNIX on its existing bounded path because reliable Unix datagrams need a separate sender-backpressure design. This changes socket overflow semantics without adding structural ABI entries. It is quarantined in Batch 2 for the planned ABI 16-to-17 semantic reconciliation.
Unix datagrams are reliable, so a full receive queue now returns EAGAIN into the host blocking-retry path instead of discarding a message. Connected senders also stop advertising POLLOUT until their peer drains space.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
This is the stacked Batch 2 integration PR for the PHP PHPT platform fixes split from #717. It is based on the still-open Batch 1 integration branch rather than
main, so the batches remain independently reviewable while constituent PRs are landed linearly with rebase merges.This PR is intentionally open and incomplete. Do not merge it into Batch 1 or
mainuntil every constituent has been reviewed, the divergent ABI-16 lineages have been reconciled as ABI 17, and the exact aggregate branch has passed the full gate.Constituent review ledger
dylink.0preservation, reproducible package/SDK/timer work, canonical packaged browser state, truthful PHPT verdict/evidence handling, a 2 GiB/131,072-inode PHPT VFS capacity repair, and a clean browser-readiness asset fix.env.__wasm_posix_vm_interrupt_after, supplied by #757; it is not independently runnable or publishable and must receive the aggregate ABI 16→17 reconciliation plus a PHP ABI floor of 17.getsockoptcopies, complete forked socket state, multicast/interface fixes, Node/browser hostname parity, focused tests, and truthful architecture/POSIX/browser docs.MSG_TRUNCsemantics, while host-backed UDP fork ownership, AF_UNIX shared backlog, and #855's deferred machine-wide routing redesign remain. Observable semantic changes require the final aggregate ABI 16→17 reconciliation; the structural ABI-16 check is not standalone clearance.LocalVirtualNetwork, separating FIN from abort/reset while preserving queued data and independent stream directions.SO_LINGER; added an additive real-reader export/snapshot; strengthened Node, virtual, fork, large-payload, zero-FIN, Sortix, and browser coverage; and documented the remaining reset limitation truthfully.kernel_pipe_has_readerswhile the constituent still reports ABI 16, so it is deliberately not independently main-ready and must be included in the aggregate ABI 16→17 reconciliation. Full PHPT/host/browser gating still awaits #757 and the final aggregate.EAGAIN; connected-peer purge/admission andEPERM; read-shutdownEPIPE/SIGPIPE; dequeue/connect/shutdown/close/unlink send-state wakes; one absolute finite readiness deadline with final kernel checks; and Rust, host, pthread guest, Node, and Chromium coverage.SO_BROADCASTfor IPv4 limited broadcast and Linux-compatible inputMSG_TRUNClength reporting across IPv4, IPv6, and Unix datagrams.recv/recvfrom/recvmsgmarshalling; and added Rust, guest-ABI, Node, Chromium, and contract-documentation coverage.recvmsg()outputmsg_flagsstill explicit gaps. Its changed send errno and receive return-length semantics are semantic ABI changes and remain quarantined for the aggregate ABI 16→17 reconciliation.#740's review includes two byte-identical five-artifact PHP builds, full kernel and host evidence, exact artifact hashes, a complete 19,017-test VFS image audit, and a clean headed-Chromium readiness check. Full PHPT results in its description are explicitly labeled historical and were not rerun on the repaired constituent.
#754's final repaired source passed 1,005 kernel tests, 114 host test files/919 passing tests, wasm32+wasm64 checks, host typecheck,
build.sh, and the structural ABI-16 check. A real Chromium run passed the three-machine UDP/TCP/curl network lab. The canonical./run.sh browserpackage preparation resolved 64/66 targets but stopped at WordPress preinstall on #740's known missing #757 import; that is recorded as a failed aggregate startup attempt, not a passing result.#755's final repaired source passed 1,010 kernel tests; 32 focused host networking tests with 2 skipped; host typecheck;
build.sh; and 3/3 focused Sortix close/shutdown cases in both the native runner and real Chromium. Its structural ABI check reports only the additive reader export, which does not clear the semantic or prebuilt-kernel compatibility boundary. Exact full-host and canonical-browser attempts reached the generated PHP artifact and failed on #740's known missing #757 interrupt import; the final network-lab rerun was separately blocked by the currently generated GNU netcat artifact, which fails its own Node tests. None of those blocked/failed aggregate attempts is claimed as a pass.#859's final repaired source passed 1,015 kernel tests; 3 focused host wake/deadline tests; host build/type declarations; warning-clean wasm32 guest syntax; and the two exact overflow/backpressure Sortix tests in both Node and real Chromium. Full host Vitest reached 115 passing files / 5 failing files and 903 passing / 23 failing tests; every failure was the known missing #757 PHP interrupt import or absent wasm64 hello artifact, not a datagram regression. The ABI check remained synchronized and reported only #755's existing additive export.
./run.sh browseris still blocked by the current #740/#757 aggregate startup dependency, so only the exact real-Chromium guest result is claimed.#860's repaired source passed 1,021 kernel tests; the focused #859 host wake/deadline regressions (2 files / 3 tests); host build and declaration generation; warning-clean wasm32 guest syntax; and its exact datagram-flags guest test in both Node and real Chromium. The guest path covers bounded-copy sentinels, zero-length
recvfrom/recvmsg, all three datagram families,MSG_PEEK, fixed buffer readback, and AF_UNIX full-queue readiness. The ABI check stayed synchronized and still reports only #755's existing additive export structurally; #860's syscall-semantic changes are reserved for ABI 17. The full host/libc/browser-demo gate remains aggregate-only, and the known #740/#757 startup dependency still blocks./run.sh browser.#855 is now explicitly deferred without replaying its current commits. #754/#859 leave a genuine machine-wide datagram gap, but #855's IPv4-only post-send helper can duplicate reuse-address delivery and attach
ECONNREFUSEDafter a successful delivery. A future replacement must route once through ProcessTable-owned Inet/Inet6/multicast/Unix state and test the public syscall wrapper.Planned remaining constituents
The ledger above will be extended with the summary, review changes, and recommendation for each constituent as it is reviewed and landed.
Required aggregate reconciliation
Both current
main/Batch 1 and the historical PHP stack independently moved ABI 15→16 with divergent kernel exports. Batch 2 must perform one explicit ABI 16→17 reconciliation that:kernel_pipe_has_readershost dependency, and assigns [PHP] fix: preserve queued datagrams under receive overflow #859's kernel-host datagram wake contract plus [PHP] fix: enforce limited-broadcast and datagram truncation semantics #860's send/receive semantic changes to ABI 17;ABI_VERSION,abi/snapshot.json, the C header, and generated TypeScript bindings in the same change;kernel_abifloor to 17.The
/etc/sslrootfs/VFS ownership decision and browser PHPT image contract must also be resolved before the aggregate is considered complete.Verification status
scripts/dev-shell.sh:cargo test -p kandelo --target aarch64-apple-darwin --libcd host && npx vitest runscripts/run-libc-tests.shbash scripts/check-abi-version.sh./run.sh browserplus real browser verification for the PHPT/browser surfaceLanding mechanics
integration/kd-6nz-php-phpt-batch-1-kernel-fixes.mainwithout Brandon's explicit approval.