wasmerio / wasmer

🚀 The leading Wasm Runtime supporting WASIX, WASI and Emscripten
https://wasmer.io
MIT License
18.28k stars 775 forks source link

Still fail to get the file discriptor? #4778

Open Userzxcvbvnm opened 1 month ago

Userzxcvbvnm commented 1 month ago

This is related to https://github.com/wasmerio/wasmer/issues/4753, which may not be resolved.

maminrayej commented 1 month ago

I figured out the difference in our setup. With wasix-libc, the provided test works, but using wasi-libc it does not.

Userzxcvbvnm commented 1 month ago

This may be related to https://github.com/wasmerio/wasmer/issues/4245

Userzxcvbvnm commented 2 weeks ago

We checked different OS permission with different openstyle, and found that wasmer is different from other WASM runtimes, including wasmtime, WAMR and WasmEdge. The behavior of other WASM runtimes is as expected. There are two kinds of bugs in wasmer: (FILENAME->0600 means change the permission of a file to 0600, rw------- DIRNAME->0700 means change the permission of a directory to 0700, rwx------ FILENAME->O_RDONLY means open the file with O_RDONLY DIRNAME->O_RDONLY | O_DIRECTORY means open the directory with O_RDONLY | O_DIRECTORY)

wasmer version 4.3.1

(1)It should have successfully obtained the file descriptor, but it failed.

DIRNAME->0700 DIRNAME->O_RDONLY | O_DIRECTORY

FILENAME->0600 FILENAME->O_WRONLY

FILENAME->0200 FILENAME->O_WRONLY | O_APPEND

FILENAME->0600 FILENAME->O_WRONLY | O_TRUNC | O_CREAT

FILENAME->0600 FILENAME->O_RDWR | O_CREAT

FILENAME->0600 FILENAME->O_RDWR | O_TRUNC | O_CREAT

FILENAME->0600 FILENAME->O_WRONLY | O_CREAT

DIRNAME->0500 DIRNAME->O_RDONLY | O_DIRECTORY

DIRNAME->0600 DIRNAME->O_RDONLY | O_DIRECTORY

FILENAME->0600 FILENAME->O_WRONLY | O_TRUNC

FILENAME->0600 FILENAME->O_RDWR

FILENAME->0200 FILENAME->O_WRONLY

FILENAME->0200 FILENAME->O_WRONLY | O_TRUNC | O_CREAT

FILENAME->0600 FILENAME->O_WRONLY | O_APPEND

DIRNAME->0400 DIRNAME->O_RDONLY | O_DIRECTORY

FILENAME->0600 FILENAME->O_RDWR | O_APPEND

FILENAME->0200 FILENAME->O_WRONLY | O_CREAT

FILENAME->0600 FILENAME->O_RDONLY

FILENAME->0200 FILENAME->O_WRONLY | O_TRUNC

FILENAME->0600 FILENAME->O_RDWR | O_TRUNC

FILENAME->0400 FILENAME->O_RDONLY

(2)It should not have successfully obtained the file descriptor, but it succeeded.

FILENAME->0400 FILENAME->O_RDWR | O_CREAT

FILENAME->0400 FILENAME->O_WRONLY | O_CREAT

FILENAME->0400 FILENAME->O_RDWR | O_TRUNC | O_CREAT

FILENAME->0200 FILENAME->O_RDWR | O_CREAT

FILENAME->0200 FILENAME->O_RDWR | O_TRUNC | O_CREAT

FILENAME->0400 FILENAME->O_WRONLY | O_TRUNC | O_CREAT

wasmer version 4.2.2

(1)It should have successfully obtained the file descriptor, but it failed.

FILENAME->0400 FILENAME->O_RDONLY

(2)It should not have successfully obtained the file descriptor, but it succeeded.

DIRNAME->0100 DIRNAME->O_RDONLY | O_DIRECTORY

DIRNAME->0300 DIRNAME->O_RDONLY | O_DIRECTORY

DIRNAME->0200 DIRNAME->O_RDONLY | O_DIRECTORY