Skip to content

os x: re-enable PIE (ASLR) #6466

Description

@bnoordhuis

Commit a5012a0 disables PIE (and therefore ASLR) on OS X because it breaks profiling of C++ code. Ideally, we'd figure out a way to keep it turned on except when -prof is specified on the command line.

I believe the only way to do that (except for having two separate binaries, which I don't think we want) is to re-exec the process with the _POSIX_SPAWN_DISABLE_ASLR (256) flag set. The flag is ignored for setuid/setgid binaries so in that respect -Wl,-no_pie is superior.

Activity

  1. added
    c++Issues and PRs that require attention from people who are familiar with C++.
    macosIssues and PRs related to the macOS platform.
    on Apr 29, 2016
  2. bnoordhuis commented on Apr 29, 2016

    @bnoordhuis
    MemberAuthor
  3. indutny commented on Apr 29, 2016

    @indutny
    Member

    @bnoordhuis I wonder how lldb starts the process in such way that it is still able to resolve symbols.

  4. bnoordhuis commented on Apr 29, 2016

    @bnoordhuis
    MemberAuthor

    @indutny In exactly the same way as the PR. :-)

  5. indutny commented on Apr 29, 2016

    @indutny
    Member

    While this is simple enough, lldb also works when attaching to existing process. I wonder if the image ranges reported by _dyld_get_image_header() may be used to determine ASLR shift in profiler.

  6. bnoordhuis commented on Apr 29, 2016

    @bnoordhuis
    MemberAuthor

    I've been investigating that but it's not exactly trivial: we'd first need to teach the profiler about the VM slide for each shared object and every third-party profiling tool would have to duplicate the effort.

  7. indutny commented on Apr 29, 2016

    @indutny
    Member

    @bnoordhuis the reason why I ask this, is that with your patch one won't be able to start the profiler at runtime, and this is certainly desirable in some environments.

    If the tooling needs to break, then we probably need to keep it -no_pie for v6, and break the things in v7. Sliding all symbols by fixed value in tools/tickprocessor.js doesn't seem to be complicated at all.

    Will open an alternative PR in a bit.

  8. indutny commented on Apr 29, 2016

    @indutny
    Member

    Here is my proposal: #6475

  9. indutny commented on Apr 29, 2016

    @indutny
    Member

    It seems that #6475 works too, so we have to decide what is the best for us. Would love to hear @nodejs/ctc opinion on this.

  10. jasnell commented on Apr 29, 2016

    @jasnell
    Member

    @indutny ... to be honest, I'd trust you and @bnoordhuis most to make the decision on this. Whichever approach you each feel is right, works for me.

  11. indutny commented on Apr 29, 2016

    @indutny
    Member

    @bnoordhuis how do you feel about Sumo fight?

  12. added a commit that references this issue on May 2, 2016
  13. added a commit that references this issue on May 4, 2016
  14. jasnell commented on Jul 6, 2016

    @jasnell
    Member
  15. indutny commented on Jul 6, 2016

    @indutny
    Member

    pong

  16. bnoordhuis commented on Jul 6, 2016

    @bnoordhuis
    MemberAuthor

    This PR can be closed (and that's what I'll do.) I'll post a follow-up question in #6558.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    c++Issues and PRs that require attention from people who are familiar with C++.macosIssues and PRs related to the macOS platform.securityIssues and PRs related to security.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions