Comments (13)
@Robbepop Thanks for the quick turnaround! 0.32.2 looks good so far.
from wasmi.
@kaiavintr Thank you for the confirmation that v0.32.2 is fine. :) And thank you again for reporting these bugs!
from wasmi.
@Robbepop I found a slightly more complicated case. Returns 2, should return 1:
(module
(type (;0;) (func (result i32)))
(func (;0;) (type 0) (result i32)
(local i32 i32)
i32.const 0
local.set 0
i32.const 1
local.set 1
local.get 1
local.get 0
i32.const 0
local.set 0
local.tee 1
i32.add
)
(export "main_function" (func 0)))
from wasmi.
@kaiavintr Thanks again for the reported issue.
I have created #1057 to fix this.
The issue this time was because of re-use of local preservation slots. The issue was fixed by more explicitly separate out GC of preservation slots marked for removal and re-use of preservation slots.
from wasmi.
No, sorry, I don't have the code in a public repository yet. It might be a while.
By the way, I did some experiments today testing Wasmi more directly, by searching a space of instruction sequences that includes the latter two cases above. I haven't found any issues with the fixed code. I think I have exhaustively tested all valid sequences up to length 9, with
i32.const
,i32.add
,local.get
,local.set
,local.tee
, and three local variables, and all length 10 sequences with the constraint that variables are explicitly initialized.
@kaiavintr Thanks a lot for the info, it is relieving to know that Wasmi translation seems to be somewhat stable now. I will make another release including the last fix soon. Thank you for your work that also led to a better Wasmi for everyone! :)
from wasmi.
@kaiavintr Thanks a lot for the bug report!
I have fixed this in #1052.
I wonder why our fuzzing infrastructure did not find this bug. Time for investigation!
from wasmi.
@kaiavintr I just released Wasmi v0.32.1 which includes the fix.
from wasmi.
With the fix, it still happens if the local.get is from a different variable. The following code returns 0, should return 2:
(module
(type (;0;) (func (result i32)))
(func (;0;) (type 0) (result i32)
(local i32 i32 i32)
i32.const 0
local.set 0
i32.const 1
local.set 1
i32.const 2
local.set 2
local.get 2
local.tee 0
local.tee 1
)
(export "main_function" (func 0)))
from wasmi.
@Robbepop sorry, I forgot to mention you in the above comment, and I don't know if you get notifications for comments on closed issues. Also, sorry to do this to you on a Monday :)
from wasmi.
@kaiavintr Thank you for re-opening, I clearly oversaw some more general solution to the problem last time.
This PR fixes all the cases: #1054
from wasmi.
@Robbepop The fix looks good so far. I'm using wasmi for randomized testing of a code generator, and perhaps it is seeing some types of instruction sequences that LLVM and Binaryen would never output.
from wasmi.
@Robbepop The fix looks good so far. I'm using wasmi for randomized testing of a code generator, and perhaps it is seeing some types of instruction sequences that LLVM and Binaryen would never output.
Great work so far from the perspective of Wasmi, thanks a lot for the bug reports! :D
Is there a public repo of your work?
from wasmi.
Great work so far from the perspective of Wasmi, thanks a lot for the bug reports! :D Is there a public repo of your work?
No, sorry, I don't have the code in a public repository yet. It might be a while.
By the way, I did some experiments today testing Wasmi more directly, by searching a space of instruction sequences that includes the latter two cases above. I haven't found any issues with the fixed code. I think I have exhaustively tested all valid sequences up to length 9, with i32.const
, i32.add
, local.get
, local.set
, local.tee
, and three local variables, and all length 10 sequences with the constraint that variables are explicitly initialized.
from wasmi.
Related Issues (20)
- Add customizable `wasmi::Engine` limits
- Reconsider proper fuel charging for lazily compiled functions
- Reduce `wasmi::Engine` memory consumption for storing function artifacts HOT 3
- Try to put the Wasmi engine internals into its own crate
- Wasmi v0.32 stable release preparations
- Wasmi `v0.32.0-beta.13` seems to have broken linking HOT 13
- CLI: cannot find definition for imported function HOT 4
- Performance regression since `v0.32-beta.16` for `debug` builds with profile overwrites HOT 7
- Optimize `Instance` handling in the `CallStack` HOT 1
- Thoughts on js-promise-integration HOT 4
- Add `Store::call_hook` API HOT 4
- Add way to access unknown custom sections in `Module`
- Implement stable fuel metering HOT 6
- Implement support for `wasi-nn` HOT 1
- Failed to install `wasmi_cli`: `raw mutable pointers are not allowed in statics` (Rust 1.77.1) HOT 4
- How does the executor calculate i32 binary opcodes? HOT 2
- Prepare Wasmi bytecode, translator and executor for tail-call based instruction dispatch
- CI: fuzzing CI seems to not cache the corpus
- Make `CodeMap` lock-free
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wasmi.