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

single executable applications with warning #83

Closed
waitingsong opened this issue Apr 13, 2023 · 4 comments
Closed

single executable applications with warning #83

waitingsong opened this issue Apr 13, 2023 · 4 comments

Comments

@waitingsong
Copy link

waitingsong commented Apr 13, 2023

CentOS 8

[admin tmp]$ uname -a
Linux git 4.18.0-348.7.1.el8_5.x86_64 #1 SMP Wed Dec 22 13:25:12 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
[admin tmp]$ node -v
v18.16.0
[admins tmp]$ npm -v
9.5.1
[admin tmp]$ node hello.js
Hello, undefined!

[admin tmp]$ node hello.js foo
Hello, foo!

got error:

[admin tmp]$ npx postject hello NODE_JS_CODE hello.js \
>     --sentinel-fuse NODE_JS_FUSE_fce680ab2cc467b6e072b8b5df1996b2

Need to install the following packages:
  postject@1.0.0-alpha.5
Ok to proceed? (y)
Start injection of NODE_JS_CODE in hello...
warning: Can't find string offset for section name '.note.100'
warning: Can't find string offset for section name '.note.100'
warning: Can't find string offset for section name '.note.100'
warning: Can't find string offset for section name '.note.100'
warning: Can't find string offset for section name '.note.100'
warning: Can't find string offset for section name '.note'
warning: Can't find string offset for section name '.note.100'
warning: Can't find string offset for section name '.note.100'
warning: Can't find string offset for section name '.note.100'
@RaisinTen
Copy link
Contributor

Could you run echo $? after running postject to check the exit code of the process?
Also, what happens when you run ./hello foo?

@waitingsong
Copy link
Author

waitingsong commented Apr 13, 2023

echo 'console.log(`Hello, ${process.argv[2]}!`);' > hello.js

cp $(command -v node) hello

npx postject hello NODE_JS_CODE hello.js \
    --sentinel-fuse NODE_JS_FUSE_fce680ab2cc467b6e072b8b5df1996b2

got:

Start injection of NODE_JS_CODE in hello...
warning: Can't find string offset for section name '.note.100'
warning: Can't find string offset for section name '.note.100'
warning: Can't find string offset for section name '.note.100'
warning: Can't find string offset for section name '.note.100'
warning: Can't find string offset for section name '.note.100'
warning: Can't find string offset for section name '.note'
warning: Can't find string offset for section name '.note.100'
warning: Can't find string offset for section name '.note.100'
warning: Can't find string offset for section name '.note.100'
💉 Injection done!

And then:

[admins foo]$ echo $?
0

It seems work:

[admin foo]$ ./hello world
Hello, world!
(node:1468169) ExperimentalWarning: Single executable application is an experimental feature and might change at any time
(Use `hello --trace-warnings ...` to show where the warning was created)

@waitingsong waitingsong changed the title single executable applications not work single executable applications with warning Apr 13, 2023
@RaisinTen
Copy link
Contributor

Okay, so it works! I was curious about the exit code because your original logs didn't contain the 💉 Injection done! part. The other logs are just warnings, so those can be ignored for now.

FWIW, these warnings are coming from the primary dependency, LIEF, from here - https://github.com/lief-project/LIEF/blob/f8f38b60757c0f0401df347de1266c0ecb88055b/src/ELF/Builder.tcc#L667. We intentionally preserved the warnings, so that in case this unexpectedly fails, it would be easier to diagnose what's going on.

@waitingsong
Copy link
Author

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants