SEA building in a Linux arm64 docker container can corrupt the .gnu.hash section of the binary
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- JavaScript
- Estrellas
- 122k
- Forks
- 37.3k
- Merge medio
- 4 d 2 h
- PR fusionados (30 d)
- 283
Descripción
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).
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Reproduce el fallo en el devcontainer de Node.js para arm64 usando node --experimental-sea-config, postject y readelf, y compara la sección .gnu.hash antes y después de incrustar el blob. Rastrea los pasos de preparación de SEA y de postject para identificar por qué la sección se pone a cero únicamente en este entorno. Se considera terminado cuando el binario SEA incrustado conserva la búsqueda de símbolos y puede cargar addons con process.dlopen().
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- docker, javascript, linux
- Área
- build-system, operating-systems
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Activo
- Claridad
- Bastante claro
- Aptitud para principiantes
- 52/100