Skip to content
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

clang crash when running bazel test --config=fuzzer #1173

Closed
pk19604014 opened this issue Apr 6, 2022 · 1 comment · Fixed by #1340
Closed

clang crash when running bazel test --config=fuzzer #1173

pk19604014 opened this issue Apr 6, 2022 · 1 comment · Fixed by #1340

Comments

@pk19604014
Copy link
Contributor

For example, bazel test --config=fuzzer --test_output=all //common:check_test results in the following output.

...

  1.  <eof> parser at end of file
    
  2.  Code generation
    
  3.  Running pass 'Function Pass Manager' on module 'external/llvm-project/llvm/lib/Support/ARMAttributeParser.cpp'.
    
  4.  Running pass 'Live Variable Analysis' on function '@_ZN4llvm18ARMAttributeParser7handlerEmRb'
    

#0 0x00007f2e49748952 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/local/google/home/pk19604014/.linuxbrew/Cellar/llvm/13.0.1_1/bin/../lib/libLLVM-13.so+0xd65952)
#1 0x00007f2e497466b4 llvm::sys::RunSignalHandlers() (/usr/local/google/home/pk19604014/.linuxbrew/Cellar/llvm/13.0.1_1/bin/../lib/libLLVM-13.so+0xd636b4)
#2 0x00007f2e496820c8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x00007f2e52d94200 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x13200)
#4 0x00007f2e49a366a4 llvm::LiveVariables::HandleVirtRegUse(llvm::Register, llvm::MachineBasicBlock*, llvm::MachineInstr&) (/usr/local/google/home/pk19604014/.linuxbrew/Cellar/llvm/13.0.1_1/bin/../lib/libLLVM-13.so+0x10536a4)
#5 0x00007f2e49a36b8a llvm::LiveVariables::runOnInstr(llvm::MachineInstr&, llvm::SmallVectorImpl&) (/usr/local/google/home/pk19604014/.linuxbrew/Cellar/llvm/13.0.1_1/bin/../lib/libLLVM-13.so+0x1053b8a)
#6 0x00007f2e49a3704b llvm::LiveVariables::runOnBlock(llvm::MachineBasicBlock*, unsigned int) (/usr/local/google/home/pk19604014/.linuxbrew/Cellar/llvm/13.0.1_1/bin/../lib/libLLVM-13.so+0x105404b)
#7 0x00007f2e49a37c53 llvm::LiveVariables::runOnMachineFunction(llvm::MachineFunction&) (/usr/local/google/home/pk19604014/.linuxbrew/Cellar/llvm/13.0.1_1/bin/../lib/libLLVM-13.so+0x1054c53)
#8 0x00007f2e49aa5fc8 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#9 0x00007f2e4986f303 llvm::FPPassManager::runOnFunction(llvm::Function&) (/usr/local/google/home/pk19604014/.linuxbrew/Cellar/llvm/13.0.1_1/bin/../lib/libLLVM-13.so+0xe8c303)
#10 0x00007f2e4986f4f3 llvm::FPPassManager::runOnModule(llvm::Module&) (/usr/local/google/home/pk19604014/.linuxbrew/Cellar/llvm/13.0.1_1/bin/../lib/libLLVM-13.so+0xe8c4f3)
#11 0x00007f2e4986fc34 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/usr/local/google/home/pk19604014/.linuxbrew/Cellar/llvm/13.0.1_1/bin/../lib/libLLVM-13.so+0xe8cc34)
#12 0x00007f2e50e2d484 (anonymous namespace)::EmitAssemblyHelper::EmitAssemblyWithNewPassManager(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_deletellvm::raw_pwrite_stream >) BackendUtil.cpp:0:0
#13 0x00007f2e50e31605 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_deletellvm::raw_pwrite_stream >) (/usr/local/google/home/pk19604014/.linuxbrew/Cellar/llvm/13.0.1_1/bin/../lib/libclang-cpp.so.13+0x1b47605)
#14 0x00007f2e5117a5f3 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/usr/local/google/home/pk19604014/.linuxbrew/Cellar/llvm/13.0.1_1/bin/../lib/libclang-cpp.so.13+0x1e905f3)
#15 0x00007f2e4ffe2355 clang::ParseAST(clang::Sema&, bool, bool) (/usr/local/google/home/pk19604014/.linuxbrew/Cellar/llvm/13.0.1_1/bin/../lib/libclang-cpp.so.13+0xcf8355)
#16 0x00007f2e517fa7b9 clang::FrontendAction::Execute() (/usr/local/google/home/pk19604014/.linuxbrew/Cellar/llvm/13.0.1_1/bin/../lib/libclang-cpp.so.13+0x25107b9)
#17 0x00007f2e5179714f clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/local/google/home/pk19604014/.linuxbrew/Cellar/llvm/13.0.1_1/bin/../lib/libclang-cpp.so.13+0x24ad14f)
#18 0x00007f2e51867464 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/local/google/home/pk19604014/.linuxbrew/Cellar/llvm/13.0.1_1/bin/../lib/libclang-cpp.so.13+0x257d464)
#19 0x0000000000417bb6 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/local/google/home/pk19604014/.linuxbrew/Cellar/llvm/13.0.1_1/bin/clang+++0x417bb6)
#20 0x0000000000415b54 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0
#21 0x00007f2e514b4ef5 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optionalllvm::StringRef >, std::__cxx11::basic_string<char, std::char_traits, std::allocator >, bool) const::'lambda'()>(long) Job.cpp:0:0
#22 0x00007f2e496821c3 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/usr/local/google/home/pk19604014/.linuxbrew/Cellar/llvm/13.0.1_1/bin/../lib/libLLVM-13.so+0xc9f1c3)
#23 0x00007f2e514b6890 clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optionalllvm::StringRef >, std::__cxx11::basic_string<char, std::char_traits, std::allocator >, bool) const (/usr/local/google/home/pk19604014/.linuxbrew/Cellar/llvm/13.0.1_1/bin/../lib/libclang-cpp.so.13+0x21cc890)
#24 0x00007f2e5148a347 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&) const (/usr/local/google/home/pk19604014/.linuxbrew/Cellar/llvm/13.0.1_1/bin/../lib/libclang-cpp.so.13+0x21a0347)
#25 0x00007f2e5148aadd clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const (/usr/local/google/home/pk19604014/.linuxbrew/Cellar/llvm/13.0.1_1/bin/../lib/libclang-cpp.so.13+0x21a0add)
#26 0x00007f2e51497a89 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) (/usr/local/google/home/pk19604014/.linuxbrew/Cellar/llvm/13.0.1_1/bin/../lib/libclang-cpp.so.13+0x21ada89)
#27 0x0000000000412cc3 main (/usr/local/google/home/pk19604014/.linuxbrew/Cellar/llvm/13.0.1_1/bin/clang+++0x412cc3)
#28 0x00007f2e484697fd __libc_start_main ./csu/../csu/libc-start.c:332:16
#29 0x0000000000414349 _start (/usr/local/google/home/pk19604014/.linuxbrew/Cellar/llvm/13.0.1_1/bin/clang+++0x414349)
clang++: error: clang frontend command failed with exit code 139 (use -v to see invocation)
Homebrew clang version 13.0.1
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/google/home/pk19604014/.linuxbrew/Cellar/llvm/13.0.1_1/bin
clang++: note: diagnostic msg:


PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang++: note: diagnostic msg: /tmp/ARMAttributeParser-051ed2.cpp
clang++: note: diagnostic msg: /tmp/ARMAttributeParser-051ed2.sh
clang++: note: diagnostic msg:


Target //common:check_test failed to build

@pk19604014
Copy link
Contributor Author

bazel's per_file_copt can be used to exclude llvm/ sources from fuzzing as a workaround:

bazel test --config=fuzzer --per_file_copt=-llvm/.*@-fno-sanitize=fuzzer --test_output=all toolchain/driver:driver_fuzzer

jonmeow pushed a commit that referenced this issue Jun 21, 2022
Fixes #1173

There is a long standing crash in the LLVM code generator that we manage
to hit when fuzzing. Disable the fast instruction selector in the
fuzzing config to avoid it. I reduced a test case and filed the LLVM bug
here: llvm/llvm-project#56133
chandlerc added a commit that referenced this issue Jun 28, 2022
Fixes #1173

There is a long standing crash in the LLVM code generator that we manage
to hit when fuzzing. Disable the fast instruction selector in the
fuzzing config to avoid it. I reduced a test case and filed the LLVM bug
here: llvm/llvm-project#56133
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant