[all-commits] [llvm/llvm-project] 67f7ef: [JITLink][RISCV] Fix use-after-free in relax

Job Noorman via All-commits all-commits at lists.llvm.org
Thu Jul 13 00:02:39 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 67f7efbbbb047fbeb28159f691962b365008afa4
  Author: Job Noorman <jnoorman at igalia.com>
  Date:   2023-07-13 (Thu, 13 Jul 2023)

  Changed paths:
    M llvm/lib/ExecutionEngine/JITLink/ELF_riscv.cpp

  Log Message:
  [JITLink][RISCV] Fix use-after-free in relax

Finalization of relaxation calls `finalizeBlockRelax` for every block in
the graph. This function, however, would iterate over //all// blocks in
the graph to remove `AlignRelaxable` edges. Since pointers to those
edges would still be stored in `RelaxEdges`, this caused a
use-after-free for graphs with multiple blocks.

This patch fixes this by only iterating over the edges of the current
block in `finalizeBlockRelax`.

Reviewed By: StephenFan

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

More information about the All-commits mailing list