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

Build ID for WASM binaries #10

Open
infogulch opened this issue Nov 2, 2022 · 2 comments
Open

Build ID for WASM binaries #10

infogulch opened this issue Nov 2, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@infogulch
Copy link

infogulch commented Nov 2, 2022

Hi, I noticed that buildid does not currently support getting the build id for wasm objects,

https://github.com/jmesmon/buildid/blob/3a2b95fb3ade0d7231b69622cbafa6df309f7e88/src/lib.rs#L157-L168

There has been some activity this year to support wasm build ids in the WebAssembly/tool-conventions repo that may be useful if you want to add this feature in the future:

WebAssembly/tool-conventions#133

@codyps
Copy link
Owner

codyps commented Dec 10, 2022

Thanks, I appreciate the pointer. I'll keep an eye on that as it moves along.

I think I'll also need to figure out how one would read a wasm section (like the build_id one proposed in the linked ticket) from within the binary itself. The mechanisms used on hosted systems (mac & unix-likes) use functions/symbols provided by the system ld.so (or equivalent) to allow examination of the executable itself in memory.

Do you know if wasm (or perhaps wasi) has similar functions to allow reading from arbitrary sections? Or perhaps some symbols that are resolved automatically to allow a program to read from a section?

@infogulch
Copy link
Author

That's a good question. Now that I'm thinking about it, I wonder what use there would be for the buildid from within the wasm execution environment, given that it cannot access its own code pages or stack traces (as I understand it, happy to be corrected). Contrast this with native binaries where a panic/unwind could be caught and used to introspect the code pages for extra details and e.g. logging or reporting it.

Brainstorming some ideas:

  • You could add buildid to requests and responses to trace which wasm binaries are used in some service path. Then again, the wasm binary could just fake this so it's not very secure; maybe it would be better for the host to handle this responsibility.
  • (that's all I got 😆)

As far as implementation goes, I doubt wasm will ever grow more complete introspection capabilities to directly read arbitrary sections. So maybe the path to getting the buildid from wasm would be by publishing a convention for the embedder to place the buildid function or constant into a particular entry in a table.

@codyps codyps added the enhancement New feature or request label Mar 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants