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

[bug] [x86_64] [ubuntu22.04] clang crash when compiling to bpf #90697

Open
kohshi54 opened this issue May 1, 2024 · 1 comment
Open

[bug] [x86_64] [ubuntu22.04] clang crash when compiling to bpf #90697

kohshi54 opened this issue May 1, 2024 · 1 comment
Labels
backend:BPF clang:codegen crash Prefer [crash-on-valid] or [crash-on-invalid]

Comments

@kohshi54
Copy link

kohshi54 commented May 1, 2024

Hello. clang crashed with exit code 139 when trying to compile to bpf bytecode.
Stack dump:

0.	Program arguments: clang -v -target bpf -I/usr/include/x86_64-linux-gnu -I/usr/src/linux-hwe-6.5-headers-6.5.0-28/include/ -g -c hello.bpf.c
1.	<eof> parser at end of file
 #0 0x00007b4db023fd01 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0xe3fd01)
 #1 0x00007b4db023da3e llvm::sys::RunSignalHandlers() (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0xe3da3e)
 #2 0x00007b4db023f0ab llvm::sys::CleanupOnSignal(unsigned long) (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0xe3f0ab)
 #3 0x00007b4db016bdff (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0xd6bdff)
 #4 0x00007b4daec42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #5 0x00007b4db6c257ce clang::ASTContext::getASTRecordLayout(clang::RecordDecl const*) const (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0xe257ce)
 #6 0x00007b4db68e5f0c clang::ASTContext::getTypeInfoImpl(clang::Type const*) const (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0xae5f0c)
 #7 0x00007b4db68e6d96 clang::ASTContext::getTypeInfo(clang::Type const*) const (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0xae6d96)
 #8 0x00007b4db68e5e2e clang::ASTContext::getTypeInfoImpl(clang::Type const*) const (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0xae5e2e)
 #9 0x00007b4db68e6d96 clang::ASTContext::getTypeInfo(clang::Type const*) const (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0xae6d96)
#10 0x00007b4db68e6a59 clang::ASTContext::getTypeInfoInChars(clang::QualType) const (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0xae6a59)
#11 0x00007b4db6c30d64 (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0xe30d64)
#12 0x00007b4db6c2d316 (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0xe2d316)
#13 0x00007b4db6c25bd9 clang::ASTContext::getASTRecordLayout(clang::RecordDecl const*) const (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0xe25bd9)
#14 0x00007b4db791bcd3 clang::CodeGen::CodeGenTypes::ComputeRecordLayout(clang::RecordDecl const*, llvm::StructType*) (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x1b1bcd3)
#15 0x00007b4db7a07472 clang::CodeGen::CodeGenTypes::ConvertRecordDeclType(clang::RecordDecl const*) (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x1c07472)
#16 0x00007b4db7a06554 clang::CodeGen::CodeGenTypes::ConvertType(clang::QualType) (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x1c06554)
#17 0x00007b4db7a0646f clang::CodeGen::CodeGenTypes::ConvertTypeForMem(clang::QualType, bool) (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x1c0646f)
#18 0x00007b4db7a0698c clang::CodeGen::CodeGenTypes::ConvertType(clang::QualType) (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x1c0698c)
#19 0x00007b4db7a0646f clang::CodeGen::CodeGenTypes::ConvertTypeForMem(clang::QualType, bool) (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x1c0646f)
#20 0x00007b4db7920390 (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x1b20390)
#21 0x00007b4db791cddf (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x1b1cddf)
#22 0x00007b4db791bd88 clang::CodeGen::CodeGenTypes::ComputeRecordLayout(clang::RecordDecl const*, llvm::StructType*) (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x1b1bd88)
#23 0x00007b4db7a07472 clang::CodeGen::CodeGenTypes::ConvertRecordDeclType(clang::RecordDecl const*) (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x1c07472)
#24 0x00007b4db7a06554 clang::CodeGen::CodeGenTypes::ConvertType(clang::QualType) (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x1c06554)
#25 0x00007b4db7a0646f clang::CodeGen::CodeGenTypes::ConvertTypeForMem(clang::QualType, bool) (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x1c0646f)
#26 0x00007b4db79a521c clang::CodeGen::CodeGenModule::EmitExternalVarDeclaration(clang::VarDecl const*) (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x1ba521c)
#27 0x00007b4db6f1e962 clang::Sema::ActOnEndOfTranslationUnit() (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x111e962)
#28 0x00007b4db68c1c86 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool) (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0xac1c86)
#29 0x00007b4db68048dd clang::ParseAST(clang::Sema&, bool, bool) (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0xa048dd)
#30 0x00007b4db7978b71 clang::CodeGenAction::ExecuteAction() (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x1b78b71)
#31 0x00007b4db8314b57 clang::FrontendAction::Execute() (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x2514b57)
#32 0x00007b4db826c3a6 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x246c3a6)
#33 0x00007b4db838e45b clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x258e45b)
#34 0x000000000041328b cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/lib/llvm-14/bin/clang+0x41328b)
#35 0x00000000004114bc (/usr/lib/llvm-14/bin/clang+0x4114bc)
#36 0x00007b4db7eeaed2 (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x20eaed2)
#37 0x00007b4db016bb6d llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0xd6bb6d)
#38 0x00007b4db7eea9c0 clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, bool*) const (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x20ea9c0)
#39 0x00007b4db7eb5183 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&) const (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x20b5183)
#40 0x00007b4db7eb540a clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x20b540a)
#41 0x00007b4db7ecf507 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x20cf507)
#42 0x0000000000410f26 main (/usr/lib/llvm-14/bin/clang+0x410f26)
#43 0x00007b4daec29d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#44 0x00007b4daec29e40 call_init ./csu/../csu/libc-start.c:128:20
#45 0x00007b4daec29e40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#46 0x000000000040e3b5 _start (/usr/lib/llvm-14/bin/clang+0x40e3b5)
clang: error: clang frontend command failed with exit code 139 (use -v to see invocation)
Ubuntu clang version 14.0.0-1ubuntu1.1
Target: bpf
Thread model: posix
InstalledDir: /usr/bin
clang: note: diagnostic msg: Error generating preprocessed source(s).
@github-actions github-actions bot added the clang Clang issues not falling into any other category label May 1, 2024
@EugeneZelenko EugeneZelenko added clang:codegen crash Prefer [crash-on-valid] or [crash-on-invalid] and removed clang Clang issues not falling into any other category labels May 1, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented May 1, 2024

@llvm/issue-subscribers-clang-codegen

Author: Kohshi.Y (kohshi54)

Hello. clang crashed with exit code 139 when trying to compile to bpf bytecode. Stack dump: 0. Program arguments: clang -v -target bpf -I/usr/include/x86_64-linux-gnu -I/usr/src/linux-hwe-6.5-headers-6.5.0-28/include/ -g -c hello.bpf.c 1. <eof> parser at end of file #0 0x00007b4db023fd01 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0xe3fd01) #1 0x00007b4db023da3e llvm::sys::RunSignalHandlers() (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0xe3da3e) #2 0x00007b4db023f0ab llvm::sys::CleanupOnSignal(unsigned long) (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0xe3f0ab) #3 0x00007b4db016bdff (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0xd6bdff) #4 0x00007b4daec42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520) #5 0x00007b4db6c257ce clang::ASTContext::getASTRecordLayout(clang::RecordDecl const*) const (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0xe257ce) #6 0x00007b4db68e5f0c clang::ASTContext::getTypeInfoImpl(clang::Type const*) const (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0xae5f0c) #7 0x00007b4db68e6d96 clang::ASTContext::getTypeInfo(clang::Type const*) const (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0xae6d96) #8 0x00007b4db68e5e2e clang::ASTContext::getTypeInfoImpl(clang::Type const*) const (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0xae5e2e) #9 0x00007b4db68e6d96 clang::ASTContext::getTypeInfo(clang::Type const*) const (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0xae6d96) #10 0x00007b4db68e6a59 clang::ASTContext::getTypeInfoInChars(clang::QualType) const (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0xae6a59) #11 0x00007b4db6c30d64 (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0xe30d64) #12 0x00007b4db6c2d316 (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0xe2d316) #13 0x00007b4db6c25bd9 clang::ASTContext::getASTRecordLayout(clang::RecordDecl const*) const (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0xe25bd9) #14 0x00007b4db791bcd3 clang::CodeGen::CodeGenTypes::ComputeRecordLayout(clang::RecordDecl const*, llvm::StructType*) (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x1b1bcd3) #15 0x00007b4db7a07472 clang::CodeGen::CodeGenTypes::ConvertRecordDeclType(clang::RecordDecl const*) (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x1c07472) #16 0x00007b4db7a06554 clang::CodeGen::CodeGenTypes::ConvertType(clang::QualType) (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x1c06554) #17 0x00007b4db7a0646f clang::CodeGen::CodeGenTypes::ConvertTypeForMem(clang::QualType, bool) (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x1c0646f) #18 0x00007b4db7a0698c clang::CodeGen::CodeGenTypes::ConvertType(clang::QualType) (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x1c0698c) #19 0x00007b4db7a0646f clang::CodeGen::CodeGenTypes::ConvertTypeForMem(clang::QualType, bool) (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x1c0646f) #20 0x00007b4db7920390 (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x1b20390) #21 0x00007b4db791cddf (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x1b1cddf) #22 0x00007b4db791bd88 clang::CodeGen::CodeGenTypes::ComputeRecordLayout(clang::RecordDecl const*, llvm::StructType*) (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x1b1bd88) #23 0x00007b4db7a07472 clang::CodeGen::CodeGenTypes::ConvertRecordDeclType(clang::RecordDecl const*) (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x1c07472) #24 0x00007b4db7a06554 clang::CodeGen::CodeGenTypes::ConvertType(clang::QualType) (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x1c06554) #25 0x00007b4db7a0646f clang::CodeGen::CodeGenTypes::ConvertTypeForMem(clang::QualType, bool) (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x1c0646f) #26 0x00007b4db79a521c clang::CodeGen::CodeGenModule::EmitExternalVarDeclaration(clang::VarDecl const*) (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x1ba521c) #27 0x00007b4db6f1e962 clang::Sema::ActOnEndOfTranslationUnit() (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x111e962) #28 0x00007b4db68c1c86 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool) (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0xac1c86) #29 0x00007b4db68048dd clang::ParseAST(clang::Sema&, bool, bool) (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0xa048dd) #30 0x00007b4db7978b71 clang::CodeGenAction::ExecuteAction() (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x1b78b71) #31 0x00007b4db8314b57 clang::FrontendAction::Execute() (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x2514b57) #32 0x00007b4db826c3a6 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x246c3a6) #33 0x00007b4db838e45b clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x258e45b) #34 0x000000000041328b cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/lib/llvm-14/bin/clang+0x41328b) #35 0x00000000004114bc (/usr/lib/llvm-14/bin/clang+0x4114bc) #36 0x00007b4db7eeaed2 (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x20eaed2) #37 0x00007b4db016bb6d llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0xd6bb6d) #38 0x00007b4db7eea9c0 clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, bool*) const (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x20ea9c0) #39 0x00007b4db7eb5183 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&) const (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x20b5183) #40 0x00007b4db7eb540a clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x20b540a) #41 0x00007b4db7ecf507 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x20cf507) #42 0x0000000000410f26 main (/usr/lib/llvm-14/bin/clang+0x410f26) #43 0x00007b4daec29d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16 #44 0x00007b4daec29e40 call_init ./csu/../csu/libc-start.c:128:20 #45 0x00007b4daec29e40 __libc_start_main ./csu/../csu/libc-start.c:379:5 #46 0x000000000040e3b5 _start (/usr/lib/llvm-14/bin/clang+0x40e3b5) clang: error: clang frontend command failed with exit code 139 (use -v to see invocation) Ubuntu clang version 14.0.0-1ubuntu1.1 Target: bpf Thread model: posix InstalledDir: /usr/bin clang: note: diagnostic msg: Error generating preprocessed source(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:BPF clang:codegen crash Prefer [crash-on-valid] or [crash-on-invalid]
Projects
None yet
Development

No branches or pull requests

4 participants