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

Coredumps: how to represent process/posix-y info like executable name, arguments, and environment #209

Open
fitzgen opened this issue May 9, 2023 · 4 comments

Comments

@fitzgen
Copy link
Contributor

fitzgen commented May 9, 2023

Wasm itself doesn't have these concepts. The closest thing it has to a process is the store.

This impedance mismatch is visible when looking at a collection of Wasm instances running in a Web browser:

  • Which instance is "the" executable and therefore its module name should be used as the executable name?
  • What are the process arguments? This concept doesn't exist except in tools that layer a posix-y facade on top of the Web, like (IIUC) Emscripten can.
  • Ditto for environment variables.

WASI, however, does have these concepts, so it makes sense that a WASI-specific coredump section (or sections) add this information. But I don't think it makes sense to put this info in the fully-general, core-Wasm part of the coredump spec.

@xtuc, what do you think of splitting this info out to an optional WASI-specific coredump section(s)?

@sbc100
Copy link
Member

sbc100 commented May 9, 2023

I believe the name section allows the name of the module to be specified so that might make sense for the executable name, when it is present.

@fitzgen
Copy link
Contributor Author

fitzgen commented May 9, 2023

the name of the module

The catch is that there are potentially N instances of M modules in the store when we captured the coredump (see #207) and the name section only talks about the current Wasm module (which is the coredump file itself).

We could rely on each referenced module's name section for each module's name (although this requires access to those modules, which isn't guaranteed, and creates a chicken-and-egg problem unless we copy each module inline into the coredump file itself).

And because we can have multiple instances and modules, it isn't clear which one is "the" executable.

@sbc100
Copy link
Member

sbc100 commented May 9, 2023

That sounds roughly analogous to the ELF world where a given process will have any number of ELF files mapped into address space, perhaps? One can even imagine the same ELF mapped more then once in different places.

@fitzgen
Copy link
Contributor Author

fitzgen commented May 9, 2023

Yep, totally.

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