Greensue opened issue #7762:
Hi, I have met a "Access denied " error, when run wasi-socket tests using wasm cmd. please help me to check what it's the reason.
Really appreciate it.After build the artifacts under the test-programs,I got the .wasm file of the bin files under the test-programs(the .wasm file in my host under the dir /Wasmtime/target/debug/build/test-programs-artifacts-10901ff28f726621/out/wasm32-wasi/debug ). And then I execute the command:
~/work/Git/Wasmtime/target/debug/wasmtime run --wasm component-model preview2_udp_connect.component.wasm
And then, error happends:
thread 'main' panicked at crates/test-programs/src/bin/preview2_udp_connect.rs:14:50: called
Result::unwrap()on an
Errvalue: ErrorCode { code: 1, name: "access-denied", message: "Access denied.\n \n POSIX equivalent: EACCES, EPERM" } note: run with
RUST_BACKTRACE=1environment variable to display a backtrace Error: failed to run main module
preview2_udp_connect.component.wasm`Caused by:
0: failed to invokerun
function
1: error while executing at wasm backtrace:
0: 0x10a67 - <unknown>!__rust_start_panic
1: 0x108e3 - <unknown>!rust_panic
2: 0x10816 - <unknown>!std::panicking::rust_panic_with_hook::h9c783872fdb901cc
3: 0xfc4e - <unknown>!std::panicking::begin_panic_handler::{{closure}}::h6f255f7e971e1b6b
4: 0xfb7d - <unknown>!std::sys_common::backtrace::__rust_end_short_backtrace::h1f5fd5151e12b76f
5: 0x101f8 - <unknown>!rust_begin_unwind
6: 0x14fd3 - <unknown>!core::panicking::panic_fmt::h4ed481ff677a9793
7: 0x166f8 - <unknown>!core::result::unwrap_failed::h2af8885cc6bf29d0
8: 0x1bae - <unknown>!core::result::Result<T,E>::unwrap::h5a6e23b18a4964d8
9: 0x25b2 - <unknown>!preview2_udp_connect::test_udp_connect_disconnect_reconnect::h145f524d4d36d695
10: 0x4ee6 - <unknown>!preview2_udp_connect::main::h97037918226e3811
11: 0x21a6 - <unknown>!core::ops::function::FnOnce::call_once::hf213c3f9fe036fc6
12: 0x51e2 - <unknown>!std::sys_common::backtrace::__rust_begin_short_backtrace::hade486873dc3ce94
13: 0x209f - <unknown>!std::rt::lang_start::{{closure}}::hc2f7acdd2103b085
14: 0xe5d6 - <unknown>!std::rt::lang_start_internal::hd6912adb8d399251
15: 0x204a - <unknown>!std::rt::lang_start::h3e409c9ea6a77da0
16: 0x50c5 - <unknown>!__main_void
17: 0x1960 - <unknown>!_start
18: 0x2cd9e4 - wit-component:adapter:wasi_snapshot_preview1!wasi:cli/run@0.2.0-rc-2023-12-05#run
note: using theWASMTIME_BACKTRACE_DETAILS=1
environment variable may show more debugging information
2: wasm trap: wasmunreachable
instruction executed
the content of preview2_udp_connect.rs:14:50 is :
13 let client = UdpSocket::new(family).unwrap();
14 client.blocking_bind(&net, unspecified_addr).unwrap();
15
16 _ = client.stream(None).unwrap();`And I found many files if it executing the blocking_bind() func, it would triggle this Error Code.
And I found it both in linux and macos.
alexcrichton edited issue #7762:
Hi, I have met a "Access denied " error, when run wasi-socket tests using wasm cmd. please help me to check what it's the reason.
Really appreciate it.After build the artifacts under the test-programs,I got the .wasm file of the bin files under the test-programs(the .wasm file in my host under the dir /Wasmtime/target/debug/build/test-programs-artifacts-10901ff28f726621/out/wasm32-wasi/debug ). And then I execute the command:
~/work/Git/Wasmtime/target/debug/wasmtime run --wasm component-model preview2_udp_connect.component.wasm
And then, error happends:
thread 'main' panicked at crates/test-programs/src/bin/preview2_udp_connect.rs:14:50: called `Result::unwrap()` on an `Err` value: ErrorCode { code: 1, name: "access-denied", message: "Access denied.\n \n POSIX equivalent: EACCES, EPERM" } note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace Error: failed to run main module `preview2_udp_connect.component.wasm` Caused by: 0: failed to invoke `run` function 1: error while executing at wasm backtrace: 0: 0x10a67 - <unknown>!__rust_start_panic 1: 0x108e3 - <unknown>!rust_panic 2: 0x10816 - <unknown>!std::panicking::rust_panic_with_hook::h9c783872fdb901cc 3: 0xfc4e - <unknown>!std::panicking::begin_panic_handler::{{closure}}::h6f255f7e971e1b6b 4: 0xfb7d - <unknown>!std::sys_common::backtrace::__rust_end_short_backtrace::h1f5fd5151e12b76f 5: 0x101f8 - <unknown>!rust_begin_unwind 6: 0x14fd3 - <unknown>!core::panicking::panic_fmt::h4ed481ff677a9793 7: 0x166f8 - <unknown>!core::result::unwrap_failed::h2af8885cc6bf29d0 8: 0x1bae - <unknown>!core::result::Result<T,E>::unwrap::h5a6e23b18a4964d8 9: 0x25b2 - <unknown>!preview2_udp_connect::test_udp_connect_disconnect_reconnect::h145f524d4d36d695 10: 0x4ee6 - <unknown>!preview2_udp_connect::main::h97037918226e3811 11: 0x21a6 - <unknown>!core::ops::function::FnOnce::call_once::hf213c3f9fe036fc6 12: 0x51e2 - <unknown>!std::sys_common::backtrace::__rust_begin_short_backtrace::hade486873dc3ce94 13: 0x209f - <unknown>!std::rt::lang_start::{{closure}}::hc2f7acdd2103b085 14: 0xe5d6 - <unknown>!std::rt::lang_start_internal::hd6912adb8d399251 15: 0x204a - <unknown>!std::rt::lang_start::h3e409c9ea6a77da0 16: 0x50c5 - <unknown>!__main_void 17: 0x1960 - <unknown>!_start 18: 0x2cd9e4 - wit-component:adapter:wasi_snapshot_preview1!wasi:cli/run@0.2.0-rc-2023-12-05#run note: using the `WASMTIME_BACKTRACE_DETAILS=1` environment variable may show more debugging information 2: wasm trap: wasm `unreachable` instruction executed
the content of preview2_udp_connect.rs:14:50 is :
13 let client = UdpSocket::new(family).unwrap(); 14 client.blocking_bind(&net, unspecified_addr).unwrap(); 15 16 _ = client.stream(None).unwrap();
And I found many files if it executing the blocking_bind() func, it would triggle this Error Code.
And I found it both in linux and macos.
alexcrichton commented on issue #7762:
Would you perhaps have ipv6 disabled on your machine? If that's not the case this'll probably need some more debugging prints added to the tests to understand why this is failing.
cc @badeend as well as you might have an idea too
badeend commented on issue #7762:
Nothing spings to mind. Like Alex said, it would be good to know whether this happens on a specific IP version or not. At the bottom of the test file you can comment out all Ipv6 invocations and see whether that changes anything, if not; maybe check with the Ipv4 tests commented out instead.
Greensue commented on issue #7762:
I've tried removing the ipv6 related test functions, but it comes out the same error
Greensue commented on issue #7762:
I fond the SocketAddrCheck func are false as default, and I change that to True , then the test passed. @badeend
impl Default for SocketAddrCheck { fn default() -> Self { Self(Arc::new(|_, _| false)) } }
![image](https://github.com/bytecodealliance/wasmtime/assets/23025897/4ced9b1b-51db-4224-9be4-476d3e6bc0c4)
Greensue commented on issue #7762:
another way to avoid access denied error:
![image](https://github.com/bytecodealliance/wasmtime/assets/23025897/f3cb68cc-0f53-411f-a400-beb551b55755)
alexcrichton closed issue #7762:
Hi, I have met a "Access denied " error, when run wasi-socket tests using wasm cmd. please help me to check what it's the reason.
Really appreciate it.After build the artifacts under the test-programs,I got the .wasm file of the bin files under the test-programs(the .wasm file in my host under the dir /Wasmtime/target/debug/build/test-programs-artifacts-10901ff28f726621/out/wasm32-wasi/debug ). And then I execute the command:
~/work/Git/Wasmtime/target/debug/wasmtime run --wasm component-model preview2_udp_connect.component.wasm
And then, error happends:
thread 'main' panicked at crates/test-programs/src/bin/preview2_udp_connect.rs:14:50: called `Result::unwrap()` on an `Err` value: ErrorCode { code: 1, name: "access-denied", message: "Access denied.\n \n POSIX equivalent: EACCES, EPERM" } note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace Error: failed to run main module `preview2_udp_connect.component.wasm` Caused by: 0: failed to invoke `run` function 1: error while executing at wasm backtrace: 0: 0x10a67 - <unknown>!__rust_start_panic 1: 0x108e3 - <unknown>!rust_panic 2: 0x10816 - <unknown>!std::panicking::rust_panic_with_hook::h9c783872fdb901cc 3: 0xfc4e - <unknown>!std::panicking::begin_panic_handler::{{closure}}::h6f255f7e971e1b6b 4: 0xfb7d - <unknown>!std::sys_common::backtrace::__rust_end_short_backtrace::h1f5fd5151e12b76f 5: 0x101f8 - <unknown>!rust_begin_unwind 6: 0x14fd3 - <unknown>!core::panicking::panic_fmt::h4ed481ff677a9793 7: 0x166f8 - <unknown>!core::result::unwrap_failed::h2af8885cc6bf29d0 8: 0x1bae - <unknown>!core::result::Result<T,E>::unwrap::h5a6e23b18a4964d8 9: 0x25b2 - <unknown>!preview2_udp_connect::test_udp_connect_disconnect_reconnect::h145f524d4d36d695 10: 0x4ee6 - <unknown>!preview2_udp_connect::main::h97037918226e3811 11: 0x21a6 - <unknown>!core::ops::function::FnOnce::call_once::hf213c3f9fe036fc6 12: 0x51e2 - <unknown>!std::sys_common::backtrace::__rust_begin_short_backtrace::hade486873dc3ce94 13: 0x209f - <unknown>!std::rt::lang_start::{{closure}}::hc2f7acdd2103b085 14: 0xe5d6 - <unknown>!std::rt::lang_start_internal::hd6912adb8d399251 15: 0x204a - <unknown>!std::rt::lang_start::h3e409c9ea6a77da0 16: 0x50c5 - <unknown>!__main_void 17: 0x1960 - <unknown>!_start 18: 0x2cd9e4 - wit-component:adapter:wasi_snapshot_preview1!wasi:cli/run@0.2.0-rc-2023-12-05#run note: using the `WASMTIME_BACKTRACE_DETAILS=1` environment variable may show more debugging information 2: wasm trap: wasm `unreachable` instruction executed
the content of preview2_udp_connect.rs:14:50 is :
13 let client = UdpSocket::new(family).unwrap(); 14 client.blocking_bind(&net, unspecified_addr).unwrap(); 15 16 _ = client.stream(None).unwrap();
And I found many files if it executing the blocking_bind() func, it would triggle this Error Code.
And I found it both in linux and macos.
alexcrichton commented on issue #7762:
Aha I see what's going on here, I missed this earlier. Yes running the binaries from the CLI by default will require the
-Sinherit-network
option to be specified. The CLI disables network access by default, and the tests assume network access. This is configured as part of the test runner by when running outside of the runner you'll need to configure network access to be available.
Last updated: Nov 22 2024 at 16:03 UTC