This is an archive of the discontinued LLVM Phabricator instance.

[JITLink][RISCV] Fix use-after-free in relax
ClosedPublic

Authored by jobnoorman on Jul 10 2023, 7:01 AM.

Details

Summary

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.

Diff Detail

Event Timeline

jobnoorman created this revision.Jul 10 2023, 7:01 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 10 2023, 7:01 AM
Herald added subscribers: asb, luke, pmatos and 28 others. · View Herald Transcript
jobnoorman requested review of this revision.Jul 10 2023, 7:01 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 10 2023, 7:01 AM
This revision is now accepted and ready to land.Jul 12 2023, 4:36 AM
This revision was automatically updated to reflect the committed changes.