build: clamp PT_LOAD p_align to 4 KiB on linux-x64 node binary#319355
Merged
Conversation
Node.js 23/24 linux-x64 build ships a dedicated `lpstub` PT_LOAD segment
aligned to 2 MiB (0x200000) so that, at startup the binary can remap its
.text region onto Linux hugepages for an iTLB win `--use-largepages=mode`.
WSL1 `binfmt_elf` strictly rejects any PT_LOAD whose `p_align`
exceeds the system page size (0x1000); the kernel returns ENOEXEC and the
shell reports "exec format error" before user space ever runs. This breaks
launching the bundled Node from the VS Code server under WSL1 starting
with Node 24.
The fix does not change runtime behavior:
- Node is a non-PIE EXEC binary with fixed virtual addresses
(`p_vaddr`, `p_paddr`); the loader maps each PT_LOAD at its
hard-coded address regardless of `p_align`, which on EXEC is
metadata describing alignment in memory rather than a request to
relocate.
- The hugepage optimization itself is performed at runtime
against the live mapping; it does not consult `p_align` and
is unaffected by this change.
- No shared libraries, native addons, or dynamic linker paths are
touched — only PT_LOAD segments inside the node executable itself.
Contributor
|
This PR will be automatically cherry-picked to |
Contributor
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: @dmitrivMSMatched files:
|
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the Remote Extension Host (REH) build pipeline to patch the bundled linux-x64 Node.js ELF so it can be executed under WSL1 (which rejects PT_LOAD segments whose p_align exceeds the system page size), and removes the now-unnecessary WSL1-only runtime patching from sanity tests.
Changes:
- Patch linux-x64 Node binaries during REH builds by clamping PT_LOAD
p_alignto 4 KiB. - Remove the WSL1 Node 24 workaround hook from WSL sanity tests.
- Remove the associated WSL1 patching helper/state from the sanity test context.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| build/gulpfile.reh.ts | Adds an ELF program-header patch step and wires it into the linux-x64 Node download pipeline. |
| test/sanity/src/wsl.test.ts | Removes calls to the WSL1 Node workaround before launching the WSL server. |
| test/sanity/src/context.ts | Deletes the WSL1 Node 24 workaround implementation and tracking set. |
TylerLeonhardt
approved these changes
Jun 1, 2026
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.
Node.js 23/24 linux x64 build ships a dedicated
lpstubPT_LOAD segment aligned to 2 MiB (0x200000) so that, at startup the binary can remap its .text region onto Linux hugepages for an iTLB win--use-largepages=mode.WSL1
binfmt_elfstrictly rejects any PT_LOAD whosep_alignexceeds the system page size (0x1000); the kernel returns ENOEXEC before user space ever runs. This breaks launching the bundled Node from the VS Code server under WSL1 starting with Node 24.The fix does not change runtime behavior:
p_vaddr,p_paddr); the loader maps each PT_LOAD at its hard-coded address regardless ofp_align, which on EXEC is metadata describing alignment in memory rather than a request to relocate.Fixes #318494