Skip to content

Commit 32f9acc

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 fa8766c commit 32f9acc

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
@@ -260,6 +260,15 @@ class ClobberingInfo : public ExtraInfo {
260260
void print(raw_ostream &OS, const MCInstReference Location) const override;
261261
};
262262

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

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

0 commit comments

Comments
 (0)