Skip to content

Commit 7bb423f

Browse files
committed
[BOLT] Gadget scanner: detect authentication oracles
Implement the detection of authentication instructions whose results can be inspected by an attacker to know whether authentication succeeded. As the properties of output registers of authentication instructions are inspected, add a second set of analysis-related classes to iterate over the instructions in reverse order.
1 parent e86dd8f commit 7bb423f

File tree

4 files changed

+1355
-0
lines changed

4 files changed

+1355
-0
lines changed

bolt/include/bolt/Passes/PAuthGadgetScanner.h

+12
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,15 @@ class ClobberingInfo : public ExtraInfo {
261261
void print(raw_ostream &OS, const MCInstReference Location) const override;
262262
};
263263

264+
class LeakageInfo : public ExtraInfo {
265+
SmallVector<MCInstReference> LeakingInstrs;
266+
267+
public:
268+
LeakageInfo(const ArrayRef<MCInstReference> Instrs) : LeakingInstrs(Instrs) {}
269+
270+
void print(raw_ostream &OS, const MCInstReference Location) const override;
271+
};
272+
264273
/// A brief version of a report that can be further augmented with the details.
265274
///
266275
/// It is common for a particular type of gadget detector to be tied to some
@@ -302,6 +311,9 @@ class FunctionAnalysis {
302311
void findUnsafeUses(SmallVector<BriefReport<MCPhysReg>> &Reports);
303312
void augmentUnsafeUseReports(const ArrayRef<BriefReport<MCPhysReg>> Reports);
304313

314+
void findUnsafeDefs(SmallVector<BriefReport<MCPhysReg>> &Reports);
315+
void augmentUnsafeDefReports(const ArrayRef<BriefReport<MCPhysReg>> Reports);
316+
305317
/// Process the reports which do not have to be augmented, and remove them
306318
/// from Reports.
307319
void handleSimpleReports(SmallVector<BriefReport<MCPhysReg>> &Reports);

0 commit comments

Comments
 (0)