-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Open
Labels
crashPrefer [crash-on-valid] or [crash-on-invalid]Prefer [crash-on-valid] or [crash-on-invalid]llvm:mcMachine (object) codeMachine (object) code
Description
fatal error: error in backend: Branch target out of insn range
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: clang -O3 -g -target bpf -c src/bpf/mon.bpf.c -o mon.bpf.o
1. <eof> parser at end of file
2. Code generation
#0 0x00007b3b06a1a730 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/libLLVM.so.19.1+0x81a730)
#1 0x00007b3b06a17bf5 llvm::sys::CleanupOnSignal(unsigned long) (/usr/lib/libLLVM.so.19.1+0x817bf5)
#2 0x00007b3b0690187a llvm::CrashRecoveryContext::HandleExit(int) (/usr/lib/libLLVM.so.19.1+0x70187a)
#3 0x00007b3b06a10766 llvm::sys::Process::Exit(int, bool) (/usr/lib/libLLVM.so.19.1+0x810766)
#4 0x00005f34a5caa1a6 (/usr/bin/clang-19+0xc1a6)
#5 0x00007b3b0691a035 llvm::report_fatal_error(llvm::Twine const&, bool) (/usr/lib/libLLVM.so.19.1+0x71a035)
#6 0x00007b3b0691a1ee (/usr/lib/libLLVM.so.19.1+0x71a1ee)
#7 0x00007b3b0a48ace1 (/usr/lib/libLLVM.so.19.1+0x428ace1)
#8 0x00007b3b08cc5bf9 llvm::MCAssembler::layout() (/usr/lib/libLLVM.so.19.1+0x2ac5bf9)
#9 0x00007b3b08cc5dc5 llvm::MCAssembler::Finish() (/usr/lib/libLLVM.so.19.1+0x2ac5dc5)
#10 0x00007b3b077602aa llvm::AsmPrinter::doFinalization(llvm::Module&) (/usr/lib/libLLVM.so.19.1+0x15602aa)
#11 0x00007b3b06be228d llvm::FPPassManager::doFinalization(llvm::Module&) (/usr/lib/libLLVM.so.19.1+0x9e228d)
#12 0x00007b3b06beeb29 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/usr/lib/libLLVM.so.19.1+0x9eeb29)
#13 0x00007b3b10136774 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>, clang::BackendConsumer*) (/usr/lib/libclang-cpp.so.19.1+0x1736774)
#14 0x00007b3b104ffb7a clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/usr/lib/libclang-cpp.so.19.1+0x1affb7a)
#15 0x00007b3b0efd9c86 clang::ParseAST(clang::Sema&, bool, bool) (/usr/lib/libclang-cpp.so.19.1+0x5d9c86)
#16 0x00007b3b10cfa221 clang::FrontendAction::Execute() (/usr/lib/libclang-cpp.so.19.1+0x22fa221)
#17 0x00007b3b10c9008f clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/lib/libclang-cpp.so.19.1+0x229008f)
#18 0x00007b3b10d54ba5 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/lib/libclang-cpp.so.19.1+0x2354ba5)
#19 0x00005f34a5cb0832 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/bin/clang-19+0x12832)
#20 0x00005f34a5cb504e (/usr/bin/clang-19+0x1704e)
#21 0x00007b3b10964bb5 (/usr/lib/libclang-cpp.so.19.1+0x1f64bb5)
#22 0x00007b3b0690176a llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/usr/lib/libLLVM.so.19.1+0x70176a)
#23 0x00007b3b1096bb76 (/usr/lib/libclang-cpp.so.19.1+0x1f6bb76)
#24 0x00007b3b10922709 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/usr/lib/libclang-cpp.so.19.1+0x1f22709)
#25 0x00007b3b10922afc clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/usr/lib/libclang-cpp.so.19.1+0x1f22afc)
#26 0x00007b3b10992a64 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/usr/lib/libclang-cpp.so.19.1+0x1f92a64)
#27 0x00005f34a5cb6d8c clang_main(int, char**, llvm::ToolContext const&) (/usr/bin/clang-19+0x18d8c)
#28 0x00005f34a5ca8f65 main (/usr/bin/clang-19+0xaf65)
#29 0x00007b3b05c35488 (/usr/lib/libc.so.6+0x27488)
#30 0x00007b3b05c3554c __libc_start_main (/usr/lib/libc.so.6+0x2754c)
#31 0x00005f34a5ca8fc5 _start (/usr/bin/clang-19+0xafc5)
clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)
clang version 19.1.7
Target: bpf
Thread model: posix
InstalledDir: /usr/bin
clang: note: diagnostic msg:
mon-0e715b.c.txt
mon-0e715b.sh.txt
The core of the issue are if checks in the main part of the program if you do up to 36 program compiles normally but everything over it will make the compiler yield the error.
if (payload_size == sizeof(PAYLOAD_REQUEST) + 37) {
ret_value = check_request(payload, payload_size, data_end, ip, tcp);
}
if you remove this program will compile normally
3krup
Metadata
Metadata
Assignees
Labels
crashPrefer [crash-on-valid] or [crash-on-invalid]Prefer [crash-on-valid] or [crash-on-invalid]llvm:mcMachine (object) codeMachine (object) code