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

no std mode #217

Open
artit-io opened this issue Feb 26, 2019 · 28 comments
Open

no std mode #217

artit-io opened this issue Feb 26, 2019 · 28 comments
Labels
⚙️ feature request ℹ️ help wanted Extra attention is needed priority-low Low priority issue ❓ question I've a question!

Comments

@artit-io
Copy link

I want to run wasmer on bare metal. Is it on the roadmap?

@lachlansneff
Copy link
Contributor

Hi!

Running wasmer on bare-metal is on the long-term roadmap, but it's not a current priority. The main blockers are that wasmer requires the ability to map memory with various protections and that it needs to be able to hook into os-level signals/exceptions.

I have a special place in my heart for rust running without an operating system, so I'd love to see this happen, however.

If you'd like to work on this feature, we'd be happy to accept any contributions and would provide help and advice! Contact us on the spectrum channel if you'd like to pursue this!

@syrusakbary syrusakbary added ℹ️ help wanted Extra attention is needed ❓ question I've a question! labels Mar 1, 2019
@artit-io
Copy link
Author

artit-io commented Mar 4, 2019

Hi,

I think that's why WebAssembly is sandboxed by default and you can bind your context from outside.

The current (unix) implementation depends on various libc functions that shall be just another optional context to bind. If you want to write a 3D tech demo using typescript for example that is using only a videocore chip and nothing else, you can't use this awesome lib sadly.

@syrusakbary
Copy link
Member

Agreed! We would love to have no-std support, as it will be useful for a lot of different scenarios like the one you commented. Right now we are prioritizing other cases like improving speed of the runtime or help the usage of WebAssembly runtime from other languages.

However, we would love to support you on the no-std quest! Is there anything we can do for helping you to achieve that?

@assafmo
Copy link

assafmo commented Mar 30, 2020

Hi, any progress on no_std? 🙏

@assafmo
Copy link

assafmo commented Mar 30, 2020

We @enigmampc need no_std in order to run WASM inside an SGX enclave.
Currently, our only solution is to use https://github.com/paritytech/wasmi which is slower, has no built-in gas/metering support and has a slightly worse UX IMO.
So no_std would come in handy.

@Hywan
Copy link
Contributor

Hywan commented Apr 2, 2020

What backend would you like to use in no_std mode? It could help us to set priority.

@assafmo
Copy link

assafmo commented Apr 2, 2020

We are using CosmWasm, and I believe they are using wasmer-singlepass-backend.
But because this doesn't support no_std we are working on replacing wasmer with wasmi inside of CosmWasm.
If wasmer would support no_std we'd use it as it'll save us a lot of work.

@syrusakbary
Copy link
Member

@assafmo we would love to support ‘no_std’ in Wasmer.

Right now we are focusing our efforts in making the codebase simpler, but we can guide and help with any contributions.
Would you like to contribute in making Wasmer compatible with ‘no_std’?

@assafmo
Copy link

assafmo commented Apr 2, 2020

Cc @ethanfrey @webmaster128

@syrusakbary We would love to but let me check if we have the capacity right now. 😊

nlewycky pushed a commit that referenced this issue Aug 13, 2020
@stevemk14ebr
Copy link

Any updates? This would be really fantastic for embedded platforms and kernels. Wasmer seems one of the most complete wasm engines.

@Hywan
Copy link
Contributor

Hywan commented Jun 18, 2021

I would say that maybe 50% of our crates can be used in no_std. I don't know how much work would be required to me it up to 100%. Anyone would like to help on that front? I can coordinate the project.

@1c3t3a
Copy link

1c3t3a commented Jul 14, 2021

I would like to help - if I can. I'm currently preparing for my bachelor thesis about virtualization with WASM in the embedded area, where I would kinda depend on a no_std wasmer version.

@syrusakbary
Copy link
Member

Awesome.

I think there was some work done on a PR that you can probably leverage on:
#2168

Feel free to create a side PR with the progress so nostd support can be merged upstream :)

@1c3t3a
Copy link

1c3t3a commented Jul 14, 2021

Great thanks for the quick response! I am going to head over to the PR and have al look!

@ethindp
Copy link

ethindp commented Oct 2, 2021

Any update on this? For mmap/mprotect you could just have a trait for the host to define its own functions for that functionality. Then you wouldn't need to care how the host creates executable pages in memory. Same for signals -- just use a trait for handler functions that either raises the signal or whatever.

What else is blocking this? Other than mmap/mprotect and signals?

@nerdyguy87
Copy link

nerdyguy87 commented Dec 12, 2021

What backend would you like to use in no_std mode? It could help us to set priority.

Hello. For our project we are looking to use Wasmr on bare-metal for aarch64 and RiscV64. We would need to be able to use the cranelift backend in no_std mode. Our team is disheartened that no_std is set as a low priority and have reluctantly been looking into alternatives like wasmi. Could we please request higher priority support with this?

@ethindp
Copy link

ethindp commented Dec 12, 2021

I'm looking to use the cranelift backend as well. Its incredibly disheartening to see that all the actually good Wasm implementations put no_std support as a very low priority feature. Wasmi is the only no_std implementation available, and its fallen extremely far behind and is slow (and I also find the API convoluted). (It doesn't help that my research shows that nobody seems to publicly use it either, which means that, for all intents and purposes, people who use it are left to their own devices.)

@1c3t3a
Copy link

1c3t3a commented Dec 12, 2021

I agree, but to be fair, reaching no_std support is a fairly big step and a lot of work. Also maintaining it can be hard, as every dependency potentially breaks no_std. @nerdyguy87 did you take a look at Wasm-Micro-runtime? It has JiT, AoT and Interpreter support and runs on several systems (Zephyr, vxworks, ESP-IDF, SGX).

Generally I think support for Espressif's Rust standard library implementation is easier to reach, as it mostly requires changes to libc and the memory mapping code. Then it's at least possible to run Wasmer on the Espressif chips.

@stevemk14ebr
Copy link

stevemk14ebr commented Dec 12, 2021

Strong disagree with the espressif idea. General no_std support is much better, in my use case I need no_std to run wasm in the windows kernel. This execution environment perfectly matches the use case of no_std, just need some allocator apis. I do not care about targeting specific chip and that would only solve a tiny sliver of all use cases while still being a maintenance burden

@1c3t3a
Copy link

1c3t3a commented Dec 12, 2021

As far as I can tell the general idea is to compile nearly any rust std dependendant code. That wouldn't introduce a maintenance burden at wasmers.

@stale
Copy link

stale bot commented Dec 13, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the 🏚 stale Inactive issues or PR label Dec 13, 2022
@stevemk14ebr
Copy link

bad bot

@artit-io
Copy link
Author

artit-io commented Dec 22, 2022

Some point next year I will have a few months to look into this properly, but I doubt it can be done as a single PR. I currently use a bare minimal linux to run wasmer and that kind of defeats the point.

@stale stale bot removed the 🏚 stale Inactive issues or PR label Dec 22, 2022
@Lucky4Luuk
Copy link

Any more updates on this? I'd to love to use wasmer in a no_std environment, with alloc support, regardless of the backend. The performance gains over wasmi would be very useful

Copy link

stale bot commented Feb 27, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the 🏚 stale Inactive issues or PR label Feb 27, 2024
@assafmo
Copy link

assafmo commented Feb 27, 2024

Hey guys, any update on this?

@stevemk14ebr
Copy link

stevemk14ebr commented Feb 28, 2024

Disable this bot please. It undermines any will to submit issues if they just get closed without comment

@stale stale bot removed the 🏚 stale Inactive issues or PR label Feb 28, 2024
@stevemk14ebr
Copy link

stevemk14ebr commented Nov 4, 2024

Has the status of this changed at all with the release of 5.0? https://wasmer.io/posts/introducing-wasmer-v5 states:

"Wasmi: one of the most optimal Rust WebAssembly interpreters. Ideal if you want to use Wasm in nostd environments or blockchains with a pure Rust codebase (wasmi feature)"

Wasmi is the runtime I switched to instead of wasmer because it supports no_std completely. Now that wasmer has the wasmi backend, has this issue progressed? I do not yet see a no_std feature flag in the wasmer cargo.toml, is this instead the 'wasmi' feature?

I still face performance issues with wasmi (it's an interpreter) but using wasmer for a nicer interface would still be an improvement. Really hope to see wasmer grow to support this. Wasm is IDEAL for executing untrusted code in embedded environments safely (or just sandboxing in general)!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⚙️ feature request ℹ️ help wanted Extra attention is needed priority-low Low priority issue ❓ question I've a question!
Projects
None yet
Development

No branches or pull requests