Skip to content

Commit 80f7400

Browse files
committed
[GS/Stackclash] Also report function size when a gadget is found.
This helps with more quickly analyzing reports when run over large code bases.
1 parent 4a8e242 commit 80f7400

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

bolt/lib/Passes/StackClashAnalysis.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ void reportFoundGadget(const BinaryContext &BC, const BinaryBasicBlock &BB,
571571
if (SCI.NotAllPagesWritten) {
572572
outs() << "\nGS-STACKCLASH: large SP increase without necessary accesses "
573573
"found in function "
574-
<< BFName;
574+
<< BFName << "(size: " << BF->getSize() << ")";
575575
// outs() << ", at address " << llvm::format("%x", Inst.getAddress()) <<
576576
// "\n";
577577
outs() << "\n";
@@ -588,14 +588,16 @@ void reportFoundGadget(const BinaryContext &BC, const BinaryBasicBlock &BB,
588588
<< "):\n * ";
589589
MCInstInBBReference NextSPInst = MCInstInBBReference::get(&Inst, *BF);
590590
BC.printInstruction(outs(), NextSPInst, NextSPInst.getAddress());
591+
BF->print(outs(), "");
591592
}
592593
if (SCI.NonConstantSPChange) {
593594
outs() << "\nGS-STACKCLASH: non-constant SP change found in function "
594-
<< BFName;
595+
<< BFName << "(size: " << BF->getSize() << ")";
595596
outs() << "\n";
596597
outs() << " instruction ";
597598
BC.printInstruction(outs(), Inst,
598599
MCInstInBBReference::get(&Inst, *BF).getAddress());
600+
BF->print(outs(), "");
599601
}
600602
}
601603

0 commit comments

Comments
 (0)