SEA building in a Linux arm64 docker container can corrupt the .gnu.hash section of the binary
まだ誰も着手していません。
- 主要言語
- JavaScript
- スター
- 122k
- フォーク
- 37.3k
- 平均マージ
- 4日 2時間
- マージ済み PR(30日)
- 283
説明
Noticed in https://github.com/nodejs/node/pull/59582, I can only reproduce it locally using docker. The Node.js devcontainer image is enough to reproduce this when run on an arm64 host:
docker pull nodejs/devcontainer:nightly
docker run -it nodejs/devcontainer:nightly
In the container:
echo 'console.log("hello")' > hello.js
echo '{"main":"./hello.js", "output":"./sea-prep.blob"}' > sea-config.json
node --experimental-sea-config sea-config.json
cp `which node` ./hello
readelf -x .gnu.hash ./hello | head -n 100 # shows the section filled with the symbol lookup table
npx postject hello NODE_SEA_BLOB sea-prep.blob --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2
readelf -x .gnu.hash ./hello | head -n 100 # shows a bunch of zeros
This does not reproduce on a bare-metal Linux arm64 server, or Linux x64 (bare-metal or in docker), which I think is why in the Node.js pull request it only fails in the GitHub action on Linux arm64.
The result of this is that the produced Node.js SEA cannot load any addons using process.dlopen(), because it cannot look up the napi_* symbols from itself (the same can be said about any other non-napi addons, which rely on the same mechanism to look up symbols from the binary to load the addons).
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
node --experimental-sea-config、postject、readelfを使用してarm64のNode.js devcontainerで失敗を再現し、blobを埋め込む前後で.gnu.hashセクションを比較します。SEAの準備手順とpostjectの手順を追跡し、この環境でのみセクションがゼロ化される理由を特定します。埋め込まれたSEAバイナリがシンボル検索を維持し、process.dlopen()でアドオンを読み込めれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- docker, javascript, linux
- 領域
- build-system, operating-systems
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 活発
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 52/100