Skip to content

[BOLT] Gadget scanner: detect authentication oracles #135663

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: users/atrosinenko/bolt-gs-refactor-target-callbacks
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions bolt/include/bolt/Passes/PAuthGadgetScanner.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,7 @@ namespace PAuthGadgetScanner {
// to distinguish intermediate and final results at the type level.
//
// Here is an overview of issue life-cycle:
// * an analysis (SrcSafetyAnalysis at now, DstSafetyAnalysis will be added
// later to support the detection of authentication oracles) computes register
// * an analysis (SrcSafetyAnalysis or DstSafetyAnalysis) computes register
// state for each instruction in the function.
// * for each instruction, it is checked whether it is a gadget of some kind,
// taking the computed state into account. If a gadget is found, its kind
Expand Down Expand Up @@ -286,6 +285,15 @@ class ClobberingInfo : public ExtraInfo {
void print(raw_ostream &OS, const MCInstReference Location) const override;
};

class LeakageInfo : public ExtraInfo {
SmallVector<MCInstReference> LeakingInstrs;

public:
LeakageInfo(ArrayRef<MCInstReference> Instrs) : LeakingInstrs(Instrs) {}

void print(raw_ostream &OS, const MCInstReference Location) const override;
};

/// A brief version of a report that can be further augmented with the details.
///
/// A half-baked report produced on the first run of the analysis. An extra,
Expand Down Expand Up @@ -326,6 +334,9 @@ class FunctionAnalysisContext {
void findUnsafeUses(SmallVector<PartialReport<MCPhysReg>> &Reports);
void augmentUnsafeUseReports(ArrayRef<PartialReport<MCPhysReg>> Reports);

void findUnsafeDefs(SmallVector<PartialReport<MCPhysReg>> &Reports);
void augmentUnsafeDefReports(ArrayRef<PartialReport<MCPhysReg>> Reports);

/// Process the reports which do not have to be augmented, and remove them
/// from Reports.
void handleSimpleReports(SmallVector<PartialReport<MCPhysReg>> &Reports);
Expand Down
Loading
Loading