Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wip] nodejs: building and paxmarking mksnapshot in preBuild #20727

Closed
wants to merge 4 commits into from

Conversation

spacekitteh
Copy link
Contributor

Motivation for this change

Can't build on grsec kernels 'cus MPROTECT violation for mksnapshot.

Things done
  • Tested using sandboxing
    (nix.useSandbox on NixOS,
    or option build-use-sandbox in nix.conf
    on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • Linux
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@mention-bot
Copy link

@spacekitteh, thanks for your PR! By analyzing the history of the files in this pull request, we identified @gilligan, @vcunat and @FRidh to be potential reviewers.

@gilligan
Copy link
Contributor

I do not have the slightest idea what this is about. Could someone elaborate a bit for me?

@spacekitteh
Copy link
Contributor Author

@gilligan, when building nodejs on a grsec/pax-enabled kernel, one of the steps builds and uses something called "mksnapshot", idk what it does, but it executes runtime-created code. PaX has a feature which prevents writable memory from being executed after program start, unless a flag is set on the binary. This patch first builds the mksnapshot binary, then sets the appropriate flag, and continues with the rest of the build.

@@ -48,6 +48,9 @@ in
preBuild = optionalString stdenv.isDarwin ''
sed -i -e "s|tr1/type_traits|type_traits|g" \
-e "s|std::tr1|std|" src/util.h
'' + ''
make -j${NIX_BUILD_CORES} -l${NIX_BUILD_CORES} -C $out mksnapshot
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a principled way to do this? Like, properly calling make? (Also, undefined vars. I gotta change this to the nix vars.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently I need to include makeFlags.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think there's a way, except to copy and edit that line from stdenv or similar.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's what I was doing. Dangit.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@spacekitteh
Copy link
Contributor Author

Can anyone fix this by any chance? I don't have the time currently and it's stopping me from upgrading my system :(

@spacekitteh
Copy link
Contributor Author

Turns out it's v8 that has to be paxmarked, not nodejs.

@spacekitteh spacekitteh closed this Dec 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants