Skip to content

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

Description

@alexcrichton

This program:

      (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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    wasm-proposal:threadsIssues related to the WebAssembly threads proposal

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions