Skip to content

[osx]: Crash when loading the same addon from two different paths #26765

Closed
@gabrielschulhof

Description

@gabrielschulhof

Version: 10.15.0, master
Platform: Darwin 18.2.0 Darwin Kernel Version 18.2.0: Mon Nov 12 20:24:46 PST 2018; root:xnu-4903.231.4~2/RELEASE_X86_64 x86_64
Subsystem: native addons

Code as a tarball from gist

When the two copies of an addon are loaded into the same process on OSX, their symbols overlap. That is, two symbols that have the same name receive the same address. This can result in a segfault if the symbol is a global static data item and both copies of the addon make use of it oblivious to one another.

There's a PR against node-gyp which seeks to introduce -fvisibility=hidden for building native addons on OSX. It includes a unit test which makes sure that symbols in each copy of an addon get distinct addresses.

Metadata

Metadata

Assignees

No one assigned

    Labels

    addonsIssues and PRs related to native addons.gypIssues and PRs related to the GYP tool and .gyp build filesmacosIssues and PRs related to the macOS platform / OSX.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions