danleh / wasabi

A dynamic analysis framework for WebAssembly programs.
http://wasabi.software-lab.org
MIT License
366 stars 47 forks source link

Wasm extensions #44

Closed DCH81 closed 4 months ago

DCH81 commented 4 months ago

Error: input file uses Wasm extensions, which are not supported yet by Wasabi

Can you add Wasm extensions support to wasabi ?

danleh commented 4 months ago

I have very limited time at the moment to support Wasabi, so if it's substantial implementation effort the answer is likely no :/ Which extension do you need? (You can inspect the binary file with wasm-objdump or wasm-opcodecnt for exampe.)

See also PR #41 for a fork of Wasabi that does support more extensions.

doehyunbaek commented 4 months ago

Hi. @DCH81, I have a fork that supports upto Wasm 2.0 except SIMD(also I believe it supports some niche proposals like multi-memory), so if your use case doesn't require any further proposals, I think you will be good to go.

If you need SIMD, I'm willing to do the work to support it also, to make my fork support whole Wasm 2.0. So if that's the case, let me know.

DCH81 commented 4 months ago

Hey @danleh @doehyunbaek thank for your fast reply ! I tested the fork and still getting same error. I edited the main.rs where it's checking if there is a not supported extension to that :

  // instrument Wasm and generate JavaScript
    let (mut module, _offsets, _warnings) = Module::from_file(opt.input_file)?;
    let used_extensions = module.metadata.used_extensions().collect::<Vec<_>>();
    if !used_extensions.is_empty() {
        println!("The following Wasm extensions are used and not supported by Wasabi:");
        for extension in used_extensions {
            println!("{:?}", extension); 
        }
        return Err(io_err("input file uses Wasm extensions, which are not supported yet by Wasabi").into());
    }

And im getting that result : The following Wasm extensions are used and not supported by Wasabi: MultiValue

Here is the wasm bytes : code.txt

doehyunbaek commented 4 months ago

Could you try again with the updated fork? The branch with the PR was a little bit outdated.

Fortunately, it seems to work in this case(we support that proposal :p). So I think you're good to go.

If you can't find the fork, please try this branch https://github.com/doehyunbaek/wasabi/tree/candidate

DCH81 commented 4 months ago

Thank, that's working

doehyunbaek commented 4 months ago

And the file is reaallyyy bigg 50mo

The file getting big in itself is not something unexpected, should take a closer look to if there's any problem. It adds a lot of code for the instrumentation.

When im trying to use it : CompileError: WebAssembly.compile(): size 46445522 > maximum function size 7654321

How do you use it? Can you tell me how to reproduce the error?

danleh commented 4 months ago

@DCH81 please spend a little bit of time yourself to diagnose the problem, the explanation for the error you are getting is literally the first Google result if you search for the posted error message. Most Wasm engines/VMs have agreed on certain limits, e.g., maximum module size, maximum function body size, maximum number of locals etc. You are hitting a limit with the instrumented module.

Some ideas for solutions (but whether they are applicable depends on your specific use-case, which is hard to tell with the little detail available):

danleh commented 4 months ago

Thank, that's working

Since the original issue seems to be resolved, I'm closing this.

dropout1337 commented 3 months ago

@DCH81 In the future do try do your own research before opening an issue to leech of other peoples time.