llvm / llvm/llvm-project

Crash in verifier llvm-as

Open
#186,220 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

crash tools:llvm-as
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

Version is 21.1.0-rc3 (but also on version 20)
Although some versions seemed to work, the most suspicious recent changes are:

  • a [16 x i16] constant is linked as extern uint16_t[] in some C code (pre-compiled with Clang)
  • a [16 x ptr] constant is linked as extern **uint64_t[], each element is a pointer to some constant (private) arrays
  • llvm.experimental.gc.statepoint.p0 has a variety of ids ,but uses i64 0 most of the time, whereas before we only ever used 0

I believe these work without calling opt, but it may be that opt breaks them.

0.	Program arguments: /nix/store/fshzdpaamz1xhakii997bchi0qs89wjz-llvm-21.1.0-rc3/bin/llvm-as test/programs/llvm/nucleic.ll -o test/programs/llvm/nucleic.bc
 #0 0x00007fffeeb41b6b llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/nix/store/z5ysfna7cr35jy7w6v3fmm8j43rxpxch-llvm-21.1.0-rc3-lib/lib/libLLVM.so.21.1-rc3+0xd41b6b)
 #1 0x00007fffeeb3e9fa SignalHandler(int, siginfo_t*, void*) (/nix/store/z5ysfna7cr35jy7w6v3fmm8j43rxpxch-llvm-21.1.0-rc3-lib/lib/libLLVM.so.21.1-rc3+0xd3e9fa)
 #2 0x00007fffed6419c0 __restore_rt (/nix/store/8p33is69mjdw3bi1wmi8v2zpsxir8nwd-glibc-2.40-66/lib/libc.so.6+0x419c0)
 #3 0x00007fffeedf71b8 (anonymous namespace)::Verifier::visitIntrinsicCall(unsigned int, llvm::CallBase&) (/nix/store/z5ysfna7cr35jy7w6v3fmm8j43rxpxch-llvm-21.1.0-rc3-lib/lib/libLLVM.so.21.1-rc3+0xff71b8)
 #4 0x00007fffeee08930 (anonymous namespace)::Verifier::visitCallBase(llvm::CallBase&) (/nix/store/z5ysfna7cr35jy7w6v3fmm8j43rxpxch-llvm-21.1.0-rc3-lib/lib/libLLVM.so.21.1-rc3+0x1008930)
 #5 0x00007fffeee08ed2 (anonymous namespace)::Verifier::visitCallInst(llvm::CallInst&) (/nix/store/z5ysfna7cr35jy7w6v3fmm8j43rxpxch-llvm-21.1.0-rc3-lib/lib/libLLVM.so.21.1-rc3+0x1008ed2)
 #6 0x00007fffeee0c0bb llvm::InstVisitor<(anonymous namespace)::Verifier, void>::visit(llvm::Function&) (.constprop.0) (/nix/store/z5ysfna7cr35jy7w6v3fmm8j43rxpxch-llvm-21.1.0-rc3-lib/lib/libLLVM.so.21.1-rc3+0x100c0bb)
 #7 0x00007fffeee0d891 (anonymous namespace)::Verifier::verify(llvm::Function const&) (.part.0) (/nix/store/z5ysfna7cr35jy7w6v3fmm8j43rxpxch-llvm-21.1.0-rc3-lib/lib/libLLVM.so.21.1-rc3+0x100d891)
 #8 0x00007fffeee0f697 llvm::verifyModule(llvm::Module const&, llvm::raw_ostream*, bool*) (/nix/store/z5ysfna7cr35jy7w6v3fmm8j43rxpxch-llvm-21.1.0-rc3-lib/lib/libLLVM.so.21.1-rc3+0x100f697)
 #9 0x0000000000404cb7 main (/nix/store/fshzdpaamz1xhakii997bchi0qs89wjz-llvm-21.1.0-rc3/bin/llvm-as+0x404cb7)
#10 0x00007fffed62a4d8 __libc_start_call_main (/nix/store/8p33is69mjdw3bi1wmi8v2zpsxir8nwd-glibc-2.40-66/lib/libc.so.6+0x2a4d8)
#11 0x00007fffed62a59b __libc_start_main@GLIBC_2.2.5 (/nix/store/8p33is69mjdw3bi1wmi8v2zpsxir8nwd-glibc-2.40-66/lib/libc.so.6+0x2a59b)
#12 0x0000000000404fe5 _start (/nix/store/fshzdpaamz1xhakii997bchi0qs89wjz-llvm-21.1.0-rc3/bin/llvm-as+0x404fe5)
'/nix/store/fshzdpaamz1xhakii997bchi0qs89wjz-llvm-21.1.0-rc3/bin/llvm-as test/programs/llvm/nucleic.ll -o test/programs/llvm/nucleic.bc' failed

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the crash with llvm-as on test/programs/llvm/nucleic.ll using the command shown. Start at Verifier::visitIntrinsicCall and inspect the llvm.experimental.gc.statepoint.p0 call and the related constants. Done means the reproducer no longer crashes in the verifier and the reported input is handled correctly.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.