Building iwasm (or embedding into the program) with GCC undefined sanitizer when Fast JIT is enabled causes the following:
$ ./iwasm simple_wasm.wasm
/home/user/wasm-micro-runtime/core/iwasm/fast-jit/cg/x86-64/jit_codegen_x86_64.cpp:9317:32: runtime error: store to misaligned address 0x5631a8a597d5 for type 'int32', which requires 4 byte alignment
0x5631a8a597d5: note: pointer points here
3c 00 0f 85 00 00 00 00 4c 89 e7 48 c7 c6 11 00 00 00 48 b8 00 2e d0 a6 31 56 00 00 ff d0 b8 01
^
/home/user/wasm-micro-runtime/core/iwasm/fast-jit/cg/x86-64/jit_codegen_x86_64.cpp:6202:34: runtime error: store to misaligned address 0x7f66044003a6 for type 'uintptr_t', which requires 8 byte alignment
0x7f66044003a6: note: pointer points here
00 00 48 be ff ff ff ff ff ff ff 7f 48 89 75 18 41 ff e2 4d 8b 47 10 4c 89 c7 48 c7 c6 00 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/fast-jit/cg/x86-64/jit_codegen_x86_64.cpp:5510:32: runtime error: store to misaligned address 0x7f63f000999f for type 'int32', which requires 4 byte alignment
0x7f63f000999f: note: pointer points here
00 00 0f 84 00 00 00 00 48 89 75 18 41 ff e0 89 d0 4c 8b 85 d8 00 00 00 83 f8 00 89 45 58 0f 84
^
/home/user/wasm-micro-runtime/core/iwasm/fast-jit/cg/x86-64/jit_codegen_x86_64.cpp:6188:30: runtime error: store to misaligned address 0x7f660440042d for type 'int32', which requires 4 byte alignment
0x7f660440042d: note: pointer points here
39 d1 0f 87 00 00 00 00 49 81 e9 f8 00 00 00 4d 89 8f a0 0c 00 00 4d 89 c1 49 83 c1 50 4d 89 48
^
/home/user/wasm-micro-runtime/core/iwasm/fast-jit/cg/x86-64/jit_codegen_x86_64.cpp:5772:33: runtime error: store to misaligned address 0x7f63f8010172 for type 'uint32', which requires 4 byte alignment
0x7f63f8010172: note: pointer points here
fe 12 0f 82 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/fast-jit/cg/x86-64/jit_codegen_x86_64.cpp:6197:34: runtime error: store to misaligned address 0x7f6604405821 for type 'uintptr_t', which requires 8 byte alignment
0x7f6604405821: note: pointer points here
ff ff ff ff ff ff ff ff ff ff ff ff 8b 4d 58 41 89 c8 4d 8b 4f 10 4d 8b 89 58 01 00 00 43 8b 1c
^
/home/user/wasm-micro-runtime/core/iwasm/fast-jit/cg/x86-64/jit_codegen_x86_64.cpp:6206:34: runtime error: store to misaligned address 0x7f660440578e for type 'uintptr_t', which requires 8 byte alignment
0x7f660440578e: note: pointer points here
00 00 48 b8 ff ff ff ff ff ff ff 7f ff 24 f0 8a 5d 40 04 66 7f 00 00 29 58 40 04 66 7f 00 00 79
^
/home/user/wasm-micro-runtime/core/iwasm/fast-jit/cg/x86-64/jit_codegen_x86_64.cpp:7987:25: runtime error: store to misaligned address 0x7f63f004966b for type 'int32', which requires 4 byte alignment
0x7f63f004966b: note: pointer points here
04 11 40 e9 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
52
The interpreter also triggers such issues
$ ./iwasm --interp simple_wasm.wasm
/home/user/wasm-micro-runtime/core/iwasm/fast-jit/cg/x86-64/jit_codegen_x86_64.cpp:9317:32: runtime error: store to misaligned address 0x556e0421f7d5 for type 'int32', which requires 4 byte alignment
0x556e0421f7d5: note: pointer points here
3c 00 0f 85 00 00 00 00 4c 89 e7 48 c7 c6 11 00 00 00 48 b8 00 ee eb 03 6e 55 00 00 ff d0 b8 01
^
/home/user/wasm-micro-runtime/core/iwasm/fast-jit/cg/x86-64/jit_codegen_x86_64.cpp:6188:30: runtime error: store to misaligned address 0x7fe2ed20024d for type 'int32', which requires 4 byte alignment
0x7fe2ed20024d: note: pointer points here
39 d1 0f 87 00 00 00 00 49 81 e9 f8 00 00 00 4d 89 8f a0 0c 00 00 4d 89 c1 49 83 c1 50 4d 89 48
^
/home/user/wasm-micro-runtime/core/iwasm/fast-jit/cg/x86-64/jit_codegen_x86_64.cpp:5510:32: runtime error: store to misaligned address 0x7fe0e000999f for type 'int32', which requires 4 byte alignment
0x7fe0e000999f: note: pointer points here
00 00 0f 84 00 00 00 00 48 89 75 18 41 ff e0 89 d0 4c 8b 85 d8 00 00 00 83 f8 00 89 45 58 0f 84
^
/home/user/wasm-micro-runtime/core/iwasm/fast-jit/cg/x86-64/jit_codegen_x86_64.cpp:6202:34: runtime error: store to misaligned address 0x7fe2ed200706 for type 'uintptr_t', which requires 8 byte alignment
0x7fe2ed200706: note: pointer points here
00 00 48 be ff ff ff ff ff ff ff 7f 48 89 75 18 41 ff e2 4d 8b 47 10 4c 89 c7 48 c7 c6 00 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:3932:13: runtime error: member access within misaligned address 0x556e04224f5c for type 'struct WASMBranchBlock', which requires 8 byte alignment
0x556e04224f5c: note: pointer points here
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:3932:13: runtime error: member access within misaligned address 0x556e04224f5c for type 'struct WASMBranchBlock', which requires 8 byte alignment
0x556e04224f5c: note: pointer points here
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:3932:13: runtime error: member access within misaligned address 0x556e04224f5c for type 'struct WASMBranchBlock', which requires 8 byte alignment
0x556e04224f5c: note: pointer points here
00 00 00 00 66 b9 21 04 6e 55 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:3932:13: runtime error: member access within misaligned address 0x556e04224f5c for type 'struct WASMBranchBlock', which requires 8 byte alignment
0x556e04224f5c: note: pointer points here
00 00 00 00 66 b9 21 04 6e 55 00 00 a6 b9 21 04 6e 55 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/fast-jit/cg/x86-64/jit_codegen_x86_64.cpp:5772:33: runtime error: store to misaligned address 0x7fe0e80102a2 for type 'uint32', which requires 4 byte alignment
0x7fe0e80102a2: note: pointer points here
fe 12 0f 82 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:1244:17: runtime error: member access within misaligned address 0x556e04224f7c for type 'struct WASMBranchBlock', which requires 8 byte alignment
0x556e04224f7c: note: pointer points here
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/fast-jit/cg/x86-64/jit_codegen_x86_64.cpp:6197:34: runtime error: store to misaligned address 0x7fe2ed205821 for type 'uintptr_t', which requires 8 byte alignment
0x7fe2ed205821: note: pointer points here
ff ff ff ff ff ff ff ff ff ff ff ff 8b 4d 58 41 89 c8 4d 8b 4f 10 4d 8b 89 58 01 00 00 43 8b 1c
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:1244:17: runtime error: member access within misaligned address 0x556e04224f7c for type 'struct WASMBranchBlock', which requires 8 byte alignment
0x556e04224f7c: note: pointer points here
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/fast-jit/cg/x86-64/jit_codegen_x86_64.cpp:6206:34: runtime error: store to misaligned address 0x7fe2ed20578e for type 'uintptr_t', which requires 8 byte alignment
0x7fe2ed20578e: note: pointer points here
00 00 48 b8 ff ff ff ff ff ff ff 7f ff 24 f0 8a 5d 20 ed e2 7f 00 00 29 58 20 ed e2 7f 00 00 79
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:1244:17: runtime error: member access within misaligned address 0x556e04224f7c for type 'struct WASMBranchBlock', which requires 8 byte alignment
0x556e04224f7c: note: pointer points here
00 00 00 00 68 b9 21 04 6e 55 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/fast-jit/cg/x86-64/jit_codegen_x86_64.cpp:7987:25: runtime error: store to misaligned address 0x7fe0e004966b for type 'int32', which requires 4 byte alignment
0x7fe0e004966b: note: pointer points here
04 11 40 e9 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:1244:17: runtime error: member access within misaligned address 0x556e04224f7c for type 'struct WASMBranchBlock', which requires 8 byte alignment
0x556e04224f7c: note: pointer points here
00 00 00 00 68 b9 21 04 6e 55 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:849:27: runtime error: member access within misaligned address 0x556e04224fbc for type 'struct WASMInterpFrame', which requires 8 byte alignment
0x556e04224fbc: note: pointer points here
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:3911:29: runtime error: member access within misaligned address 0x556e04224fbc for type 'struct WASMInterpFrame', which requires 8 byte alignment
0x556e04224fbc: note: pointer points here
00 00 00 00 00 4f 22 04 6e 55 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:3914:22: runtime error: member access within misaligned address 0x556e04224fbc for type 'struct WASMInterpFrame', which requires 8 byte alignment
0x556e04224fbc: note: pointer points here
00 00 00 00 00 4f 22 04 6e 55 00 00 b0 38 22 04 6e 55 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:3916:41: runtime error: member access within misaligned address 0x556e04224fbc for type 'struct WASMInterpFrame', which requires 8 byte alignment
0x556e04224fbc: note: pointer points here
00 00 00 00 00 4f 22 04 6e 55 00 00 b0 38 22 04 6e 55 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:3916:22: runtime error: member access within misaligned address 0x556e04224fbc for type 'struct WASMInterpFrame', which requires 8 byte alignment
0x556e04224fbc: note: pointer points here
00 00 00 00 00 4f 22 04 6e 55 00 00 b0 38 22 04 6e 55 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:3919:22: runtime error: member access within misaligned address 0x556e04224fbc for type 'struct WASMInterpFrame', which requires 8 byte alignment
0x556e04224fbc: note: pointer points here
00 00 00 00 00 4f 22 04 6e 55 00 00 b0 38 22 04 6e 55 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:3918:32: runtime error: member access within misaligned address 0x556e04224fbc for type 'struct WASMInterpFrame', which requires 8 byte alignment
0x556e04224fbc: note: pointer points here
00 00 00 00 00 4f 22 04 6e 55 00 00 b0 38 22 04 6e 55 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:3922:41: runtime error: member access within misaligned address 0x556e04224fbc for type 'struct WASMInterpFrame', which requires 8 byte alignment
0x556e04224fbc: note: pointer points here
00 00 00 00 00 4f 22 04 6e 55 00 00 b0 38 22 04 6e 55 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:3921:43: runtime error: member access within misaligned address 0x556e04224fbc for type 'struct WASMInterpFrame', which requires 8 byte alignment
0x556e04224fbc: note: pointer points here
00 00 00 00 00 4f 22 04 6e 55 00 00 b0 38 22 04 6e 55 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:3921:23: runtime error: member access within misaligned address 0x556e04224fbc for type 'struct WASMInterpFrame', which requires 8 byte alignment
0x556e04224fbc: note: pointer points here
00 00 00 00 00 4f 22 04 6e 55 00 00 b0 38 22 04 6e 55 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:3924:22: runtime error: member access within misaligned address 0x556e04224fbc for type 'struct WASMInterpFrame', which requires 8 byte alignment
0x556e04224fbc: note: pointer points here
00 00 00 00 00 4f 22 04 6e 55 00 00 b0 38 22 04 6e 55 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:3923:33: runtime error: member access within misaligned address 0x556e04224fbc for type 'struct WASMInterpFrame', which requires 8 byte alignment
0x556e04224fbc: note: pointer points here
00 00 00 00 00 4f 22 04 6e 55 00 00 b0 38 22 04 6e 55 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:1328:38: runtime error: member access within misaligned address 0x556e04224fbc for type 'struct WASMInterpFrame', which requires 8 byte alignment
0x556e04224fbc: note: pointer points here
00 00 00 00 00 4f 22 04 6e 55 00 00 b0 38 22 04 6e 55 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:3852:9: runtime error: member access within misaligned address 0x556e04224fbc for type 'struct WASMInterpFrame', which requires 8 byte alignment
0x556e04224fbc: note: pointer points here
00 00 00 00 00 4f 22 04 6e 55 00 00 a0 39 22 04 6e 55 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:3852:9: runtime error: member access within misaligned address 0x556e04224fbc for type 'struct WASMInterpFrame', which requires 8 byte alignment
0x556e04224fbc: note: pointer points here
00 00 00 00 00 4f 22 04 6e 55 00 00 a0 39 22 04 6e 55 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:3852:9: runtime error: member access within misaligned address 0x556e04224fbc for type 'struct WASMInterpFrame', which requires 8 byte alignment
0x556e04224fbc: note: pointer points here
00 00 00 00 00 4f 22 04 6e 55 00 00 a0 39 22 04 6e 55 00 00 eb b9 21 04 6e 55 00 00 00 00 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:2144:13: runtime error: store to misaligned address 0x556e0422512c for type 'int64', which requires 8 byte alignment
0x556e0422512c: note: pointer points here
60 12 01 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 c4 21 04 6e 55 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:2038:17: runtime error: load of misaligned address 0x556e0422512c for type 'int64', which requires 8 byte alignment
0x556e0422512c: note: pointer points here
60 12 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 c4 21 04 6e 55 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:1262:17: runtime error: member access within misaligned address 0x556e042253b4 for type 'struct WASMBranchBlock', which requires 8 byte alignment
0x556e042253b4: note: pointer points here
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:1262:17: runtime error: member access within misaligned address 0x556e042253b4 for type 'struct WASMBranchBlock', which requires 8 byte alignment
0x556e042253b4: note: pointer points here
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:1262:17: runtime error: member access within misaligned address 0x556e042253b4 for type 'struct WASMBranchBlock', which requires 8 byte alignment
0x556e042253b4: note: pointer points here
00 00 00 00 2a c6 21 04 6e 55 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:1262:17: runtime error: member access within misaligned address 0x556e042253b4 for type 'struct WASMBranchBlock', which requires 8 byte alignment
0x556e042253b4: note: pointer points here
00 00 00 00 2a c6 21 04 6e 55 00 00 2a c6 21 04 6e 55 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:1348:17: runtime error: member access within misaligned address 0x556e04225534 for type 'struct WASMBranchBlock', which requires 8 byte alignment
0x556e04225534: note: pointer points here
00 00 00 00 69 c6 21 04 6e 55 00 00 00 00 00 00 00 00 00 00 10 53 22 04 6e 55 00 00 00 00 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:1348:17: runtime error: member access within misaligned address 0x556e04225534 for type 'struct WASMBranchBlock', which requires 8 byte alignment
0x556e04225534: note: pointer points here
00 00 00 00 69 c6 21 04 6e 55 00 00 00 00 00 00 00 00 00 00 10 53 22 04 6e 55 00 00 00 00 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:1348:17: runtime error: member access within misaligned address 0x556e04225534 for type 'struct WASMBranchBlock', which requires 8 byte alignment
0x556e04225534: note: pointer points here
00 00 00 00 69 c6 21 04 6e 55 00 00 00 00 00 00 00 00 00 00 10 53 22 04 6e 55 00 00 00 00 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:1352:44: runtime error: member access within misaligned address 0x556e04225534 for type 'struct WASMBranchBlock', which requires 8 byte alignment
0x556e04225534: note: pointer points here
00 00 00 00 69 c6 21 04 6e 55 00 00 00 00 00 00 00 00 00 00 10 53 22 04 6e 55 00 00 00 00 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:2038:17: runtime error: store to misaligned address 0x7fe0ed000d54 for type 'int64', which requires 8 byte alignment
0x7fe0ed000d54: note: pointer points here
05 00 00 00 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:3854:32: runtime error: member access within misaligned address 0x556e04225774 for type 'struct WASMInterpFrame', which requires 8 byte alignment
0x556e04225774: note: pointer points here
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:1334:36: runtime error: member access within misaligned address 0x556e04225774 for type 'struct WASMInterpFrame', which requires 8 byte alignment
0x556e04225774: note: pointer points here
00 00 00 00 00 52 22 04 6e 55 00 00 60 3d 22 04 6e 55 00 00 57 c0 21 04 6e 55 00 00 00 00 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:1334:40: runtime error: member access within misaligned address 0x556e04225774 for type 'struct WASMInterpFrame', which requires 8 byte alignment
0x556e04225774: note: pointer points here
00 00 00 00 00 52 22 04 6e 55 00 00 60 3d 22 04 6e 55 00 00 57 c0 21 04 6e 55 00 00 00 00 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:3947:24: runtime error: member access within misaligned address 0x556e04225774 for type 'struct WASMInterpFrame', which requires 8 byte alignment
0x556e04225774: note: pointer points here
00 00 00 00 00 52 22 04 6e 55 00 00 60 3d 22 04 6e 55 00 00 57 c0 21 04 6e 55 00 00 00 00 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:3951:9: runtime error: member access within misaligned address 0x556e04225774 for type 'struct WASMInterpFrame', which requires 8 byte alignment
0x556e04225774: note: pointer points here
00 00 00 00 00 52 22 04 6e 55 00 00 60 3d 22 04 6e 55 00 00 57 c0 21 04 6e 55 00 00 00 00 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:3951:9: runtime error: member access within misaligned address 0x556e04225774 for type 'struct WASMInterpFrame', which requires 8 byte alignment
0x556e04225774: note: pointer points here
00 00 00 00 00 52 22 04 6e 55 00 00 60 3d 22 04 6e 55 00 00 57 c0 21 04 6e 55 00 00 00 00 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:3951:9: runtime error: member access within misaligned address 0x556e04225774 for type 'struct WASMInterpFrame', which requires 8 byte alignment
0x556e04225774: note: pointer points here
00 00 00 00 00 52 22 04 6e 55 00 00 60 3d 22 04 6e 55 00 00 57 c0 21 04 6e 55 00 00 00 00 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:3951:9: runtime error: member access within misaligned address 0x556e04225774 for type 'struct WASMInterpFrame', which requires 8 byte alignment
0x556e04225774: note: pointer points here
00 00 00 00 00 52 22 04 6e 55 00 00 60 3d 22 04 6e 55 00 00 57 c0 21 04 6e 55 00 00 00 00 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:3951:9: runtime error: member access within misaligned address 0x556e04225774 for type 'struct WASMInterpFrame', which requires 8 byte alignment
0x556e04225774: note: pointer points here
00 00 00 00 00 52 22 04 6e 55 00 00 60 3d 22 04 6e 55 00 00 57 c0 21 04 6e 55 00 00 00 00 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:3951:9: runtime error: member access within misaligned address 0x556e04225774 for type 'struct WASMInterpFrame', which requires 8 byte alignment
0x556e04225774: note: pointer points here
00 00 00 00 00 52 22 04 6e 55 00 00 60 3d 22 04 6e 55 00 00 57 c0 21 04 6e 55 00 00 00 00 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:1991:17: runtime error: store to misaligned address 0x556e042257d4 for type 'int64', which requires 8 byte alignment
0x556e042257d4: note: pointer points here
68 0e 01 00 80 12 01 00 04 00 00 00 fa e8 21 04 6e 55 00 00 2b eb 21 04 6e 55 00 00 d0 57 22 04
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:849:27: runtime error: member access within misaligned address 0x556e04225a64 for type 'struct WASMInterpFrame', which requires 8 byte alignment
0x556e04225a64: note: pointer points here
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:895:21: runtime error: member access within misaligned address 0x556e04225a64 for type 'struct WASMInterpFrame', which requires 8 byte alignment
0x556e04225a64: note: pointer points here
00 00 00 00 e4 59 22 04 6e 55 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:896:15: runtime error: member access within misaligned address 0x556e04225a64 for type 'struct WASMInterpFrame', which requires 8 byte alignment
0x556e04225a64: note: pointer points here
00 00 00 00 e4 59 22 04 6e 55 00 00 f0 37 22 04 6e 55 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:897:17: runtime error: member access within misaligned address 0x556e04225a64 for type 'struct WASMInterpFrame', which requires 8 byte alignment
0x556e04225a64: note: pointer points here
00 00 00 00 e4 59 22 04 6e 55 00 00 f0 37 22 04 6e 55 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:897:15: runtime error: member access within misaligned address 0x556e04225a64 for type 'struct WASMInterpFrame', which requires 8 byte alignment
0x556e04225a64: note: pointer points here
00 00 00 00 e4 59 22 04 6e 55 00 00 f0 37 22 04 6e 55 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:932:67: runtime error: member access within misaligned address 0x556e04225a64 for type 'struct WASMInterpFrame', which requires 8 byte alignment
0x556e04225a64: note: pointer points here
00 00 00 00 e4 59 22 04 6e 55 00 00 f0 37 22 04 6e 55 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:946:19: runtime error: member access within misaligned address 0x556e042259e4 for type 'struct WASMInterpFrame', which requires 8 byte alignment
0x556e042259e4: note: pointer points here
6e 55 00 00 1c 59 22 04 6e 55 00 00 00 3a 22 04 6e 55 00 00 16 ba 21 04 6e 55 00 00 1c e9 21 04
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:947:19: runtime error: member access within misaligned address 0x556e042259e4 for type 'struct WASMInterpFrame', which requires 8 byte alignment
0x556e042259e4: note: pointer points here
6e 55 00 00 1c 59 22 04 6e 55 00 00 00 3a 22 04 6e 55 00 00 16 ba 21 04 6e 55 00 00 1c e9 21 04
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:947:23: runtime error: member access within misaligned address 0x556e042259e4 for type 'struct WASMInterpFrame', which requires 8 byte alignment
0x556e042259e4: note: pointer points here
6e 55 00 00 1c 59 22 04 6e 55 00 00 00 3a 22 04 6e 55 00 00 16 ba 21 04 6e 55 00 00 1c e9 21 04
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:3874:24: runtime error: member access within misaligned address 0x556e042259e4 for type 'struct WASMInterpFrame', which requires 8 byte alignment
0x556e042259e4: note: pointer points here
6e 55 00 00 1c 59 22 04 6e 55 00 00 00 3a 22 04 6e 55 00 00 16 ba 21 04 6e 55 00 00 1c e9 21 04
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:3875:22: runtime error: member access within misaligned address 0x556e042259e4 for type 'struct WASMInterpFrame', which requires 8 byte alignment
0x556e042259e4: note: pointer points here
6e 55 00 00 1c 59 22 04 6e 55 00 00 00 3a 22 04 6e 55 00 00 16 ba 21 04 6e 55 00 00 1c e9 21 04
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:3876:13: runtime error: member access within misaligned address 0x556e042259e4 for type 'struct WASMInterpFrame', which requires 8 byte alignment
0x556e042259e4: note: pointer points here
6e 55 00 00 1c 59 22 04 6e 55 00 00 00 3a 22 04 6e 55 00 00 16 ba 21 04 6e 55 00 00 1c e9 21 04
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:3876:13: runtime error: member access within misaligned address 0x556e042259e4 for type 'struct WASMInterpFrame', which requires 8 byte alignment
0x556e042259e4: note: pointer points here
6e 55 00 00 1c 59 22 04 6e 55 00 00 00 3a 22 04 6e 55 00 00 16 ba 21 04 6e 55 00 00 1c e9 21 04
^
/home/user/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c:3876:13: runtime error: member access within misaligned address 0x556e042259e4 for type 'struct WASMInterpFrame', which requires 8 byte alignment
0x556e042259e4: note: pointer points here
6e 55 00 00 1c 59 22 04 6e 55 00 00 00 3a 22 04 6e 55 00 00 16 ba 21 04 6e 55 00 00 1c e9 21 04
^
52
I'm using WAMR-1.2.2. I notice that with the embedded build I can trigger this even without the Fast JIT, as long as the fast interpreter is enabled. With iwasm I need the Fast JIT to be enabled, though then I can trigger it for the interpreter as well.
The build command I used to reproduce this with iwasm on Linux was:
CFLAGS='-fsanitize=undefined' CXXFLAGS='-fsanitize=undefined' cmake -DWAMR_BUILD_FAST_JIT=1 -GNinja ..
I'm using Ubuntu 22.04, GCC 11.3.0-1ubuntu1~22.04.1
Here is the wasm file I used: simple_wasm.wasm.tar.gz
I do believe that this isn't generally a problem on x86/x86-64 (it is on ARM though), but our company has a 0-ubsan (as well as asan/tsan) issues policy in the CI. And even on x86/x86-64 my understanding is that unaligned access is slower than aligned access (plus, in case of SSE/AVX by the compiler, outright unsupported, and it can potentially auto-vectorize based on assumed alignment from the type).
Building iwasm (or embedding into the program) with GCC undefined sanitizer when Fast JIT is enabled causes the following:
The interpreter also triggers such issues
I'm using WAMR-1.2.2. I notice that with the embedded build I can trigger this even without the Fast JIT, as long as the fast interpreter is enabled. With iwasm I need the Fast JIT to be enabled, though then I can trigger it for the interpreter as well.
The build command I used to reproduce this with iwasm on Linux was:
I'm using Ubuntu 22.04, GCC 11.3.0-1ubuntu1~22.04.1
Here is the wasm file I used: simple_wasm.wasm.tar.gz
I do believe that this isn't generally a problem on x86/x86-64 (it is on ARM though), but our company has a 0-ubsan (as well as asan/tsan) issues policy in the CI. And even on x86/x86-64 my understanding is that unaligned access is slower than aligned access (plus, in case of SSE/AVX by the compiler, outright unsupported, and it can potentially auto-vectorize based on assumed alignment from the type).