Issue |
134462
|
Summary |
[EBPF] fatal error: error in backend: Branch target out of insn range
|
Labels |
new issue
|
Assignees |
|
Reporter |
Cryp70m4n
|
```
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 0x00007d5b4881a730 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/libLLVM.so.19.1+0x81a730)
#1 0x00007d5b48817bf5 llvm::sys::CleanupOnSignal(unsigned long) (/usr/lib/libLLVM.so.19.1+0x817bf5)
#2 0x00007d5b4870187a llvm::CrashRecoveryContext::HandleExit(int) (/usr/lib/libLLVM.so.19.1+0x70187a)
#3 0x00007d5b48810766 llvm::sys::Process::Exit(int, bool) (/usr/lib/libLLVM.so.19.1+0x810766)
#4 0x00005837d63081a6 (/usr/bin/clang-19+0xc1a6)
#5 0x00007d5b4871a035 llvm::report_fatal_error(llvm::Twine const&, bool) (/usr/lib/libLLVM.so.19.1+0x71a035)
#6 0x00007d5b4871a1ee (/usr/lib/libLLVM.so.19.1+0x71a1ee)
#7 0x00007d5b4c28ace1 (/usr/lib/libLLVM.so.19.1+0x428ace1)
#8 0x00007d5b4aac5bf9 llvm::MCAssembler::layout() (/usr/lib/libLLVM.so.19.1+0x2ac5bf9)
#9 0x00007d5b4aac5dc5 llvm::MCAssembler::Finish() (/usr/lib/libLLVM.so.19.1+0x2ac5dc5)
#10 0x00007d5b495602aa llvm::AsmPrinter::doFinalization(llvm::Module&) (/usr/lib/libLLVM.so.19.1+0x15602aa)
#11 0x00007d5b489e228d llvm::FPPassManager::doFinalization(llvm::Module&) (/usr/lib/libLLVM.so.19.1+0x9e228d)
#12 0x00007d5b489eeb29 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/usr/lib/libLLVM.so.19.1+0x9eeb29)
#13 0x00007d5b51f36774 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 0x00007d5b522ffb7a clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/usr/lib/libclang-cpp.so.19.1+0x1affb7a)
#15 0x00007d5b50dd9c86 clang::ParseAST(clang::Sema&, bool, bool) (/usr/lib/libclang-cpp.so.19.1+0x5d9c86)
#16 0x00007d5b52afa221 clang::FrontendAction::Execute() (/usr/lib/libclang-cpp.so.19.1+0x22fa221)
#17 0x00007d5b52a9008f clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/lib/libclang-cpp.so.19.1+0x229008f)
#18 0x00007d5b52b54ba5 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/lib/libclang-cpp.so.19.1+0x2354ba5)
#19 0x00005837d630e832 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/bin/clang-19+0x12832)
#20 0x00005837d631304e (/usr/bin/clang-19+0x1704e)
#21 0x00007d5b52764bb5 (/usr/lib/libclang-cpp.so.19.1+0x1f64bb5)
#22 0x00007d5b4870176a llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/usr/lib/libLLVM.so.19.1+0x70176a)
#23 0x00007d5b5276bb76 (/usr/lib/libclang-cpp.so.19.1+0x1f6bb76)
#24 0x00007d5b52722709 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/usr/lib/libclang-cpp.so.19.1+0x1f22709)
#25 0x00007d5b52722afc 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 0x00007d5b52792a64 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 0x00005837d6314d8c clang_main(int, char**, llvm::ToolContext const&) (/usr/bin/clang-19+0x18d8c)
#28 0x00005837d6306f65 main (/usr/bin/clang-19+0xaf65)
#29 0x00007d5b47a35488 (/usr/lib/libc.so.6+0x27488)
#30 0x00007d5b47a3554c __libc_start_main (/usr/lib/libc.so.6+0x2754c)
#31 0x00005837d6306fc5 _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
```
[mon-720352.c.txt](https://github.com/user-attachments/files/19611152/mon-720352.c.txt)
[mon-720352.sh.txt](https://github.com/user-attachments/files/19611153/mon-720352.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
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs