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.
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>
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 |
|
I don't want to load you unnecessary, but a change for AIX is now causing a conflict. If it's not too much trouble, perhaps you could rebase? |
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