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

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

Closed
gabrielschulhof opened this issue Mar 19, 2019 · 0 comments
Closed
Labels
addons Issues and PRs related to native addons. gyp Issues and PRs related to the GYP tool and .gyp build files macos Issues and PRs related to the macOS platform / OSX.

Comments

@gabrielschulhof
Copy link
Contributor

gabrielschulhof commented Mar 19, 2019

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.

@gabrielschulhof gabrielschulhof added macos Issues and PRs related to the macOS platform / OSX. addons Issues and PRs related to native addons. gyp Issues and PRs related to the GYP tool and .gyp build files labels Mar 19, 2019
gabrielschulhof pushed a commit to gabrielschulhof/node-gyp that referenced this issue Mar 19, 2019
On OSX symbols are exported by default, and they overlap if two
different copies of the same symbol appear in a process. This change
ensures that, on OSX, symbols are hidden by default.

Re: nodejs/node-addon-api#456
Fixes: nodejs/node#26765
gabrielschulhof pushed a commit to gabrielschulhof/node-gyp that referenced this issue Jun 4, 2019
On OSX symbols are exported by default, and they overlap if two
different copies of the same symbol appear in a process. This change
ensures that, on OSX, symbols are hidden by default.

Re: nodejs/node-addon-api#456
Fixes: nodejs/node#26765
rvagg pushed a commit to nodejs/node-gyp that referenced this issue Jun 20, 2019
On OSX symbols are exported by default, and they overlap if two
different copies of the same symbol appear in a process. This change
ensures that, on OSX, symbols are hidden by default.

Re: nodejs/node-addon-api#456
Fixes: nodejs/node#26765
PR-URL: #1689
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Refael Ackermann <refack@gmail.com>
rvagg pushed a commit to nodejs/node-gyp that referenced this issue Jun 21, 2019
Use `Nan::Set()` and `Nan::GetFunction()` instead of their V8
equivalents to avoid OSX test failures with Node.js v12.x.

Thanks @rvagg!

Re: nodejs/node-addon-api#456
Fixes: nodejs/node#26765
PR-URL: #1689
Reviewed-By: Rod Vagg <rod@vagg.org>
rvagg pushed a commit to nodejs/node-gyp that referenced this issue Jun 21, 2019
On OSX symbols are exported by default, and they overlap if two
different copies of the same symbol appear in a process. This change
ensures that, on OSX, symbols are hidden by default.

Re: nodejs/node-addon-api#456
Fixes: nodejs/node#26765
PR-URL: #1689
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Refael Ackermann <refack@gmail.com>
rvagg pushed a commit to nodejs/node-gyp that referenced this issue Jun 21, 2019
Use `Nan::Set()` and `Nan::GetFunction()` instead of their V8
equivalents to avoid OSX test failures with Node.js v12.x.

Thanks @rvagg!

Re: nodejs/node-addon-api#456
Fixes: nodejs/node#26765
PR-URL: #1689
Reviewed-By: Rod Vagg <rod@vagg.org>
rvagg pushed a commit to nodejs/node-gyp that referenced this issue Sep 26, 2019
On OSX symbols are exported by default, and they overlap if two
different copies of the same symbol appear in a process. This change
ensures that, on OSX, symbols are hidden by default.

Re: nodejs/node-addon-api#456
Fixes: nodejs/node#26765
PR-URL: #1689
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Refael Ackermann <refack@gmail.com>
rvagg pushed a commit to nodejs/node-gyp that referenced this issue Sep 26, 2019
Use `Nan::Set()` and `Nan::GetFunction()` instead of their V8
equivalents to avoid OSX test failures with Node.js v12.x.

Thanks @rvagg!

Re: nodejs/node-addon-api#456
Fixes: nodejs/node#26765
PR-URL: #1689
Reviewed-By: Rod Vagg <rod@vagg.org>
rvagg pushed a commit to nodejs/node-gyp that referenced this issue Oct 3, 2019
On OSX symbols are exported by default, and they overlap if two
different copies of the same symbol appear in a process. This change
ensures that, on OSX, symbols are hidden by default.

Re: nodejs/node-addon-api#456
Fixes: nodejs/node#26765
PR-URL: #1689
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Refael Ackermann <refack@gmail.com>
rvagg pushed a commit to nodejs/node-gyp that referenced this issue Oct 3, 2019
Use `Nan::Set()` and `Nan::GetFunction()` instead of their V8
equivalents to avoid OSX test failures with Node.js v12.x.

Thanks @rvagg!

Re: nodejs/node-addon-api#456
Fixes: nodejs/node#26765
PR-URL: #1689
Reviewed-By: Rod Vagg <rod@vagg.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addons Issues and PRs related to native addons. gyp Issues and PRs related to the GYP tool and .gyp build files macos Issues and PRs related to the macOS platform / OSX.
Projects
None yet
Development

No branches or pull requests

1 participant