Skip to content

Errors running native-tests on linux when built with sanitize #3543

@mike-kaufman

Description

@mike-kaufman

Repro:

  1. Build ChakraCore on linux with the following options:
    ./build.sh --cc=/usr/bin/clang --cxx=/usr/bin/clang++ --arch=amd64 --debug --static -j 8 --sanitize=address,undefined,signed-integer-overflow
  2. cd test/native-tests
  3. run tests: ./test_native.sh <full-path-to-ch.exe> Debug

Expected:
Tests to pass w/out error.

Actual:
Tests fail with the following:

mkaufman@mkaufman-ubuntu-3:~/ChakraCore/test/native-tests$ ./test_native.sh ~/ChakraCore/out/Debug/ch Debug
Testing test-c98
/home/mkaufman/ChakraCore/lib/Common/Codex/Utf8Codex.h:142:5: runtime error: load of value 4294967294, which is not a valid value for type 'utf8::DecodeOptions'
SUMMARY: AddressSanitizer: undefined-behavior /home/mkaufman/ChakraCore/lib/Common/Codex/Utf8Codex.h:142:5 in
/home/mkaufman/ChakraCore/pal/src/cruntime/wchar.cpp:1248:46: runtime error: load of misaligned address 0x621000019e3a for type 'const size_t' (aka 'const unsigned long'), which requires 8 byte alignment
0x621000019e3a: note: pointer points here
 ff ff  00 00 70 00 61 00 74 00  68 00 5f 00 73 00 65 00  70 00 00 00 bc bc bc bc  bc bc be be be be
              ^
SUMMARY: AddressSanitizer: undefined-behavior /home/mkaufman/ChakraCore/pal/src/cruntime/wchar.cpp:1248:46 in
/home/mkaufman/ChakraCore/pal/src/cruntime/wchar.cpp:1248:58: runtime error: load of misaligned address 0x62100001a0aa for type 'const size_t' (aka 'const unsigned long'), which requires 8 byte alignment
0x62100001a0aa: note: pointer points here
 ff ff  00 00 70 00 6c 00 61 00  74 00 66 00 6f 00 72 00  6d 00 00 00 bc bc bc bc  bc bc be be be be
              ^
SUMMARY: AddressSanitizer: undefined-behavior /home/mkaufman/ChakraCore/pal/src/cruntime/wchar.cpp:1248:58 in
/home/mkaufman/ChakraCore/lib/Runtime/ByteCode/ByteCodeWriter.cpp:1786:88: runtime error: reference binding to misaligned address 0x7fffdff5d881 for type 'typename LayoutSizePolicy<SmallLayout>::PropertyIdIndexType' (aka 'unsigned short'), which requires 2 byte alignment
0x7fffdff5d881: note: pointer points here
 7f 00 00  01 d8 f5 df ff 7f 00 00  b0 35 a6 88 26 56 00 00  06 62 cf 7c 87 c9 9b cd  06 62 cf 7c 87
              ^
SUMMARY: AddressSanitizer: undefined-behavior /home/mkaufman/ChakraCore/lib/Runtime/ByteCode/ByteCodeWriter.cpp:1786:88 in
/home/mkaufman/ChakraCore/lib/Runtime/ByteCode/ByteCodeWriter.cpp:1145:96: runtime error: reference binding to misaligned address 0x7fffdff4b583 for type 'InlineCacheIndex' (aka 'unsigned int'), which requires 4 byte alignment
0x7fffdff4b583: note: pointer points here
 04  02 ff 0d df ff 7f 00 00  78 a1 6b 6b 71 7f 00 00  d0 b7 f4 df ff ff ff ff  02 00 00 00 00 00 00
              ^
SUMMARY: AddressSanitizer: undefined-behavior /home/mkaufman/ChakraCore/lib/Runtime/ByteCode/ByteCodeWriter.cpp:1145:96 in
/home/mkaufman/ChakraCore/lib/Runtime/ByteCode/ByteCodeWriter.cpp:102:48: runtime error: load of misaligned address 0x7f716b620037 for type 'short', which requires 2 byte alignment
0x7f716b620037: note: pointer points here
 0e 0e 00 0f 03  00 0e 09 02 00 ab 0d 09  02 00 ac 0d 6b 00 00 00  00 0e 62 0e 0e 00 62 0e  0e 01 3d
             ^
SUMMARY: AddressSanitizer: undefined-behavior /home/mkaufman/ChakraCore/lib/Runtime/ByteCode/ByteCodeWriter.cpp:102:48 in
/home/mkaufman/ChakraCore/lib/Runtime/ByteCode/ByteCodeWriter.cpp:118:13: runtime error: store to misaligned address 0x7f716b620037 for type 'short', which requires 2 byte alignment
0x7f716b620037: note: pointer points here
 0e 0e 00 0f 03  00 0e 09 02 00 ab 0d 09  02 00 ac 0d 6b 00 00 00  00 0e 62 0e 0e 00 62 0e  0e 01 3d
             ^
SUMMARY: AddressSanitizer: undefined-behavior /home/mkaufman/ChakraCore/lib/Runtime/ByteCode/ByteCodeWriter.cpp:118:13 in
/home/mkaufman/ChakraCore/lib/Runtime/ByteCode/ByteCodeWriter.cpp:170:13: runtime error: store to misaligned address 0x7f716b62017d for type 'uint' (aka 'unsigned int'), which requires 4 byte alignment
0x7f716b62017d: note: pointer points here
 5c 00 07 6b 06 00 00  00 0e 5c 01 0e f2 02 ff  0d 00 00 00 00 03 00 24  00 00 00 00 00 00 00 00  00
             ^
SUMMARY: AddressSanitizer: undefined-behavior /home/mkaufman/ChakraCore/lib/Runtime/ByteCode/ByteCodeWriter.cpp:170:13 in
/home/mkaufman/ChakraCore/lib/Runtime/ByteCode/ByteCodeWriter.cpp:179:13: runtime error: store to misaligned address 0x7f716b620189 for type 'uint' (aka 'unsigned int'), which requires 4 byte alignment
0x7f716b620189: note: pointer points here
 f2 02 ff  0d 00 00 00 00 03 00 24  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00
              ^
SUMMARY: AddressSanitizer: undefined-behavior /home/mkaufman/ChakraCore/lib/Runtime/ByteCode/ByteCodeWriter.cpp:179:13 in
/home/mkaufman/ChakraCore/lib/Runtime/ByteCode/ByteCodeWriter.cpp:188:13: runtime error: store to misaligned address 0x7f716b62016b for type 'uint' (aka 'unsigned int'), which requires 4 byte alignment
0x7f716b62016b: note: pointer points here
 0d  0c 06 73 05 00 00 00 0d  6f 0f 00 00 00 0d 07 02  00 5c 00 07 6b 0e 00 00  00 0e 5c 01 0e f2 02
              ^
SUMMARY: AddressSanitizer: undefined-behavior /home/mkaufman/ChakraCore/lib/Runtime/ByteCode/ByteCodeWriter.cpp:188:13 in
/home/mkaufman/ChakraCore/lib/Backend/InterpreterThunkEmitter.h:124:9: runtime error: load of misaligned address 0x7f7168a2003d for type 'unsigned long', which requires 8 byte alignment
0x7f7168a2003d: note: pointer points here
 24 10 48 b8 00 00 00  00 00 00 00 00 ff e2 cc  cc cc cc cc cc cc cc cc  cc cc cc cc cc cc cc cc  cc
             ^
SUMMARY: AddressSanitizer: undefined-behavior /home/mkaufman/ChakraCore/lib/Backend/InterpreterThunkEmitter.h:124:9 in
/home/mkaufman/ChakraCore/lib/Backend/InterpreterThunkEmitter.h:125:9: runtime error: store to misaligned address 0x7f7168a2003d for type 'unsigned long', which requires 8 byte alignment
0x7f7168a2003d: note: pointer points here
 24 10 48 b8 00 00 00  00 00 00 00 00 ff e2 cc  cc cc cc cc cc cc cc cc  cc cc cc cc cc cc cc cc  cc
             ^
SUMMARY: AddressSanitizer: undefined-behavior /home/mkaufman/ChakraCore/lib/Backend/InterpreterThunkEmitter.h:125:9 in
/home/mkaufman/ChakraCore/lib/Backend/InterpreterThunkEmitter.h:124:9: runtime error: load of misaligned address 0x7f7168a20027 for type 'unsigned int', which requires 4 byte alignment
0x7f7168a20027: note: pointer points here
 c1 48 81 f9 00  00 00 00 76 09 48 c7 c1  00 00 00 00 cd 29 48 8d  7c 24 10 48 b8 90 a9 1c  8a 26 56
             ^
SUMMARY: AddressSanitizer: undefined-behavior /home/mkaufman/ChakraCore/lib/Backend/InterpreterThunkEmitter.h:124:9 in
/home/mkaufman/ChakraCore/lib/Backend/InterpreterThunkEmitter.h:125:9: runtime error: store to misaligned address 0x7f7168a20027 for type 'unsigned int', which requires 4 byte alignment
0x7f7168a20027: note: pointer points here
 c1 48 81 f9 00  00 00 00 76 09 48 c7 c1  00 00 00 00 cd 29 48 8d  7c 24 10 48 b8 90 a9 1c  8a 26 56
             ^
SUMMARY: AddressSanitizer: undefined-behavior /home/mkaufman/ChakraCore/lib/Backend/InterpreterThunkEmitter.h:125:9 in
/home/mkaufman/ChakraCore/lib/Backend/InterpreterThunkEmitter.h:124:9: runtime error: load of misaligned address 0x7f7168a2004b for type 'int', which requires 4 byte alignment
0x7f7168a2004b: note: pointer points here
 cc  ff d0 e9 00 00 00 00 cc  cc cc cc cc cc cc cc cc  cc cc cc cc cc cc cc cc  cc cc cc cc cc cc cc
              ^
SUMMARY: AddressSanitizer: undefined-behavior /home/mkaufman/ChakraCore/lib/Backend/InterpreterThunkEmitter.h:124:9 in
/home/mkaufman/ChakraCore/lib/Backend/InterpreterThunkEmitter.h:125:9: runtime error: store to misaligned address 0x7f7168a2004b for type 'int', which requires 4 byte alignment
0x7f7168a2004b: note: pointer points here
 cc  ff d0 e9 00 00 00 00 cc  cc cc cc cc cc cc cc cc  cc cc cc cc cc cc cc cc  cc cc cc cc cc cc cc
              ^
SUMMARY: AddressSanitizer: undefined-behavior /home/mkaufman/ChakraCore/lib/Backend/InterpreterThunkEmitter.h:125:9 in
ASAN:DEADLYSIGNAL
=================================================================
==9779==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x56268794e5b2 bp 0x61c00000e080 sp 0x7fffdff618f0 T0)
    #0 0x56268794e5b1  (/home/mkaufman/ChakraCore/out/Debug/ch+0xca7c5b1)
    #1 0x56268794ce12  (/home/mkaufman/ChakraCore/out/Debug/ch+0xca7ae12)
    #2 0x56268794d542  (/home/mkaufman/ChakraCore/out/Debug/ch+0xca7b542)
    #3 0x562687ca5008  (/home/mkaufman/ChakraCore/out/Debug/ch+0xcdd3008)
    #4 0x562687c9a39e  (/home/mkaufman/ChakraCore/out/Debug/ch+0xcdc839e)
    #5 0x562687c8e6db  (/home/mkaufman/ChakraCore/out/Debug/ch+0xcdbc6db)
    #6 0x562687be6ad4  (/home/mkaufman/ChakraCore/out/Debug/ch+0xcd14ad4)
    #7 0x562687b9c244  (/home/mkaufman/ChakraCore/out/Debug/ch+0xccca244)
    #8 0x562687bf5503  (/home/mkaufman/ChakraCore/out/Debug/ch+0xcd23503)
    #9 0x562687b933f7  (/home/mkaufman/ChakraCore/out/Debug/ch+0xccc13f7)
    #10 0x562687b934d4  (/home/mkaufman/ChakraCore/out/Debug/ch+0xccc14d4)
    #11 0x56268dc6930c  (/home/mkaufman/ChakraCore/out/Debug/ch+0x12d9730c)
    #12 0x56268dc65e1a  (/home/mkaufman/ChakraCore/out/Debug/ch+0x12d93e1a)
    #13 0x56268dc653a1  (/home/mkaufman/ChakraCore/out/Debug/ch+0x12d933a1)
    #14 0x562688dd6ce4  (/home/mkaufman/ChakraCore/out/Debug/ch+0xdf04ce4)
    #15 0x562688dedec6  (/home/mkaufman/ChakraCore/out/Debug/ch+0xdf1bec6)
    #16 0x562687dc03a4  (/home/mkaufman/ChakraCore/out/Debug/ch+0xceee3a4)
    #17 0x562687dbebd9  (/home/mkaufman/ChakraCore/out/Debug/ch+0xceecbd9)
    #18 0x562687dbe260  (/home/mkaufman/ChakraCore/out/Debug/ch+0xceec260)
    #19 0x562687d6e51d  (/home/mkaufman/ChakraCore/out/Debug/ch+0xce9c51d)
    #20 0x562687d6e31d  (/home/mkaufman/ChakraCore/out/Debug/ch+0xce9c31d)
    #21 0x562687958ce0  (/home/mkaufman/ChakraCore/out/Debug/ch+0xca86ce0)
    #22 0x562687955749  (/home/mkaufman/ChakraCore/out/Debug/ch+0xca83749)
    #23 0x562687955837  (/home/mkaufman/ChakraCore/out/Debug/ch+0xca83837)
    #24 0x56268795764e  (/home/mkaufman/ChakraCore/out/Debug/ch+0xca8564e)
    #25 0x7f716fa9882f  (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
    #26 0x56268787a3e8  (/home/mkaufman/ChakraCore/out/Debug/ch+0xc9a83e8)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/home/mkaufman/ChakraCore/out/Debug/ch+0xca7c5b1)
==9779==ABORTING

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions