[all-commits] [llvm/llvm-project] 45260b: Fix use after free error in NVVMReflect (#81471)

Petr via All-commits all-commits at lists.llvm.org
Mon Feb 12 04:50:11 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 45260bf23b802047ab4fd888b8bf2b32e4c5eb69
      https://github.com/llvm/llvm-project/commit/45260bf23b802047ab4fd888b8bf2b32e4c5eb69
  Author: Petr <piter.zh at gmail.com>
  Date:   2024-02-12 (Mon, 12 Feb 2024)

  Changed paths:
    M llvm/lib/Target/NVPTX/NVVMReflect.cpp

  Log Message:
  -----------
  Fix use after free error in NVVMReflect (#81471)

I have a Triton kernel, which triggered a heap-use-after-free error in
LLVM.

The problem was that the same instruction may be added to the
`ToSimplify` array multiple times. If this duplicate instruction is
trivially dead, it gets deleted on the first pass. Then, on the second
pass, the freed instruction is passed.

To fix this, I'm adding the instructions to the `ToRemove` array and
filter it out for duplicates to avoid possible double frees.




More information about the All-commits mailing list