-
Notifications
You must be signed in to change notification settings - Fork 733
Merge main into dev/refactor_llvm_jit #1549
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Implement wasi_addr_resolve function.
Also slightly modify the interface to make it more accessible for the end user:
- replace port argument with the service - so the user can actually get the port for a given service if unknown
- introduce __wasi_addr_info_t and use it as a buffer for addresses, instead of generic buffer
- introduce __wasi_addr_info_hints_t so user can enable filtering on the syscall level (and therefore use smaller buffers for addresses)
- add max_size parameter for the API as an output - in case the number of addresses is bigger than the buffer size, user can repeat the call with bigger buffer
This change is very minimalistic, and it doesn't include the followings:
1. implementation of getaddrinfo in the lib-socket
2. sample application
Which are to be added in the following change #1336
…1327) Fix socket-api byte order issue for systems where host byte order and network byte order are the same: - Document data structures used for storing IP addresses - Fix bug in bind and connect methods by updating code in wasi_socket_ext
Slightly change the __wasi_sock_addr_local interface - since we already have a `__wasi_addr_t` structure which is an union, there's no need for passing the length around - the address buffer will always have the right length (i.e. max of all address families).
Slightly changed the interface sock_addr_remote - since we already have a `__wasi_addr_t` structure which is an union, there's no need for passing length around - the address buffer will always have the right length (i.e. max of all address families).
Merge main into dev/socket
For now this implementation only covers posix platforms, as defined in MVP #1336
The ns-lookup accepts domain names as well as suffixes, e.g.: ``` --allow-resolve=* # allow all domain names --allow-resolve=example.com # only allow example.com name resolution --allow-resolve=example.com --allow-resolve=*.example.com # allow example.com and its subdomains' name resolution ```
So getaddrinfo() can be used when compiling wasm app of C programs.
Added socket send and recv timeout options with implementation for posix platform. This is part of a extending support for sockets in WASI. #1336. Also add sample that sets and reads back the send and receive timeouts using the native function binding.
And enable classic interpreter instead fast interpreter when llvm jit is enabled, so as to fix the issue that llvm jit cannot handle opcode drop_64/select_64.
Add macros to control whether to use the libc-builtin buffered printf and the buffer size.
Add a group of socket options used by cURL and rust stdlib, as well as some UDP multicast options.
…ain (#1487) If WASM app has called pthread_detach() to detach a thread, it will be detached again when thread exits. Attempting to detach an already detached thread may result in crash in musl-libc. This patch fixes it.
#1490) For some implementations (e.g. Mac OS) `bind()` requires the length to be exactly equal to either `sockaddr_in` or `sockaddr_in6` structure. Because we always used `sizeof(struct sockaddr_storage)`, `bind()` was returning errors. In this change we fix the behavior. See StackOverflow [1] for details. [1] https://stackoverflow.com/questions/73707162/socket-bind-failed-with-invalid-argument-error-for-program-running-on-macos
note: macOS doesn't have elf.h
Fix two issues of building WAMR on Windows: - The build_llvm.py script calls itself, spawning instances faster than they expire, which makes Python3 eat up the entire RAM in a pretty short time. - The MSVC compiler doesn't support preprocessor statements inside macro expressions. Two places inside bh_assert() were found.
This also fixes debug build
Sub local count is allowed to be 0 in each group of function local types.
…1507) Remove an unused function, dwarf_get_func_info, which is also seemingly incomplete.
To make it simpler to specify `--project`.
…n custom name section (#1508)
…1497) **What** * Updated `copy_buffer_to_iovec_app` so that it copies as much of the buffer into the iovec as specified * Throw invalid value when allocating an iovec of size 0 **Why** * A bug found from TCP client example which allocates 1024 for the iovec size (where the buf size is also 1024) but received bytes is passed in as the `buf_size` argument to `copy_buffer_to_iovec_app`. This would return early after hitting this check `buf + data->buf_len > buf_begin + buf_size`. However, if the amount to copy is less than the iovec size, we should copy that much of the buf size. Eg TCP client sample receives 27(?) bytes at a time, and this copies 27 bytes into the iovec of size 1024 * The TCP client example attempts to recv bytes of size 0, this attempts to wasm malloc size 0, which outputs a warning. We should early return if recv bytes of size 0
Fix the Dockerfile linter errors and most warnings
- Add checks for `pack_argv` - Fix the checks in creating cc entry/exit basic blocks
Implement more socket APIs, refer to #1336 and below PRs: - Implement wasi_addr_resolve function (#1319) - Fix socket-api byte order issue when host/network order are the same (#1327) - Enhance sock_addr_local syscall (#1320) - Implement sock_addr_remote syscall (#1360) - Add support for IPv6 in WAMR (#1411) - Implement ns lookup allowlist (#1420) - Implement sock_send_to and sock_recv_from system calls (#1457) - Added http downloader and multicast socket options (#1467) - Fix `bind()` calls to receive the correct size of `sockaddr` structure (#1490) - Assert on correct parameters (#1505) - Copy only received bytes from socket recv buffer into the app buffer (#1497) Co-authored-by: Marcin Kolny <[email protected]> Co-authored-by: Marcin Kolny <[email protected]> Co-authored-by: Callum Macmillan <[email protected]>
Memory num_bytes_per_page was incorrectly set in memory enlarging for shared memory, we fix it. And don't set memory_data_size again for shared memory.
Related to #1418. Suppress hadolint warnings for pinning version. This is because these warnings are for reproducible builds. But for development and CIs, ordinary case developers have to use the latest packages.
Fix the issue reported by #1484: Platform ESP-IDF broken for WAMR 1.0.0 with ESP-IDF 4.4.2 Let the dummy ftruncate only work with ESP-IDF earlier than 4.4.2
…1489) This PR integrates an Intel SGX feature called Intel Protection File System Library (IPFS) into the runtime to create, operate and delete files inside the enclave, while guaranteeing the confidentiality and integrity of the data persisted. IPFS can be referred to here: https://www.intel.com/content/www/us/en/developer/articles/technical/overview-of-intel-protected-file-system-library-using-software-guard-extensions.html Introduce a cmake variable `WAMR_BUILD_SGX_IPFS`, when enabled, the files interaction API of WASI will leverage IPFS, instead of the regular POSIX OCALLs. The implementation has been written with light changes to sgx platform layer, so all the security aspects WAMR relies on are conserved. In addition to this integration, the following changes have been made: - The CI workflow has been adapted to test the compilation of the runtime and sample with the flag `WAMR_BUILD_SGX_IPFS` set to true - Introduction of a new sample that demonstrates the interaction of the files (called `file`), - Documentation of this new feature
…1531) The function was introduced to WASI about half a year ago after it already existed in WAMR. It caused problems with compiling `wasi_socket_ext.c` with the wasi-sdk that already had this hostcall exported (wasi-sdk >= 15). The approach we take is the following: - we update WASI interface to be compatible with the wasi_snapshot_preview1 - compilation with `wasi_socket_ext.c` supports both wasi_sdk >= 15 and wasi_sdk < 15 (although we intend to drop support for < 15 at one point of time) - we override `accept()` from wasi-libc - we do that because `accept()` in `wasi-libc` doesn't support returning address (as it doesn't have `getpeername()` implemented), so `wasi_socket_ext.c` offers more functionality right now Resolves #1167 and #1528. [1] https://github.com/WebAssembly/WASI/blob/main/phases/snapshot/witx/wasi_snapshot_preview1.witx
Add return value checks Append string terminator
Enable to run WolfSSL into wasm and need some features from C++: https://github.com/JamesMenetrey/wolfssl-examples/tree/wasm/Wasm
…1539) While compiling the file wasi_socket_ext.c with pedantic options (typically `-Wimplicit-int-conversion` and `-Wmissing-prototypes`), some warnings are raised. This PR addresses those warnings by adding missing static statements before functions and explicitly casting a narrowing conversion. And fix the error handling after calling getpeername.
Keep the commits of dev/socket
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.