Giter Club home page Giter Club logo

Comments (12)

bjfish avatar bjfish commented on May 16, 2024 7

@alexeyPetrushin It’s on our roadmap to provide metering of memory/cpu instructions and preemption based on those values and possibly timeouts.

from wasmer.

lachlansneff avatar lachlansneff commented on May 16, 2024 2

Thanks for asking!

By design, webassembly is sandboxed by default. Aside from that, any sandboxing is really on the interface that's imported into your webassembly modules.

Our current emscripten implementation is not sandboxed whatsoever, but a strict security model is on our roadmap for future wasm abi implementations.

from wasmer.

Hywan avatar Hywan commented on May 16, 2024 1

It is possible to limit the memory size, yes. But it's not possible to limit the CPU frequency. I think it falls to the OS to slow down the Wasmer runtime process. I don't know yet how to do that though.

from wasmer.

al6x avatar al6x commented on May 16, 2024 1

Thank you! Is it possible to limit the execution time (roughly, with precision like +-100milliseconds for example)?

As for the memory limit - can you please point me to docs or info how to specify it?

from wasmer.

jcaesar avatar jcaesar commented on May 16, 2024 1
  • Instead of limiting execution time, wasmer can limit the number of instructions executed: metering.rs.
  • 2Γ—2GB is probably simply the limit addressable in 32 bit wasm? A lower limit can be set through tunables.

from wasmer.

tjpalmer avatar tjpalmer commented on May 16, 2024

Sounds good. Since your home page shows starting a web server, I presumed that meant you had built in certain capabilities already. So I figured it was worth asking. Glad to hear it's in the plans. Maybe this or else more precise issues are worth keeping open until you have plans implemented and/or documented.

from wasmer.

al6x avatar al6x commented on May 16, 2024

By design, webassembly is sandboxed by default

Is it possible to set CPU cycle limit and Memory limit?

from wasmer.

webmaster128 avatar webmaster128 commented on May 16, 2024

It is possible to limit the memory size, yes.

How would you do that? I don't see and interface for that in wasmer_runtime::Module::instantiate.

In my tests, some Wasm was able to allocate 2x2 GB before hitting some kind of default limit.

from wasmer.

coolreader18 avatar coolreader18 commented on May 16, 2024

I'm looking into adding an execution timeout middleware, what do you think the best way to go about it would be? My current plan would be to just implicitly depend on a wasi clock_time_get import and compare that value with some preset one, but are there any other ways to monitor time in wasm/wasmer without depending on imports?

from wasmer.

Hywan avatar Hywan commented on May 16, 2024

@al6x, @webmaster128:

As for the memory limit - can you please point me to docs or info how to specify it?

https://github.com/wasmerio/wasmer/blob/ec36089cbf4a65b768501ba38f3d63baad6badf3/examples/tunables_limit_memory.rs

from wasmer.

Hywan avatar Hywan commented on May 16, 2024

@coolreader18 I think it's a good idea to start with something simple, even based on the host clock. I'll let you open an issue or a PR to track your progression and the discussion :-).

from wasmer.

syrusakbary avatar syrusakbary commented on May 16, 2024

Quick clarification: Wasmer VM is fully sandboxed by default. Wasmer is also fully sandboxed when used with WASI

from wasmer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.