Open Xe opened 6 years ago
Great idea ! Was wondering about how to solve that corner case too
On Fri, 22 Jun 2018, 02:45 Christine Dodrill, notifications@github.com wrote:
It would be interesting to provide context https://godoc.org/context-awareness to the exec.VM type. This would check the context Done every so often during execution, and if it is done then a new "took too long" error would be returned to the callee. This would make it possible for users to submit arbitrary untrusted webassembly code for a backend server to run and return the results without as much fear of users submitting code that blocks infinitely.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/go-interpreter/wagon/issues/62, or mute the thread https://github.com/notifications/unsubscribe-auth/ATuCwqZsL6YWjlbZHjV5Q8M24PGZkSKxks5t_D4OgaJpZM4Uy-j9 .
apologies for the belated answer.
yes, having a context
aware exec.VM
type would definitely be interesting.
now, the also interesting thing would be to decide until what "depth" we want to weave it through:
pushInt64
, i32Load8s
, ...)VM.ExecCode
?
- down to each VM operation? (e.g. pushInt64, i32Load8s, ...)
This would be beyond overkill and would be super performance impactful.
- only at VM.ExecCode ?
Probably check here too.
- somewhere in the middle?
I was thinking every n
operations or on function/loop/block barriers.
down to each VM operation? (e.g. pushInt64, i32Load8s, ...)
This would be beyond overkill and would be super performance impactful.
I agree, I was just being facetious :)
I was thinking every
n
operations or on function/loop/block barriers.
every n
operation is probably simplest to explain and implement, while not being too intrusive.
How about every 65536 instructions? That constant is already used as the size of a memory page and it's a very nice, even number.
SGTM
It would be interesting to provide context-awareness to the
exec.VM
type. This would check the context Done every so often during execution, and if it is done then a new "took too long" error would be returned to the callee. This would make it possible for users to submit arbitrary untrusted webassembly code for a backend server to run and return the results without as much fear of users submitting code that blocks infinitely.