Commit Graph

1157 Commits

Author SHA1 Message Date
liang.he
1ee0d90d81
Add import subtyping validation (#1308)
According to import subtyping validation:
  https://webassembly.github.io/spec/core/valid/types.html#import-subtyping
wasm-c-api needs to check types when linking.
2022-07-20 18:31:19 +08:00
Xu Jun
9d689b3a22
Set noexecstack CXX link flags for wamrc (#1303)
Set noexecstack CXX link flags for wamrc to avoid generating binary
with exec stack.
2022-07-18 18:47:44 +08:00
Wenyong Huang
0ec27af9df
Add API wasm_runtime_set_module_inst (#1286)
Add API wasm_runtime_set_module_inst, per request from #1275
2022-07-14 11:36:11 +08:00
Marcin Kolny
d08e13c5ad
Fix socket api verification of addresses in the address pool (#1270)
The existing validation didn't work as expected; e.g. for address
pool: 8.8.8.8/24 the application had access to the 127.0.0.1 address (which
should not).
2022-07-12 16:21:49 +08:00
Wenyong Huang
177aa4fc79
Fix aot rotl/rotr 0 issue (#1285)
Fix the issue reported in #1282.
When i32/i64 rotate (rotl/rotr) with 0, the LLVM IRs translated are:
left<<0 | left>>64 and left >>0 | left<<64
The value of left >> 64 and left <<64 in LLVM are treated as poison,
which causes invalid result when executing the aot function.

Directly return left when right is 0 to fix the issue.
2022-07-12 13:43:56 +08:00
liang.he
0f6e5a55a4
Fix sub module's aux stack info not synchronized to main module issue (#1279)
Sub module's auxiliary stack boundary and bottom may be different from
main module's counterpart, so when calling sub module, its aux stack info
should be gotten and set to exec_env firstly, or aux stack overflow and out
of bounds memory access exception may be thrown when calling sub
module's function.
Fix the issue reported in PR #1278.
2022-07-11 19:42:29 +08:00
Xu Jun
db210fbc66
Remove unnecessary memset after mmap (#1273)
Remove unnecessary memset after mmap to decrease the number of
page faults, as reported in #1269.
2022-07-07 13:53:50 +08:00
YAMAMOTO Takashi
be8ba9e1fd
wasm_export.h: mention module byte buffer mutability (#1271) 2022-07-07 10:06:31 +08:00
Wenyong Huang
daeb7a4265
Don't suppress prev signal handler in hw bound check (#1268)
Enhance the hw bound check reported in #1262:

When registering signal handlers for SIGSEGV & SIGBUS in boundary
check with hardware trap, preserve the previous handlers for signal
SIGSEGV and SIGBUS, and forward the signal to the preserved signal
handlers if it isn't handled by hw bound check.
2022-07-06 16:53:05 +08:00
YAMAMOTO Takashi
653efecd02
debug_engine: Fix a few typos (#1261)
no functional changes are intended.

cf.
https://sourceware.org/gdb/onlinedocs/gdb/General-Query-Packets.html#General-Query-Packets
2022-06-30 15:45:46 +08:00
YAMAMOTO Takashi
2b49a0b817
wasm_cluster_spread_custom_data: Fix a crash when called before exec (#1257) 2022-06-29 13:21:03 +08:00
YAMAMOTO Takashi
d5d6b7284d
Fix a few redefinition warnings for WAMR_BUILD_DEBUG_INTERP=1 (#1256) 2022-06-29 12:23:58 +08:00
YAMAMOTO Takashi
a67c1c1c01
doc/build_wasm_app.md: Mention a glitch with LLVM 13 and later (#1255)
References:
https://reviews.llvm.org/D81689#3611504
https://github.com/WebAssembly/WASI/issues/471
2022-06-28 19:56:24 +08:00
Wenyong Huang
625d59191d
Update spec cases to latest version (#1253)
Update spec cases of mvp/threads to latest version, update wabt
to 1.0.29. And enhance the wasm loader.
2022-06-28 16:05:16 +08:00
Wenyong Huang
5e238322c2
Enable aot compiler with llvm-14/15 (#1252)
Enable aot compiler and jit based on llvm-14.0 and llvm-15.0git,
replace LLVMBuildLoad/LLVMBuildInBoundsGEP/LLVMBuildCall with
LLVMBuildLoad2/LLVMBuildInBoundsGEP2/LLVMBuildCall2, and pass
them with related types, so as to meet the requirements of opaque
pointers.

And fix several compilation errors for llvm-14.0/15.0git.

Most spec cases and standalone cases are tested.
2022-06-28 14:53:01 +08:00
Cengizhan Pasaoglu
2746d29751
Make robust on choosing target assumption for X86_32 support (#1241)
When WAMR_BUILD_TARGET isn't set, choosing right target is decided
by checking `CMAKE_SIZEOF_VOID_P` variable. However, choosing `X86_32`
target is not doing specifically checking size of void pointer. It is kind
a fallback target for others.

This patch explicitly checks the size of void pointer before setting the target
to `X86_32` to fix the issue.
2022-06-27 20:30:31 +08:00
YAMAMOTO Takashi
eb3cdaaf32
Fix macro redifinition warning for NuttX (#1250)
Fix the following warning introduced by the recent change.

```
In file included from wamr/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/locking.h:17,
                 from wamr/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/posix.h:18,
                 from wamr/core/iwasm/aot/../common/wasm_runtime_common.h:18,
                 from wamr/core/iwasm/aot/aot_runtime.h:10,
                 from wamr/core/iwasm/aot/aot_loader.c:6:
wamr/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/ssp_config.h:55: error: "CONFIG_HAS_ISATTY" redefined [-Werror]
 #define CONFIG_HAS_ISATTY 1

In file included from wamr/core/shared/utils/../platform/include/platform_common.h:13,
                 from wamr/core/shared/utils/bh_platform.h:9,
                 from wamr/core/iwasm/aot/aot_runtime.h:9,
                 from wamr/core/iwasm/aot/aot_loader.c:6:
wamr/core/shared/platform/nuttx/platform_internal.h:75: note: this is the location of the previous definition
 #define CONFIG_HAS_ISATTY 0
```
2022-06-26 10:06:34 +08:00
Wenyong Huang
114bf9408b
Fix get invokeNative float ret value issue with clang compiler (#1248)
When using clang compiler, the f32/f64 return value might be
invalid when calling invokeNative asm code. Declare the return
type of invokeNative as void, and set volatile for the converted
function pointers to resolve the issue.
2022-06-26 09:33:54 +08:00
Xu Jun
471cac4719
Enable dump call stack to a buffer (#1244)
Enable dump call stack to a buffer, use API
`wasm_runtime_get_call_stack_buf_size` to get the required buffer size
and use API
`wasm_runtime_dump_call_stack_to_buf` to dump call stack to a buffer
2022-06-25 21:38:43 +08:00
Xu Jun
53b775aa4b
Support integrate 3rd-party toolchains into wamrc (#1237)
Support integrating 3rd-party toolchain llc compiler or asm compiler
into wamrc by setting environment variable WAMRC_LLC_COMPILER
or WAMRC_ASM_COMPILER, wamrc will use these tools to generate
object file from LLVM IR firstly, and then refactor the object file into
aot file.
2022-06-20 13:13:41 +08:00
dongsheng28849455
bc6eda2803
Set nuttx isatty definition according to CONFIG_SERIAL_TERMIOS (#1234)
The isatty definition on nuttx depends on CONFIG_SERIAL_TERMIOS
2022-06-20 11:58:48 +08:00
Xu Jun
d0676930dc
Add arc compiler-rt functions and reloc type for mwdt (#1238)
Add arc compiler-rt functions and reloc type for arc MetaWare
Development Toolkit (mwdt), controlled by macro __CCAC__.
2022-06-20 09:03:31 +08:00
liang.he
f975a987bf
Separate MacOS workflows from the big one (#1236)
Separate MacOS workflows from the big one so as to avoid too much tasks
And optimize the total duration by reducing getting LLVM libraries times
2022-06-17 17:44:20 +08:00
dongsheng28849455
cc942e8c68
Add missing aot relocation symbols for xtensa target (#1235)
Some symbols are missing when loading the xtensa aot file.
2022-06-17 15:11:56 +08:00
Xu Jun
4b38205023
Fix some issues reported by klocwork (#1233)
Change memcpy to bh_memcpy_s and add some asserts to
enhance the security.
2022-06-16 19:50:47 +08:00
Xu Jun
188d5e70e9
Fix typo in wasm_mini_loader.c (#1232) 2022-06-16 12:07:32 +08:00
Xu Jun
b39f4c5c9b
Fix drop opcode issue in fast interpreter (#1231)
Fix fast interpreter issue reported in #1230
2022-06-16 09:51:01 +08:00
Xu Jun
e0a8aa09be
Fix build error when enable custom section without interpreter (#1229) 2022-06-15 18:14:39 +08:00
Xu Jun
1705ae569b
Update spec test script (#1227) 2022-06-15 11:07:39 +08:00
Xu Jun
77595c9560
Support emit specified custom sections into AoT file (#1207)
And add API to get the content of custom section with
section name for both wasm file and aot file.
2022-06-10 21:51:13 +08:00
Xu Jun
d404107d85
Fix typo in embed_wamr.md (#1214)
Fix typo in embed_wamr.md reported by #1211
2022-06-09 08:56:45 +08:00
Xu Jun
93607d0fac
Support print exception info in source debugger (#1212) 2022-06-08 12:17:48 +08:00
Wenyong Huang
48cdbee4e0
Update documents (#1203)
Mention the Python binding and Go binding in README.md and
embed_wamr.md.
Fix typo of esp-idf link in build_wamr.md.
2022-06-02 14:33:03 +08:00
YAMAMOTO Takashi
ec299554dd
Remove the code for WASM_ENABLE_GC (#1200)
Remove the code for WASM_ENABLE_GC as it is for a dev branch
2022-06-01 16:46:11 +08:00
Wenyong Huang
5b1dcf2fa2
Implement Go language binding (#1196)
Implement Go binding APIs of runtime, module and instance
Add sample, build scripts and update the document

Co-authored-by: venus-taibai <97893654+venus-taibai@users.noreply.github.com>
2022-06-01 11:35:05 +08:00
Wenyong Huang
3d34a91f0b
Implement Python language binding (#1192) (#1195)
Implement the first version of Python language binding

Co-authored-by: liang.he <liang.he@intel.com>
2022-05-31 16:39:46 +08:00
YAMAMOTO Takashi
3168ba8dcf
Add comments on trailing uint8[1] members in the "Common" structures (#1189)
Add comments to avoid abusing these members to store extra data.
2022-05-26 11:53:50 +08:00
YAMAMOTO Takashi
3fd763a95c
wasm_export.h: Make RuntimeInitArgs less config dependent (#1190)
This header file is supposed to be used by user code, which is not
a part of WAMR. Usually WAMR configuration is not available there,
remove DEBUG_INTERP macro control in it.
2022-05-25 18:15:51 +08:00
YAMAMOTO Takashi
2288695a33
product-mini/platforms/nuttx/wamr.mk: Build libc-wasi (#1129) 2022-05-24 16:12:08 +08:00
YAMAMOTO Takashi
da3b519642
core/shared/platform/nuttx: mock several APIs for libc-wasi (#1127) 2022-05-24 12:03:40 +08:00
liang.he
565c1c04db
Fix bh_vector extend_vector not locked issue (#1187)
Fix issue that func `extend_vector` isn't locked in vector insert and append.
2022-05-24 09:10:43 +08:00
YAMAMOTO Takashi
723a808106
nuttx: Use text heap for executable memory (#1181)
Based on nuttx patch "Add up_textheap_heapmember":
  https://github.com/apache/incubator-nuttx/pull/6306
2022-05-23 10:58:09 +08:00
YAMAMOTO Takashi
69c23aa2d4
aot_reloc_xtensa.c: define __packed if not available (#1179) 2022-05-21 16:46:02 +08:00
YAMAMOTO Takashi
c47b318aef
nuttx: add CONFIG_INTERPRETERS_WAMR_PERF_PROFILING (#1178)
Based on the corresponding nuttx patch:
  https://github.com/apache/incubator-nuttx-apps/pull/1166
2022-05-21 14:56:56 +08:00
YAMAMOTO Takashi
a50011a4dd
core/iwasm/common/wasm_application.c: Fix a typo of macro (#1180)
Change WAMR_ENABLE_PERF_PROFILING to WASM_ENABLE_PERF_PROFILING
2022-05-21 12:53:11 +08:00
Wenyong Huang
37cc6eac3b
Implement SGX getrandom/getentropy without ocall (#1176)
Implement SGX getrandom with sgx_read_rand and getentropy with `rdseed` instruction
instead of ocall to improve the security.
2022-05-21 12:21:09 +08:00
Wenyong Huang
c72501781a
Fix module_realloc with NULL ptr issue (#1175)
Fix module_realloc with NULL ptr issue reported by #1173.
2022-05-19 11:57:33 +08:00
Wenyong Huang
d7a2888b18
Fix Windows compilation warnings (#1171)
And update the Zephyr platform sample help, add arc target into usage list.
2022-05-16 09:12:58 +08:00
Namhyeon, Go
0993601d55
Add check for stack_min_addr in bound check with hardware trap (#1166)
Add return value check for os_thread_get_stack_boundary before touch_pages
in the initialization of memory access bound check with hardware trap.
2022-05-12 12:23:35 +08:00
Wenyong Huang
3d1dad7792
Fix x86-32 compile warning and update document (#1164) 2022-05-10 15:22:20 +08:00