[all-commits] [llvm/llvm-project] b60805: [IR] Fix replaceUsesWithIf ponetial issue with con...

Stanislav Mekhanoshin via All-commits all-commits at lists.llvm.org
Mon Jun 28 15:57:37 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b608053efb88378900d0f08148662e433aa609db
      https://github.com/llvm/llvm-project/commit/b608053efb88378900d0f08148662e433aa609db
  Author: Stanislav Mekhanoshin <Stanislav.Mekhanoshin at amd.com>
  Date:   2021-06-28 (Mon, 28 Jun 2021)

  Changed paths:
    M llvm/lib/IR/Value.cpp

  Log Message:
  -----------
  [IR] Fix replaceUsesWithIf ponetial issue with constants

There can be a use after free in the Value::replaceUsesWithIf()
if two uses point to the same constant. Patch defers handling
of the constants past the iterator scan.

Another potential issue is that handleOperandChange updates all
the uses in a given Constant, not just the one passed to
ShouldReplace. Added a FIXME comment.

Both issues are not currently exploitable as the only use of
this call with constants avoids it.

Differential Revision: https://reviews.llvm.org/D105061




More information about the All-commits mailing list