Repository navigation
Conversation
Collaborator
|
Review requested:
|
Contributor
|
Welcome to Node.js, and thank you for your first contribution! Before review, please take a moment to read:
Please make sure every commit is signed off. For a first pull request, GitHub Actions require collaborator approval and Jenkins CI must be started by a collaborator or triager, so an initial wait is normal. |
samm-git
force-pushed
the
freebsd-wxneeded
branch
from
November 3, 2026 22:38
d520726 to
095e650
Compare
This comment was marked as outdated.
This comment was marked as outdated.
FreeBSD 13.0+ can enforce W^X via kern.elf{32,64}.allow_wx=0.
V8 requires RWX pages for its code range, so node aborts at
startup and mksnapshot/node_mksnapshot abort during the build.
Mark executables that create V8 isolates with the
NT_FREEBSD_FCTL_WXNEEDED feature bit using elfctl(1).
mksnapshot and node_mksnapshot are marked before their gyp
actions run, and a FreeBSD-only node_wxneeded target marks the
linked node binary.
Fixes: nodejs#40467
Signed-off-by: Alex Samorukov <samm@os2.kiev.ua>
samm-git
force-pushed
the
freebsd-wxneeded
branch
from
November 4, 2026 19:23
095e650 to
bed7908
Compare
Author
|
@MikeMcC399 rebased, thank you. |
Contributor
|
FreeBSD / x64 is listed as "experimental" and no longer tested in Jenkins CI. Adding @nodejs/platform-freebsd team members with a request to review. |
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.
What does this PR do?
Marks FreeBSD executables that create V8 isolates with
NT_FREEBSD_FCTL_WXNEEDEDviaelfctl(1):mksnapshot,node_mksnapshot,and
node.Motivation
With
kern.elf{32,64}.allow_wx=0, FreeBSD rejects RWX mappings withEACCES.V8 pre-maps its code range RWX, so Node and the snapshot generators abort with:
ENOMEMis 12 andEACCESis 13 — the CHECK expects the wrong error.-Wl,-z,wxneededdoes not work on FreeBSD: lld emitsPT_OPENBSD_WXNEEDED, but FreeBSD checksNT_FREEBSD_FCTL_WXNEEDED.Implementation
tools/freebsd-wxneeded.py, a helper aroundelfctl -e +wxneeded.mksnapshotandnode_mksnapshotbefore their gyp actions run.node_wxneededtarget, part ofall, to mark the linkednodebinary.W^X remains enabled system-wide; only these JIT-using executables are exempt.
Testing
Full build on FreeBSD 15.1 arm64 with
kern.elf64.allow_wx=0succeeded.elfctlreportswxneededset on all three binaries, and the built Node runswith the JIT enabled under W^X:
node_wxneededis part ofall; building onlymake -C out nodeskips it.Fixes: #40467