C API: `wasi_config_inherit_network` does not let a guest use TCP or UDP
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 52/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- rust, wasm
- Lĩnh vực
- backend-api-design, networking
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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).
- Ngôn ngữ chính
- Rust
- Star
- 18.9k
- Fork
- 2k
- Merge trung bình
- 1 ngày 6 giờ
- Pull request đã merge (30 ngày)
- 238
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của bytecodealliance/wasmtime
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
bytecodealliance/wasmtime#15536 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
bytecodealliance/wasmtime#15455 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
wasi-preview1-component-adapter: fd_write does not invalidate cached InputStream, causing stale readsCó thể đã có người làm @dpfens đã nhận 13 ngày trước. Đang mởwasi
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
bytecodealliance/wasmtime#15296 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug wasm-proposal:exceptions wasmtime:debugging
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
bytecodealliance/wasmtime#14102 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
wasm-proposal:gc
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
bytecodealliance/wasmtime#13808 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của bytecodealliance/wasmtime
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
area: plugins bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
clipy-recorder/clipy#1039 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
valkey-io/valkey-glide#7975 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
gofractally/psibase#2379 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Qwen stream parser: a chunk with "error": null is treated as a stream errorCó thể đã có người làm @Beehtrix đã nhận hôm nay. Đang mởarea:models bug good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
brekkylab/ailoy#681 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày