Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

llc segfaults when run on my .ll file to generate a BPF object #47423

Open Quuxplusone opened 3 years ago

Quuxplusone commented 3 years ago
Bugzilla Link PR48454
Status NEW
Importance P enhancement
Reported by Shaun Crampton (shaun@tigera.io)
Reported on 2020-12-09 03:53:46 -0800
Last modified on 2020-12-11 02:54:27 -0800
Version 11.0
Hardware PC Linux
CC htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also
I was previously using a much older version of clang that was shipped with
debian buster.  I tried upgrading to version 11 from the llvm APT repository
and it segfaults when trying to link my BPF program:

PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash
backtrace.
Stack dump:
0.  Program arguments: llc-11 -march=bpf -filetype=obj -o bin/from_wg_debug.o
from_wg_debug.ll
1.  Running pass 'Function Pass Manager' on module 'from_wg_debug.ll'.
2.  Running pass 'Live Variable Analysis' on function '@tc_calico_entry'
/usr/lib/x86_64-linux-gnu/libLLVM-11.so.1(_ZN4llvm3sys15PrintStackTraceERNS_11raw_ostreamE+0x1f)[0x7f4892e1edff]
/usr/lib/x86_64-linux-gnu/libLLVM-11.so.1(_ZN4llvm3sys17RunSignalHandlersEv+0x50)[0x7f4892e1d170]
/usr/lib/x86_64-linux-gnu/libLLVM-11.so.1(+0xbbb2d5)[0x7f4892e1f2d5]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x12730)[0x7f4892255730]
/usr/lib/x86_64-linux-gnu/libLLVM-11.so.1(_ZN4llvm13LiveVariables16HandleVirtRegUseEjPNS_17MachineBasicBlockERNS_12MachineInstrE+0x6e)[0x7f489309903e]
/usr/lib/x86_64-linux-gnu/libLLVM-11.so.1(_ZN4llvm13LiveVariables10runOnInstrERNS_12MachineInstrERNS_15SmallVectorImplIjEE+0x23e)[0x7f489309b25e]
/usr/lib/x86_64-linux-gnu/libLLVM-11.so.1(_ZN4llvm13LiveVariables10runOnBlockEPNS_17MachineBasicBlockEj+0x266)[0x7f489309b666]
/usr/lib/x86_64-linux-gnu/libLLVM-11.so.1(_ZN4llvm13LiveVariables20runOnMachineFunctionERNS_15MachineFunctionE+0x32f)[0x7f489309bcff]
/usr/lib/x86_64-linux-gnu/libLLVM-11.so.1(_ZN4llvm19MachineFunctionPass13runOnFunctionERNS_8FunctionE+0x10e)[0x7f48930f330e]
/usr/lib/x86_64-linux-gnu/libLLVM-11.so.1(_ZN4llvm13FPPassManager13runOnFunctionERNS_8FunctionE+0x3b9)[0x7f4892f2e7f9]
/usr/lib/x86_64-linux-gnu/libLLVM-11.so.1(_ZN4llvm13FPPassManager11runOnModuleERNS_6ModuleE+0x33)[0x7f4892f33e23]
/usr/lib/x86_64-linux-gnu/libLLVM-11.so.1(_ZN4llvm6legacy15PassManagerImpl3runERNS_6ModuleE+0x3e0)[0x7f4892f2ee10]
llc-11(main+0x2242)[0x40e0f2]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xeb)[0x7f4891d8509b]
llc-11(_start+0x2a)[0x40ba2a]
make: *** [Makefile:90: bin/from_wg_debug.o] Segmentation fault (core dumped)
Quuxplusone commented 3 years ago

The clang command was this:

clang-11 -x c -DKERNEL -DASM_SYSREG_H -DLINUX_BPF_H__ -Wno-unused-value -Wno-pointer-sign -Wno-compare-distinct-pointer-types -Wunused -Wall -Werror -fno-stack-protector -O2 -emit-llvm --include=/usr/src/linux-headers-5.9.0-0.bpo.2-common/include/uapi/linux/bpf.h --include=/usr/src/linux-headers-5.9.0-0.bpo.2-amd64/include/generated/uapi/linux/version.h ./calculate-flags from_wg_debug.ll -c tc.c -o from_wg_debug.ll

The code I'm trying to compile is here: https://github.com/projectcalico/felix/tree/master/bpf-gpl

We do our builds in a docker container, so i had patched that docker container to install the new clang and patched the makefile to use clang-11 and llc-11 instead of clang/llc.

Quuxplusone commented 3 years ago

Same build works with v12.0.0