C API: `wasi_config_inherit_network` does not let a guest use TCP or UDP
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 52/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- rust, wasm
調査の方向性
Start by comparing the C API setup using wasi_config_inherit_network with the command line invocation that succeeds, then trace how wasmtime_component_linker_add_wasip2 applies network permissions. The Rust guest source and reproduction steps provide a way to check the behavior. Done means the C API guest can connect to the local TCP listener, matching the documented permission and command line behavior.
索引モデルが issue の本文から書いたものです。
説明
Test Case
A Rust program built for wasm32-wasip2. I cannot attach the binary here, the source is short:
use std::net::TcpStream;
fn main() {
let addr = std::env::args().nth(1).unwrap();
match TcpStream::connect(&addr) {
Ok(_) => println!("connected"),
Err(e) => {
println!("refused: {e}");
std::process::exit(1);
}
}
}
Steps to Reproduce
- Start a TCP listener on
127.0.0.1, on any port. - With the C API, create a WASI configuration and allow the network:
wasi_config_t *cfg = wasi_config_new();
wasi_config_inherit_network(cfg);
wasi_config_allow_ip_name_lookup(cfg, true);
wasmtime_context_set_wasi(context, cfg);
- Add WASI to a component linker with
wasmtime_component_linker_add_wasip2, instantiate the component, and callwasi:cli/runwith the listener's address as the argument.
Expected Results
The program prints connected. The documentation of wasi_config_inherit_network in wasi.h says that "any address can be bound by the guest or connected to by the guest using any protocol".
The same component prints connected with the command line: wasmtime run -S inherit-network test.wasm 127.0.0.1:PORT.
Actual Results
The program prints refused: Permission denied (os error 2). The listener never receives a connection.
Name lookup works after wasi_config_allow_ip_name_lookup(cfg, true), so the configuration is applied. Only TCP and UDP stay refused.
Versions and Environment
Wasmtime version or commit: 48.0.1 (C API)
Operating system: macOS
Architecture: aarch64
Extra Info
I found this while writing Erlang bindings on top of the C API (https://github.com/benoitc/erlang-wasmtime).
- 主要言語
- Rust
- スター
- 18.9k
- フォーク
- 2k
- 平均マージ
- 1日 6時間
- マージ済み PR(30日)
- 238
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
bytecodealliance/wasmtime のほかの issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
bytecodealliance/wasmtime#15536 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
bytecodealliance/wasmtime#15455 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
wasi-preview1-component-adapter: fd_write does not invalidate cached InputStream, causing stale reads対応中かも @dpfens が 13 日前に担当しました。 オープンwasi
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
bytecodealliance/wasmtime#15296 ·
メンテナーはふだん 1 日以内に返信
-
bug wasm-proposal:exceptions wasmtime:debugging
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
bytecodealliance/wasmtime#14102 ·
メンテナーはふだん 1 日以内に返信
-
wasm-proposal:gc
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
bytecodealliance/wasmtime#13808 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
bytecodealliance/wasmtime の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
area: plugins bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
clipy-recorder/clipy#1039 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
valkey-io/valkey-glide#7975 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
gofractally/psibase#2379 ·
メンテナーはふだん 3 日以内に返信
-
Qwen stream parser: a chunk with "error": null is treated as a stream error対応中かも @Beehtrix が今日担当しました。 オープンarea:models bug good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
brekkylab/ailoy#681 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信