Repository navigation
Conversation
|
Review requested:
|
|
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. |
d520726 to
095e650
Compare
This comment was marked as outdated.
This comment was marked as outdated.
095e650 to
bed7908
Compare
|
@MikeMcC399 rebased, thank you. |
|
FreeBSD / x64 is listed as "experimental" and no longer tested in Jenkins CI. Adding @nodejs/platform-freebsd team members with a request to review. |
|
It seems that adding the FreeBSD team members hasn't helped to get a review and I'm wondering now if there is actually any active FreeBSD community amongst the Node.js members these days. Perhaps somebody from the build team mighty be able to sponsor this PR if it doesn't cause any regression for other operating systems? The lack of testing facilities for FreeBSD in Jenkins CI would mean that this is the maximum that could be achieved in any case. |
|
@MikeMcC399 any way i can help? |
Thanks for the offer! I think it's up to the Node.js team at the moment. |
|
@nodejs/build |
This comment was marked as resolved.
This comment was marked as resolved.
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>
bed7908 to
0512e5b
Compare
|
@MikeMcC399 done |
|
The GitHub Actions CI and Jenkins CI do not test FreeBSD, so passing tests only support checking that changes for FreeBSD have not caused a regression in tests running on other operating system (Linux, macOS, Windows). An independent check of this PR by somebody with access to a FreeBSD system, other than the PR author @samm-git, would be useful. Otherwise, perhaps the @nodejs/build team might agree to approve and to land this PR without an additional test on FreeBSD? |
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