llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.97k stars 11.94k forks source link

Clang crashes with std::bad_alloc during osquery build #42685

Open llvmbot opened 5 years ago

llvmbot commented 5 years ago
Bugzilla Link 43340
Version 8.0
OS Linux
Reporter LLVM Bugzilla Contributor
CC @DougGregor,@zygoloid

Extended Description

Crashes during build of the aws-sdk-cpp dependency.

Working tree available at https://github.com/zwass/osquery/tree/clang-crash.

 55%] Building CXX object libs/src/aws-sdk-cpp/CMakeFiles/thirdparty_aws_ec2.dir/aws-sdk-cpp_src/aws-cpp-sdk-ec2/source/EC2Client.cpp.o
terminating with uncaught exception of type std::bad_alloc: std::bad_alloc
Stack dump:
0.  Program arguments: /usr/local/osquery-toolchain/usr/bin/clang-8 -cc1 -triple x86_64-osquery-linux-gnu -emit-obj -disable-free -disable-llvm-verifier -discard-value-names -main-file-name EC2Client.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -momit-leaf-frame-pointer -ffunction-sections -fdata-sections -coverage-notes-file /home/vagrant/libs/src/aws-sdk-cpp/CMakeFiles/thirdparty_aws_ec2.dir/aws-sdk-cpp_src/aws-cpp-sdk-ec2/source/EC2Client.cpp.gcno -resource-dir /usr/local/osquery-toolchain/usr/lib/clang/8.0.1 -isystem /vagrant/libraries/cmake/source_migration/aws-sdk-cpp/aws-sdk-cpp_src/aws-cpp-sdk-ec2/include -isystem /vagrant/libraries/cmake/source_migration/aws-sdk-cpp/aws-sdk-cpp_src/aws-cpp-sdk-core/include -isystem /home/vagrant/libs/src/aws-sdk-cpp/aws-cpp-sdk-core/include -isystem /vagrant/libraries/cmake/source_migration/aws-sdk-cpp/aws-c-event-stream_src/include -isystem /vagrant/libraries/cmake/source_migration/aws-sdk-cpp/aws-c-common_src/include -isystem /home/vagrant/libs/src/aws-sdk-cpp/aws-c-common/include -isystem /vagrant/libraries/cmake/source_migration/aws-sdk-cpp/aws-checksums_src/include -D AWS_SDK_VERSION_MAJOR=1 -D AWS_SDK_VERSION_MINOR=7 -D AWS_SDK_VERSION_PATCH=161 -D ENABLE_OPENSSL_ENCRYPTION -D NDEBUG -I /home/vagrant/installed_formulas/openssl/include -I /vagrant/libraries/cmake/source_migration/aws-sdk-cpp/aws-sdk-cpp_src/aws-cpp-sdk-core/include/aws/core/external -D NDEBUG -isysroot /usr/local/osquery-toolchain -internal-isystem /usr/local/osquery-toolchain/usr/bin/../include/c++/v1 -internal-isystem /usr/local/osquery-toolchain/usr/local/include -internal-isystem /usr/local/osquery-toolchain/usr/lib/clang/8.0.1/include -internal-externc-isystem /usr/local/osquery-toolchain/include -internal-externc-isystem /usr/local/osquery-toolchain/usr/include -Oz -Wno-shadow-field -Wall -Wextra -Wno-unused-local-typedef -Wno-deprecated-register -Wno-unknown-warning-option -Wstrict-aliasing -Wno-missing-field-initializers -Wchar-subscripts -Wpointer-arith -Wformat -Wformat-security -Werror=format-security -Wuseless-cast -Wno-zero-length-array -Wno-unused-parameter -Wno-gnu-case-range -Wno-c++11-extensions -Woverloaded-virtual -Wnon-virtual-dtor -Weffc++ -Wno-everything -Wno-all -Wno-error -pedantic -std=gnu++14 -fdeprecated-macro -fdebug-compilation-dir /home/vagrant/libs/src/aws-sdk-cpp -ferror-limit 19 -fmessage-length 202 -fvisibility hidden -fvisibility-inlines-hidden -stack-protector 3 -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -vectorize-slp -o CMakeFiles/thirdparty_aws_ec2.dir/aws-sdk-cpp_src/aws-cpp-sdk-ec2/source/EC2Client.cpp.o -x c++ /vagrant/libraries/cmake/source_migration/aws-sdk-cpp/aws-sdk-cpp_src/aws-cpp-sdk-ec2/source/EC2Client.cpp -faddrsig
1.  <eof> parser at end of file
2.  Per-file LLVM IR generation
3.  /usr/local/osquery-toolchain/usr/bin/../include/c++/v1/functional:1574:52: Generating code for declaration 'std::__1::__function::__func<std::__1::__bind<(lambda at /vagrant/libraries/cmake/source_migration/aws-sdk-cpp/aws-sdk-cpp_src/aws-cpp-sdk-ec2/source/EC2Client.cpp:1915:27) &>, std::__1::allocator<std::__1::__bind<(lambda at /vagrant/libraries/cmake/source_migration/aws-sdk-cpp/aws-sdk-cpp_src/aws-cpp-sdk-ec2/source/EC2Client.cpp:1915:27) &> >, void ()>::~__func'
/usr/local/osquery-toolchain/usr/bin/../lib/libLLVM-8.so(_ZN4llvm3sys15PrintStackTraceERNS_11raw_ostreamE+0x18)[0x7fa85d430419]
/usr/local/osquery-toolchain/usr/bin/../lib/libLLVM-8.so(+0x1046604)[0x7fa85d430604]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x12890)[0x7fa85e5a2890]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0xc7)[0x7fa85bc99e97]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x141)[0x7fa85bc9b801]
/usr/local/osquery-toolchain/usr/bin/clang-8(__cxa_get_globals+0x0)[0x930c0c]
/usr/local/osquery-toolchain/usr/bin/clang-8[0x930e0a]
/usr/local/osquery-toolchain/usr/bin/clang-8[0x92e517]
/usr/local/osquery-toolchain/usr/bin/clang-8(__cxa_get_exception_ptr+0x0)[0x92e6c8]
/usr/local/osquery-toolchain/usr/bin/clang-8[0x92e697]
/usr/local/osquery-toolchain/usr/bin/clang-8(_ZnwmRKSt9nothrow_t+0x0)[0x9309dd]
/usr/local/osquery-toolchain/usr/bin/../lib/libLLVM-8.so(+0xfdf590)[0x7fa85d3c9590]
/usr/local/osquery-toolchain/usr/bin/../lib/libLLVM-8.so(_ZN4llvm11raw_ostream5writeEh+0x59)[0x7fa85d41b67f]
/usr/local/osquery-toolchain/usr/bin/clang-8[0x1760e7f]
/usr/local/osquery-toolchain/usr/bin/clang-8[0x175e632]
/usr/local/osquery-toolchain/usr/bin/clang-8[0x175d3a9]
/usr/local/osquery-toolchain/usr/bin/clang-8[0x9b98d8]
/usr/local/osquery-toolchain/usr/bin/clang-8(_ZN5clang7CodeGen13CodeGenModule14getMangledNameENS_10GlobalDeclE+0xba)[0x9b638c]
/usr/local/osquery-toolchain/usr/bin/clang-8(_ZN5clang7CodeGen13CodeGenModule20getAddrOfCXXStructorEPKNS_13CXXMethodDeclENS0_12StructorTypeEPKNS0_14CGFunctionInfoEPN4llvm12FunctionTypeEbNS0_15ForDefinition_tE+0x110)[0xa1d07c]
/usr/local/osquery-toolchain/usr/bin/clang-8(_ZN5clang7CodeGen13CodeGenModule15GetAddrOfGlobalENS_10GlobalDeclENS0_15ForDefinition_tE+0x56)[0x9bcc34]
/usr/local/osquery-toolchain/usr/bin/clang-8[0xb1389e]
/usr/local/osquery-toolchain/usr/bin/clang-8(_ZN5clang7CodeGen13CodeGenModule20EmitGlobalDefinitionENS_10GlobalDeclEPN4llvm11GlobalValueE+0x18a)[0x9bce4a]
/usr/local/osquery-toolchain/usr/bin/clang-8(_ZN5clang7CodeGen13CodeGenModule12EmitDeferredEv+0xe1)[0x9b722d]
/usr/local/osquery-toolchain/usr/bin/clang-8(_ZN5clang7CodeGen13CodeGenModule12EmitDeferredEv+0x109)[0x9b7255]
/usr/local/osquery-toolchain/usr/bin/clang-8(_ZN5clang7CodeGen13CodeGenModule12EmitDeferredEv+0x109)[0x9b7255]
/usr/local/osquery-toolchain/usr/bin/clang-8(_ZN5clang7CodeGen13CodeGenModule12EmitDeferredEv+0x109)[0x9b7255]
/usr/local/osquery-toolchain/usr/bin/clang-8(_ZN5clang7CodeGen13CodeGenModule12EmitDeferredEv+0x109)[0x9b7255]
/usr/local/osquery-toolchain/usr/bin/clang-8(_ZN5clang7CodeGen13CodeGenModule12EmitDeferredEv+0x109)[0x9b7255]
/usr/local/osquery-toolchain/usr/bin/clang-8(_ZN5clang7CodeGen13CodeGenModule12EmitDeferredEv+0x109)[0x9b7255]
/usr/local/osquery-toolchain/usr/bin/clang-8(_ZN5clang7CodeGen13CodeGenModule12EmitDeferredEv+0x109)[0x9b7255]
/usr/local/osquery-toolchain/usr/bin/clang-8(_ZN5clang7CodeGen13CodeGenModule7ReleaseEv+0x13)[0x9b6783]
/usr/local/osquery-toolchain/usr/bin/clang-8[0xd0da6b]
/usr/local/osquery-toolchain/usr/bin/clang-8[0xd0bf77]
/usr/local/osquery-toolchain/usr/bin/clang-8(_ZN5clang8ParseASTERNS_4SemaEbb+0x1c8)[0x116791b]
/usr/local/osquery-toolchain/usr/bin/clang-8(_ZN5clang14FrontendAction7ExecuteEv+0x48)[0xca2d8e]
/usr/local/osquery-toolchain/usr/bin/clang-8(_ZN5clang16CompilerInstance13ExecuteActionERNS_14FrontendActionE+0x30e)[0xc4599c]
/usr/local/osquery-toolchain/usr/bin/clang-8(_ZN5clang25ExecuteCompilerInvocationEPNS_16CompilerInstanceE+0x5b8)[0xd079df]
/usr/local/osquery-toolchain/usr/bin/clang-8(_Z8cc1_mainN4llvm8ArrayRefIPKcEES2_Pv+0x3bd)[0x93d111]
/usr/local/osquery-toolchain/usr/bin/clang-8(main+0x1e7e)[0x929124]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7)[0x7fa85bc7cb97]
/usr/local/osquery-toolchain/usr/bin/clang-8[0x927029]
clang-8: error: unable to execute command: Aborted (core dumped)
clang-8: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 8.0.1
Target: x86_64-osquery-linux-gnu
Thread model: posix
InstalledDir: /usr/local/osquery-toolchain/usr/bin
clang-8: note: diagnostic msg: PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
clang-8: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-8: note: diagnostic msg: /tmp/EC2Client-8392bf.cpp
clang-8: note: diagnostic msg: /tmp/EC2Client-8392bf.sh
clang-8: note: diagnostic msg:

********************
libs/src/aws-sdk-cpp/CMakeFiles/thirdparty_aws_ec2.dir/build.make:62: recipe for target 'libs/src/aws-sdk-cpp/CMakeFiles/thirdparty_aws_ec2.dir/aws-sdk-cpp_src/aws-cpp-sdk-ec2/source/EC2Client.cpp.o' failed
make[2]: *** [libs/src/aws-sdk-cpp/CMakeFiles/thirdparty_aws_ec2.dir/aws-sdk-cpp_src/aws-cpp-sdk-ec2/source/EC2Client.cpp.o] Error 254
CMakeFiles/Makefile2:4365: recipe for target 'libs/src/aws-sdk-cpp/CMakeFiles/thirdparty_aws_ec2.dir/all' failed
make[1]: *** [libs/src/aws-sdk-cpp/CMakeFiles/thirdparty_aws_ec2.dir/all] Error 2
Makefile:151: recipe for target 'all' failed
make: *** [all] Error 2
llvmbot commented 5 years ago

Contents of EC2Client-8392bf.sh:

# Crash reproducer for clang version 8.0.1
# Driver args: "--driver-mode=g++" "--sysroot=/usr/local/osquery-toolchain" "-D" "AWS_SDK_VERSION_MAJOR=1" "-D" "AWS_SDK_VERSION_MINOR=7" "-D" "AWS_SDK_VERSION_PATCH=161" "-D" "ENABLE_OPENSSL_ENCRYPTION" "-D" "NDEBUG" "-I" "/home/vagrant/installed_formulas/openssl/include" "-I" "/vagrant/libraries/cmake/source_migration/aws-sdk-cpp/aws-sdk-cpp_src/aws-cpp-sdk-core/include/aws/core/external" "-isystem" "/vagrant/libraries/cmake/source_migration/aws-sdk-cpp/aws-sdk-cpp_src/aws-cpp-sdk-ec2/include" "-isystem" "/vagrant/libraries/cmake/source_migration/aws-sdk-cpp/aws-sdk-cpp_src/aws-cpp-sdk-core/include" "-isystem" "/home/vagrant/libs/src/aws-sdk-cpp/aws-cpp-sdk-core/include" "-isystem" "/vagrant/libraries/cmake/source_migration/aws-sdk-cpp/aws-c-event-stream_src/include" "-isystem" "/vagrant/libraries/cmake/source_migration/aws-sdk-cpp/aws-c-common_src/include" "-isystem" "/home/vagrant/libs/src/aws-sdk-cpp/aws-c-common/include" "-isystem" "/vagrant/libraries/cmake/source_migration/aws-sdk-cpp/aws-checksums_src/include" "-O2" "-g" "-D" "NDEBUG" "-fPIC" "-Qunused-arguments" "-Wno-shadow-field" "-Wall" "-Wextra" "-Wno-unused-local-typedef" "-Wno-deprecated-register" "-Wno-unknown-warning-option" "-Wstrict-aliasing" "-Wno-missing-field-initializers" "-Wchar-subscripts" "-Wpointer-arith" "-Wformat" "-Wformat-security" "-Werror=format-security" "-Wuseless-cast" "-Wno-zero-length-array" "-Wno-unused-parameter" "-Wno-gnu-case-range" "-fpermissive" "-fstack-protector-all" "-fdata-sections" "-ffunction-sections" "-fvisibility=hidden" "-fvisibility-inlines-hidden" "-fstandalone-debug" "-pipe" "-pedantic" "-Oz" "-Wno-c++11-extensions" "-Woverloaded-virtual" "-Wnon-virtual-dtor" "-Weffc++" "-g0" "-Wno-everything" "-Wno-all" "-Wno-error" "-std=gnu++14" "-o" "CMakeFiles/thirdparty_aws_ec2.dir/aws-sdk-cpp_src/aws-cpp-sdk-ec2/source/EC2Client.cpp.o" "-c" "/vagrant/libraries/cmake/source_migration/aws-sdk-cpp/aws-sdk-cpp_src/aws-cpp-sdk-ec2/source/EC2Client.cpp"
# Original command:  "/usr/local/osquery-toolchain/usr/bin/clang-8" "-cc1" "-triple" "x86_64-osquery-linux-gnu" "-emit-obj" "-disable-free" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "EC2Client.cpp" "-mrelocation-model" "pic" "-pic-level" "2" "-mthread-model" "posix" "-fmath-errno" "-masm-verbose" "-mconstructor-aliases" "-munwind-tables" "-fuse-init-array" "-target-cpu" "x86-64" "-dwarf-column-info" "-debugger-tuning=gdb" "-momit-leaf-frame-pointer" "-ffunction-sections" "-fdata-sections" "-coverage-notes-file" "/home/vagrant/libs/src/aws-sdk-cpp/CMakeFiles/thirdparty_aws_ec2.dir/aws-sdk-cpp_src/aws-cpp-sdk-ec2/source/EC2Client.cpp.gcno" "-resource-dir" "/usr/local/osquery-toolchain/usr/lib/clang/8.0.1" "-isystem" "/vagrant/libraries/cmake/source_migration/aws-sdk-cpp/aws-sdk-cpp_src/aws-cpp-sdk-ec2/include" "-isystem" "/vagrant/libraries/cmake/source_migration/aws-sdk-cpp/aws-sdk-cpp_src/aws-cpp-sdk-core/include" "-isystem" "/home/vagrant/libs/src/aws-sdk-cpp/aws-cpp-sdk-core/include" "-isystem" "/vagrant/libraries/cmake/source_migration/aws-sdk-cpp/aws-c-event-stream_src/include" "-isystem" "/vagrant/libraries/cmake/source_migration/aws-sdk-cpp/aws-c-common_src/include" "-isystem" "/home/vagrant/libs/src/aws-sdk-cpp/aws-c-common/include" "-isystem" "/vagrant/libraries/cmake/source_migration/aws-sdk-cpp/aws-checksums_src/include" "-D" "AWS_SDK_VERSION_MAJOR=1" "-D" "AWS_SDK_VERSION_MINOR=7" "-D" "AWS_SDK_VERSION_PATCH=161" "-D" "ENABLE_OPENSSL_ENCRYPTION" "-D" "NDEBUG" "-I" "/home/vagrant/installed_formulas/openssl/include" "-I" "/vagrant/libraries/cmake/source_migration/aws-sdk-cpp/aws-sdk-cpp_src/aws-cpp-sdk-core/include/aws/core/external" "-D" "NDEBUG" "-isysroot" "/usr/local/osquery-toolchain" "-internal-isystem" "/usr/local/osquery-toolchain/usr/bin/../include/c++/v1" "-internal-isystem" "/usr/local/osquery-toolchain/usr/local/include" "-internal-isystem" "/usr/local/osquery-toolchain/usr/lib/clang/8.0.1/include" "-internal-externc-isystem" "/usr/local/osquery-toolchain/include" "-internal-externc-isystem" "/usr/local/osquery-toolchain/usr/include" "-Oz" "-Wno-shadow-field" "-Wall" "-Wextra" "-Wno-unused-local-typedef" "-Wno-deprecated-register" "-Wno-unknown-warning-option" "-Wstrict-aliasing" "-Wno-missing-field-initializers" "-Wchar-subscripts" "-Wpointer-arith" "-Wformat" "-Wformat-security" "-Werror=format-security" "-Wuseless-cast" "-Wno-zero-length-array" "-Wno-unused-parameter" "-Wno-gnu-case-range" "-Wno-c++11-extensions" "-Woverloaded-virtual" "-Wnon-virtual-dtor" "-Weffc++" "-Wno-everything" "-Wno-all" "-Wno-error" "-pedantic" "-std=gnu++14" "-fdeprecated-macro" "-fdebug-compilation-dir" "/home/vagrant/libs/src/aws-sdk-cpp" "-ferror-limit" "19" "-fmessage-length" "202" "-fvisibility" "hidden" "-fvisibility-inlines-hidden" "-stack-protector" "3" "-fobjc-runtime=gcc" "-fcxx-exceptions" "-fexceptions" "-fdiagnostics-show-option" "-fcolor-diagnostics" "-vectorize-slp" "-o" "CMakeFiles/thirdparty_aws_ec2.dir/aws-sdk-cpp_src/aws-cpp-sdk-ec2/source/EC2Client.cpp.o" "-x" "c++" "/vagrant/libraries/cmake/source_migration/aws-sdk-cpp/aws-sdk-cpp_src/aws-cpp-sdk-ec2/source/EC2Client.cpp" "-faddrsig"
 "/usr/local/osquery-toolchain/usr/bin/clang-8" "-cc1" "-triple" "x86_64-osquery-linux-gnu" "-emit-obj" "-disable-free" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "EC2Client.cpp" "-mrelocation-model" "pic" "-pic-level" "2" "-mthread-model" "posix" "-fmath-errno" "-masm-verbose" "-mconstructor-aliases" "-munwind-tables" "-fuse-init-array" "-target-cpu" "x86-64" "-dwarf-column-info" "-debugger-tuning=gdb" "-momit-leaf-frame-pointer" "-ffunction-sections" "-fdata-sections" "-coverage-notes-file" "/home/vagrant/libs/src/aws-sdk-cpp/CMakeFiles/thirdparty_aws_ec2.dir/aws-sdk-cpp_src/aws-cpp-sdk-ec2/source/EC2Client.cpp.gcno" "-D" "AWS_SDK_VERSION_MAJOR=1" "-D" "AWS_SDK_VERSION_MINOR=7" "-D" "AWS_SDK_VERSION_PATCH=161" "-D" "ENABLE_OPENSSL_ENCRYPTION" "-D" "NDEBUG" "-D" "NDEBUG" "-Oz" "-Wno-shadow-field" "-Wall" "-Wextra" "-Wno-unused-local-typedef" "-Wno-deprecated-register" "-Wno-unknown-warning-option" "-Wstrict-aliasing" "-Wno-missing-field-initializers" "-Wchar-subscripts" "-Wpointer-arith" "-Wformat" "-Wformat-security" "-Werror=format-security" "-Wuseless-cast" "-Wno-zero-length-array" "-Wno-unused-parameter" "-Wno-gnu-case-range" "-Wno-c++11-extensions" "-Woverloaded-virtual" "-Wnon-virtual-dtor" "-Weffc++" "-Wno-everything" "-Wno-all" "-Wno-error" "-pedantic" "-std=gnu++14" "-fdeprecated-macro" "-ferror-limit" "19" "-fmessage-length" "202" "-fvisibility" "hidden" "-fvisibility-inlines-hidden" "-stack-protector" "3" "-fobjc-runtime=gcc" "-fcxx-exceptions" "-fexceptions" "-fdiagnostics-show-option" "-fcolor-diagnostics" "-vectorize-slp" "-x" "c++" "EC2Client-8392bf.cpp" "-faddrsig"
llvmbot commented 1 year ago

@llvm/issue-subscribers-clang-codegen