-
Notifications
You must be signed in to change notification settings - Fork 30.2k
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
/usr/bin/node: '/usr/bin/node' is not an ELF executable for ARM #27925
Comments
|
No it is definetly the same executable, I double checked that, and it is also not a wrapper. It is the only thing I copied from the build (a 20Mb binary). So I am also pretty sure that the process is cloned by node or one of its libraries. I appended the strace output. In line 192, 216, 228, 238, 247 are calls to clone. In line 334 there is the call Btw. the called script just contains |
I also called |
I think you've stumbled upon a bug in your copy of uclibc or the toolchain you used to cross-compile node. uclibc tries to open the binary as a shared object (legal) but then apparently fails to parse the header. That "not an ELF executable" error message comes from uclibc. Looking at its It also expects
I'll go ahead and close this out because it's clearly not a Node.js bug. readelf(1) might shed some more light. I'd be interested to know what the root cause was when you manage to track it down! |
It is Little Endian (as you can btw tell from the 5th byte). I already assumed that it might not be a NodeJS bug, but thought that node (indirectly) would do the clone and the open, since this does not happen when being called with But I will look further into it, and tell you when I find something. |
First of all you were right about the uclibc part: So as I expected it is a This is the part I looked for all along and hoped for somebody here to know: which part of node is actually doing the dlopen (or probably generating the jitted code which does the dlopen) and also maybe why it does that. Also loading itself as library seems a bit odd to me, while it probably is not wrong to do so. I compared it with node on my Debian PC, which tries to dlopen 'libnode.so' but also fails. |
There are a couple of places where node and its dependencies call: addr = dlsym(RTLD_DEFAULT, "some_libc_function_that_may_be_missing"); I speculate uclibc substitutes RTLD_DEFAULT with a dlopen() call (or uclib's internal equivalent) of the main binary. That gdb points to jitted code probably means that the JS code calls out to the C++ runtime, which calls out to dlsym(). gdb tends to get confused by the non-standard calling convention used by V8's generated code. You may be able to obtain a more legible backtrace when you put a breakpoint on dlsym. |
@bnoordhuis thanks, I looked into this and it seems that openssl is actually doing a dlopen. It seems that it tries to reload itself to:
(as a comment states), which I don't fully understand yet. It uses I am currently investigating the following: Openssl calls their lib loading mechanism FYI: I also assumed you can open a binary as a shared object, however this only is true for special |
Some investigation into that was done in #21845 with an upstream PR to OpenSSL: openssl/openssl#6725 |
@richardlau that indeed seems to be my problem thanks! |
OpenSSL dlloads itself to prevent unloading, in case it might be dynamically loaded. However when linked statically this will lead to dloading the main executable. Fixes: nodejs#27925 Refs: nodejs#21848 (comment)
OpenSSL dlloads itself to prevent unloading, in case it might be dynamically loaded. However when linked statically this will lead to dloading the main executable. Refs: nodejs#21848 (comment) PR-URL: nodejs#28045 Fixes: nodejs#27925 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
OpenSSL dlloads itself to prevent unloading, in case it might be dynamically loaded. However when linked statically this will lead to dloading the main executable. Refs: #21848 (comment) PR-URL: #28045 Fixes: #27925 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
OpenSSL dlloads itself to prevent unloading, in case it might be dynamically loaded. However when linked statically this will lead to dloading the main executable. Refs: nodejs#21848 (comment) Fixes: nodejs#29992 PR-URL: nodejs#28045 Fixes: nodejs#27925 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
OpenSSL dlloads itself to prevent unloading, in case it might be dynamically loaded. However when linked statically this will lead to dloading the main executable. Refs: #21848 (comment) Fixes: #29992 Backport-PR-URL: #30005 PR-URL: #28045 Fixes: #27925 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
I cross compiled NodeJS for ARM Linux, and it seems to work flawlessly. Except it prints the error message
/usr/bin/node: '/usr/bin/node' is not an ELF executable for ARM
. It only prints it when actually executing something, e.g.node --version
works fine, without an error message.I ran
strace node dummy-script.js
and could see that NodeJS does some kind of fork then opens itself (/usr/bin/node) and afterwards is printing the mentioned error, but afterwards it keeps running and seems to work flawlessly. I guess node tries to do some kind of self exec?Any ideas on that? Or maybe a hint where the code with the described behaviour can be found, yet I could not find it myself.
The text was updated successfully, but these errors were encountered: