-
Notifications
You must be signed in to change notification settings - Fork 924
Description
Hey so I was testing the latest wasmer code on Rust 1.91.1 in RISC-V 64 bit architecture. And I noticed that wasmer would throw HeapAccessOutOfBounds error randomly. Upon further investigation, I noticed that the checked_add in wasmer_vm::vmcontext::memory_copy would overflow, but the passed values are small and should not really overflow.
Unfortunately my code is deeply coupled in a complex project so I don't have a reproducible test case, but I did managed to dump some logs with notes for you to check out: https://gist.github.com/wakabat/372009f1adf5f16eb5e121013016e485 And I'm happy to provide more information if needed.
I have to mention that I don't really have a need for Rust 1.91.1, it just happened that we have Rust 1.91.1 handy for our architecture when this quest started. I tested a series of Rust compilers, Rust 1.89.0 and Rust 1.90.0 are fine, but Rust 1.91.1 would trigger the bug. And as the note hints, I think this problem has existed in wasmer for some time, it's just Rust 1.91.1 finally exposes the issue to us.
I have to say that I'm not 100% sure that this is an issue with wasmer, it could be that I'm missing something in our code. Either case, we could use a little help here. Let us know what you think, many thanks!
FYI: I actually tried modifying code here, adding LLVM code pieces to truncate / mask len to a 32-bit value, but this does not really work. Apart from handling Operator::MemoryCopy, is there other part of the code that would invoke wasmer_vm_memory32_copy?