Skip to content

Commit 7d87a08

Browse files
committed
add pre-aggregated external return fall-through
Created using spr 1.3.4
2 parents 70d7fa7 + b6b8fa3 commit 7d87a08

File tree

1,380 files changed

+63528
-18304
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,380 files changed

+63528
-18304
lines changed

.github/new-prs-labeler.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -777,6 +777,10 @@ backend:NVPTX:
777777
- 'llvm/**/*nvptx*/**'
778778
- 'llvm/**/*NVPTX*/**'
779779

780+
backend:MIPS:
781+
- '**/*mips*'
782+
- '**/*Mips*'
783+
780784
backend:RISC-V:
781785
- clang/**/*riscv*
782786
- clang/**/*RISCV*

.github/workflows/libcxx-restart-preempted-jobs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
with:
3434
script: |
3535
const failure_regex = /Process completed with exit code 1./
36-
const preemption_regex = /The runner has received a shutdown signal/
36+
const preemption_regex = /(The runner has received a shutdown signal)|(The operation was canceled)/
3737
3838
const wf_run = context.payload.workflow_run
3939
core.notice(`Running on "${wf_run.display_title}" by @${wf_run.actor.login} (event: ${wf_run.event})\nWorkflow run URL: ${wf_run.html_url}`)

bolt/include/bolt/Passes/PAuthGadgetScanner.h

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,7 @@ namespace PAuthGadgetScanner {
199199
// to distinguish intermediate and final results at the type level.
200200
//
201201
// Here is an overview of issue life-cycle:
202-
// * an analysis (SrcSafetyAnalysis at now, DstSafetyAnalysis will be added
203-
// later to support the detection of authentication oracles) computes register
202+
// * an analysis (SrcSafetyAnalysis or DstSafetyAnalysis) computes register
204203
// state for each instruction in the function.
205204
// * for each instruction, it is checked whether it is a gadget of some kind,
206205
// taking the computed state into account. If a gadget is found, its kind
@@ -273,6 +272,11 @@ class ExtraInfo {
273272
virtual ~ExtraInfo() {}
274273
};
275274

275+
/// The set of instructions writing to the affected register in an unsafe
276+
/// manner.
277+
///
278+
/// This is a hint to be printed alongside the report. It should be further
279+
/// analyzed by the user.
276280
class ClobberingInfo : public ExtraInfo {
277281
SmallVector<MCInstReference> ClobberingInstrs;
278282

@@ -282,6 +286,20 @@ class ClobberingInfo : public ExtraInfo {
282286
void print(raw_ostream &OS, const MCInstReference Location) const override;
283287
};
284288

289+
/// The set of instructions leaking the authenticated pointer before the
290+
/// result of authentication was checked.
291+
///
292+
/// This is a hint to be printed alongside the report. It should be further
293+
/// analyzed by the user.
294+
class LeakageInfo : public ExtraInfo {
295+
SmallVector<MCInstReference> LeakingInstrs;
296+
297+
public:
298+
LeakageInfo(ArrayRef<MCInstReference> Instrs) : LeakingInstrs(Instrs) {}
299+
300+
void print(raw_ostream &OS, const MCInstReference Location) const override;
301+
};
302+
285303
/// A brief version of a report that can be further augmented with the details.
286304
///
287305
/// A half-baked report produced on the first run of the analysis. An extra,
@@ -322,6 +340,9 @@ class FunctionAnalysisContext {
322340
void findUnsafeUses(SmallVector<PartialReport<MCPhysReg>> &Reports);
323341
void augmentUnsafeUseReports(ArrayRef<PartialReport<MCPhysReg>> Reports);
324342

343+
void findUnsafeDefs(SmallVector<PartialReport<MCPhysReg>> &Reports);
344+
void augmentUnsafeDefReports(ArrayRef<PartialReport<MCPhysReg>> Reports);
345+
325346
/// Process the reports which do not have to be augmented, and remove them
326347
/// from Reports.
327348
void handleSimpleReports(SmallVector<PartialReport<MCPhysReg>> &Reports);

bolt/include/bolt/Profile/DataAggregator.h

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -99,17 +99,17 @@ class DataAggregator : public DataReader {
9999
uint64_t Addr;
100100
};
101101

102-
/// Container for the unit of branch data.
103-
/// Backwards compatible with legacy use for branches and fall-throughs:
104-
/// - if \p Branch is FT_ONLY or FT_EXTERNAL_ORIGIN, the trace only
105-
/// contains fall-through data,
106-
/// - if \p To is BR_ONLY, the trace only contains branch data.
102+
/// Container for the unit of branch data, matching pre-aggregated trace type.
103+
/// Backwards compatible with branch and fall-through types:
104+
/// - if \p To is < 0, the trace only contains branch data (BR_ONLY),
105+
/// - if \p Branch is < 0, the trace only contains fall-through data
106+
/// (FT_ONLY, FT_EXTERNAL_ORIGIN, or FT_EXTERNAL_RETURN).
107107
struct Trace {
108108
static constexpr const uint64_t EXTERNAL = 0ULL;
109109
static constexpr const uint64_t BR_ONLY = -1ULL;
110110
static constexpr const uint64_t FT_ONLY = -1ULL;
111111
static constexpr const uint64_t FT_EXTERNAL_ORIGIN = -2ULL;
112-
static constexpr const uint64_t BR_EXTERNAL_RETURN = -3ULL;
112+
static constexpr const uint64_t FT_EXTERNAL_RETURN = -3ULL;
113113

114114
uint64_t Branch;
115115
uint64_t From;
@@ -391,7 +391,7 @@ class DataAggregator : public DataReader {
391391
/// S <start> <count>
392392
/// [TR] <start> <end> <ft_end> <count>
393393
/// B <start> <end> <count> <mispred_count>
394-
/// [Ff] <start> <end> <count>
394+
/// [Ffr] <start> <end> <count>
395395
///
396396
/// where <start>, <end>, <ft_end> have the format [<id>:]<offset>
397397
///
@@ -402,6 +402,8 @@ class DataAggregator : public DataReader {
402402
/// f - an aggregated fall-through with external origin - used to disambiguate
403403
/// between a return hitting a basic block head and a regular internal
404404
/// jump to the block
405+
/// r - an aggregated fall-through originating at an external return, no
406+
/// checks are performed for a fallthrough start
405407
/// T - an aggregated trace: branch from <start> to <end> with a fall-through
406408
/// to <ft_end>
407409
/// R - an aggregated trace originating at a return
@@ -532,10 +534,12 @@ inline raw_ostream &operator<<(raw_ostream &OS,
532534
const DataAggregator::Trace &T) {
533535
switch (T.Branch) {
534536
case DataAggregator::Trace::FT_ONLY:
537+
break;
535538
case DataAggregator::Trace::FT_EXTERNAL_ORIGIN:
539+
OS << "X:0 -> ";
536540
break;
537-
case DataAggregator::Trace::BR_EXTERNAL_RETURN:
538-
OS << "0 -> ";
541+
case DataAggregator::Trace::FT_EXTERNAL_RETURN:
542+
OS << "X:R -> ";
539543
break;
540544
default:
541545
OS << Twine::utohexstr(T.Branch) << " -> ";

0 commit comments

Comments
 (0)