bytecodealliance / bytecodealliance/wasmtime

Unchecked memory consumption with `memory.atomic.wait{32,64}`

Open
#13,981 0 comments 0 reactions 0 assignees View on GitHub
wasm-proposal:threads
Dominant language
Rust
Stars
18.6k
Forks
1.8k
Avg merge
1d 19h
Merged PRs (30d)
121

Description

This program:

```wasm
(module
(memory (export "mem") 65536 65536 shared)
(func (export "run") (param $end i32)
(local $i i32)
(block $done
(loop $l
(br_if $done (i32.ge_u (local.get $i) (local.get $end)))
(drop (memory.atomic.wait32 (local.get $i) (i32.const 0) (i64.const 0)))
(local.set $i (i32.add (local.get $i) (i32.const 4)))
(br $l)
)
)
)
)
```

when invoked as:

```
$ wasmtime -Wshared-memory --invoke run foo.wat 1000000000
```

will consume an unbounded amount of memory allocating wait queues on addresses which are never cleaned up (within Wasmtime's `ParkingSpot` implementation)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.