[PHP] fix: preserve process environments and chown sentinel semantics#742
Merged
brandonpayton merged 3 commits intoJul 11, 2026
Conversation
This was referenced Jul 10, 2026
Pass the same effective initial environment to the kernel Process metadata and process worker on Node and browser. Add an instrumented Node/Chromium regression covering initial state, isolated fork inheritance, exec replacement, and an explicitly empty envp.
Resolve each raw uid_t/gid_t -1 sentinel from authoritative file metadata only after target validation and authorization, then delegate even same-value requests so backend errors and inode side effects remain visible. Cover chown, fchown, and fchownat in Rust plus Node and Chromium guests.
brandonpayton
force-pushed
the
gascity/kd-6nz/split-pr717-preserve-fork-env
branch
from
July 11, 2026 15:11
9c02de5 to
f7fe495
Compare
brandonpayton
changed the base branch from
integration/kd-6nz-php-phpt-harness-only-base
to
integration/kd-6nz-php-phpt-platform-fixes
July 11, 2026 15:16
13 tasks
brandonpayton
added a commit
that referenced
this pull request
Jul 13, 2026
Fork and exec environment synchronization plus unchanged-ID chown handling alter existing launch, authorization, errno, and backend behavior. Advance ABI 29 to 30 and regenerate ABI evidence atomically. Source-PR: #742
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
Keep guest
environand kernel-owned process metadata coherent across launch,fork, and exec on Node and browser, and make
chown,fchown, andfchownathonor
(uid_t)-1/(gid_t)-1without hiding ordinary target,authorization, or backend behavior.
These are process-model and POSIX invariants surfaced by PHP, not PHP-specific
workarounds.
What changed
Node uses the requested environment or its effective empty default, while
browser computes its requested/default environment once and uses it on both
sides.
isolated fork inheritance, exec replacement, and an explicitly empty
envp, on both Node and Chromium.metadata after validating the target and authorization.
backend-error, timestamp, and set-ID semantics are not bypassed.
chown,fchown, andfchownat,and document the supported behavior and remaining authorization/flag gaps.
Review changes from the original PR
The original #742 head (
9c02de563) combined environment, ownership, and testrationale changes under one commit subject. It was rebuilt as three
purpose-specific commits on the exact Batch 2 tip.
The original custom scratch/snapshot environment machinery and fork-worker
reconstruction were not replayed: the aggregate already has bounded process
metadata replacement, kernel fork copies process metadata, and copied Wasm
memory preserves the live libc environment. Exec replacement and
posix_spawnmetadata are likewise already owned by their aggregate kernelpaths.
The original chown implementation returned early whenever resolved IDs matched.
That shortcut could bypass authorization and suppress backend errors and inode
side effects. The repaired implementation validates and delegates instead.
ABI disposition
This constituent has no structural ABI-file change, and the structural ABI
check passes. That is not standalone ABI-compatibility clearance: it consumes
Batch 2's process-metadata contract and changes syscall-visible behavior.
Keep it quarantined in #871 for the single aggregate ABI 16→17 reconciliation
and rebuilt ABI-bound artifacts.
Validation
Passed on the repaired source tree through
scripts/dev-shell.sh:cargo test -p kandelo --target aarch64-apple-darwin --lib: 1,076 passedchown/fchown/fchownat/lchown: 4 passedbash build.sh: completedbash scripts/check-abi-version.sh: structurally consistentRepository-wide
cargo fmt --checkis currently blocked by pre-existing Rustformatting drift, including unrelated regions of
syscalls.rs;git diff --checkis clean. The full host, libc, POSIX, full Sortix, canonical-browser,and PHP PHPT gates remain pending on the final aggregate.
View
Accept into Batch 2 only. The repaired implementation and history are
truthful, and the kernel plus focused Node/browser evidence supports the
constituent. It is not independently ready for
main; ABI 17 reconciliationand the full exact-aggregate gate remain required.