shared memory: make it available in no-std

オープン
#15,488 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
rust
領域
backend

調査の方向性

Start with the threads feature gating and crates/wasmtime/src/runtime/vm/memory/shared_memory.rs, then review the referenced PR 15312 and the serialization test in crates/wasmtime/src/engine/serialization.rs. The work is to make SharedMemory available in no-std environments while handling the runtime constraints described in the issue. Done means a no-std runtime can use shared memory without relying on the listed std facilities or Linux syscalls.

索引モデルが issue の本文から書いたものです。

説明

enhancement wasm-proposal:threads wasmtime:platform-support
Feature

SharedMemory is currently gated by "threads" cargo feature in wasmtime,
which depends on std. It would be nice to make it available in no-std environments.

Benefit

More context is available in the comments in PR 15312, but, briefly, we are exploring loading WASM modules (pre-compiled) inside Linux kernel because WASM is vastly more ergonomic to work with compared to eBPF; and we need these modules to use shared memory because the "wasm host" (= Linux kernel) may call into "wasm guest" from multiple threads.

Implementation

A first attempt was done in PR 15312, which was not properly thought-out. I'm willing to take another stub at this if the feature is deemed useful.

Alternatives explored:

Alternative A: compile wasmtime runtime with no-std, but load module which is std+threads

This does not work:

Module was compiled with support for WebAssembly feature 'threads' but it is not enabled for the host

there is even an explicit test for this

Alternative B: compile wasmtime runtime for Linux with std

This won't work either, as wasmtime will use std::sync::Mutex, thread_local!, try to call Linux syscalls, etc. This will break inside the kernel in many ways. Even SharedMemory::new() itself will call mmap directly

主要言語
Rust
スター
18.9k
フォーク
2k
平均マージ
1日 6時間
マージ済み PR(30日)
238

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

bytecodealliance/wasmtime のほかの issue

bytecodealliance/wasmtime の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。