Skip to content

Invalid usage of the XADD return value #91888

Closed
@arieleiz

Description

@arieleiz

When building an eBPF program, I get the final error:

fatal error: error in backend: line 37: Invalid usage of the XADD return value
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 -O2 -mcpu=v1 -I./bpftool/src/libbpf/include/ -I./ -D__TARGET_ARCH_x86=1 -target bpfel -c /home/user/ebpf/src2/ebpfcode.c -o /home/user/ebpf/src2/bpf_bpfel.o -fno-ident -fdebug-prefix-map=/home/user/ebpf/src2=. -fdebug-compilation-dir . -g "-D__BPF_TARGET_MISSING=\"GCC error \\\"The eBPF is using target specific macros, please provide -target that is not bpf, bpfel or bpfeb\\\"\"" -MD -MP -MF/tmp/bpf2go1503467571
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module '/home/user/ebpf/src2/ebpfcode.c'.
4.      Running pass 'BPF PreEmit Checking' on function '@next_event_id'
 #0 0x00007f2f77abbe1a llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/lib64/libLLVM-17.so+0x8bbe1a)
 #1 0x00007f2f77ab97a4 llvm::sys::RunSignalHandlers() (/lib64/libLLVM-17.so+0x8b97a4)
 #2 0x00007f2f779f07e2 (/lib64/libLLVM-17.so+0x7f07e2)
 #3 0x00007f2f779f079f (/lib64/libLLVM-17.so+0x7f079f)
 #4 0x00007f2f77ab5c1d (/lib64/libLLVM-17.so+0x8b5c1d)
 #5 0x0000000000412eb7 (/usr/bin/clang-17+0x412eb7)
 #6 0x00007f2f77a02137 llvm::report_fatal_error(llvm::Twine const&, bool) (/lib64/libLLVM-17.so+0x802137)
 #7 0x00007f2f7a9ea9e7 (/lib64/libLLVM-17.so+0x37ea9e7)
 #8 0x00007f2f77ef568c llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/lib64/libLLVM-17.so+0xcf568c)
 #9 0x00007f2f77c325b5 llvm::FPPassManager::runOnFunction(llvm::Function&) (/lib64/libLLVM-17.so+0xa325b5)
#10 0x00007f2f77c39393 llvm::FPPassManager::runOnModule(llvm::Module&) (/lib64/libLLVM-17.so+0xa39393)
#11 0x00007f2f77c32c6a llvm::legacy::PassManagerImpl::run(llvm::Module&) (/lib64/libLLVM-17.so+0xa32c6a)
#12 0x00007f2f7f36e825 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>>) (/lib64/libclang-cpp.so.17+0x1b6e825)
#13 0x00007f2f7f76b048 (/lib64/libclang-cpp.so.17+0x1f6b048)
#14 0x00007f2f7e117526 clang::ParseAST(clang::Sema&, bool, bool) (/lib64/libclang-cpp.so.17+0x917526)
#15 0x00007f2f8032dc86 clang::FrontendAction::Execute() (/lib64/libclang-cpp.so.17+0x2b2dc86)
#16 0x00007f2f8029ae40 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/lib64/libclang-cpp.so.17+0x2a9ae40)
#17 0x00007f2f803ae6d4 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/lib64/libclang-cpp.so.17+0x2bae6d4)
#18 0x0000000000412911 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/bin/clang-17+0x412911)
#19 0x000000000040fd25 (/usr/bin/clang-17+0x40fd25)
#20 0x00007f2f7fed4bfd (/lib64/libclang-cpp.so.17+0x26d4bfd)
#21 0x00007f2f779f0774 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/lib64/libLLVM-17.so+0x7f0774)
#22 0x00007f2f7fed4627 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (/lib64/libclang-cpp.so.17+0x26d4627)
#23 0x00007f2f7fe9afee clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/lib64/libclang-cpp.so.17+0x269afee)
#24 0x00007f2f7fe9b257 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/lib64/libclang-cpp.so.17+0x269b257)
#25 0x00007f2f7feb85da clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/lib64/libclang-cpp.so.17+0x26b85da)
#26 0x000000000040f568 clang_main(int, char**, llvm::ToolContext const&) (/usr/bin/clang-17+0x40f568)
#27 0x000000000041c036 main (/usr/bin/clang-17+0x41c036)
#28 0x00007f2f76a3feb0 __libc_start_call_main (/lib64/libc.so.6+0x3feb0)
#29 0x00007f2f76a3ff60 __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x3ff60)
#30 0x000000000040c425 _start (/usr/bin/clang-17+0x40c425)
Error: can't execute clang: exit status 1

Metadata

Metadata

Assignees

Labels

backend:BPFcrashPrefer [crash-on-valid] or [crash-on-invalid]

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions