# US 2021/0081575 A1 · Hybrid mitigation of speculation based attacks based on program behavior

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2021/0081575 A1
- Document ID: US20210081575A1
- Status: Published application
- Kind: A1
- Application number: 16/681,642
- Filed: 2019-11-12
- Published: 2021-03-18
- Earliest claimed: 2019-09-12
- Assignees: Microsoft Technology Licensing, LLC
- Applicants: Microsoft Technology Licensing, LLC
- Inventors: Gururaj Saileshwar; Muntaquim Chowdhury
- Web page: https://patentgrep.com/patent/US20210081575A1

## CPC

- G06F 21/75: by inhibiting the analysis of circuitry or operation
- G06F 8/41: Compilation
- G06F 9/3842: {Speculative instruction execution}
- G06F 17/16: Matrix or vector computation {, e.g. matrix-matrix or matrix-vector multiplication, matrix factorization (matrix transposition G06F7/78)}
- G06F 21/556: {involving covert channels, i.e. data leakage between processes (inhibiting the analysis of circuitry or operation with measures against power attack G06F21/755)}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Apparatus and methods are disclosed for mitigating speculation-based attacks on processors. In one example of the disclosed technology, an apparatus includes a processor having memory situated to store profiler data for measuring at least one performance criteria for an instruction stream executed by the processor and control logic configured to, based on the measure performance criteria, select one of the plurality mitigation schemes to mitigate expectation-based attack on the apparatus. The apparatus can include a remediation unit that can prevent speculative side effects by implementing a delay scheme, a redo scheme, or an undo scheme which prevents side effect data generated by mis-speculated instructions from becoming visible to an attacker.

## Claims

### Claim 1

A method of operating a processor, the method comprising:
profiling an instruction stream for at least one performance criteria; and
based on the performance criteria, selecting one of a plurality of mitigation schemes for a speculation-based attack.

### Claim 2 (depends on 1)

The method of claim 1, wherein the at least one performance criteria varies due to speculative execution.

### Claim 3 (depends on 1)

The method of claim 1, wherein the plurality of mitigation schemes comprises at least one of a delay mechanism, a redo mechanism, or an undo mechanism.

### Claim 4 (depends on 1)

The method of claim 1, wherein the selecting combines hints generated by a compiler or profiler data gathered from previous execution of a program with real-time data measured during execution of a program.

### Claim 5 (depends on 1)

The method of claim 1, wherein:
the at least one performance criteria is based on at least one of: accuracy of branch prediction, a cache hit rate for a cache of the processor, or cache miss rate for a cache of the processor.

### Claim 6 (depends on 1)

The method of claim 1, wherein the selecting is performed by:
measuring the at least one performance criteria when a first one of the mitigation schemes is used when operating the processor;
measuring the at least one performance criteria when a second, different one of the mitigation schemes is used when operating the processor; and
comparing measurements for the at least one performance criteria when a first one of the mitigation schemes is used when operating the processor to measurements for the at least one performance criteria when a second one of the mitigation schemes is used when operating the processor.

### Claim 7 (depends on 1)

The method of claim 1, further comprising selecting a mitigation scheme using a compiler hint inserted in object code that indicates the performance criteria.

### Claim 8 (depends on 1)

The method of claim 1, further comprising:
mitigating a side effect of speculatively executing at least one instruction of the instruction stream using the selected mitigation scheme, the mitigating further comprising at least one of: inhibiting fetch of the speculative operation; inhibiting decode of the speculative operation; inhibiting dispatch of the speculative operation; inhibiting issue of the speculative operation; inhibiting execution of the speculative operation; inhibiting memory access of the speculative operation; inhibiting register writeback of the speculative operation, or inhibiting commitment of the speculative operation.

### Claim 9 (depends on 1)

A computer-readable storage medium storing computer-readable instructions that when executed by a computer, cause the computer to generate a design file for a circuit, the circuit when manufactured using the design file causing the processor to perform the method of claim 1.

### Claim 10

An apparatus implementing a processor, the apparatus comprising:
memory situated to store profiler data for measuring at least one performance criteria for an instruction stream executed by the processor; and
control logic configured to:
based on the measured performance criteria, select one of a plurality of mitigation schemes to mitigate a speculation-based attack on the apparatus.

### Claim 11 (depends on 10)

The apparatus of claim 10, wherein the plurality of mitigation schemes comprises at least one of a delay mechanism, a redo mechanism, or an undo mechanism.

### Claim 12 (depends on 10)

The apparatus of claim 10, wherein:
the profiling and the selecting are performed dynamically during run-time operation of the processor, at least one of the profiling or the selecting being performed using a hardware performance counter of the processor.

### Claim 13 (depends on 10)

The apparatus of claim 10, wherein the apparatus further comprises branch prediction hardware, and wherein the at least one performance criteria relates to branch prediction, and the profiling is performed using at least one of the following branch prediction hardware: a saturating counter, a Lee-Smith counter, a pattern history table, a branch history table, or a global history table with index sharing.

### Claim 14 (depends on 10)

The apparatus of claim 10, further comprising a past behavior counter, wherein the at least one performance criteria is measured with a past behavior counter.

### Claim 15 (depends on 10)

The apparatus of claim 10, wherein the processor comprises a cache, and wherein the at least one performance criteria is based on cache hit rate or cache miss rate for the cache.

### Claim 16 (depends on 10)

The apparatus of claim 10, wherein the control logic comprises a taint matrix, and wherein at least one of the mitigation schemes uses the taint matrix to determine dependencies to mitigate the speculation-based attack.

### Claim 17 (depends on 10)

The apparatus of claim 10, wherein the control logic further comprises:
circuitry configured to clear taint data in the memory to indicate whether the identified speculative operation has resolved;
an execution unit that performs the speculative operation, causing the at least one side effect; and
an execution unit that, based on the cleared taint data, performs the dependent operation.

### Claim 18 (depends on 10)

The apparatus of claim 10, wherein
the control logic comprises a taint matrix, indicating a conditional instruction, which when executed, resolves conditional state of a speculation-source operation, the taint matrix storing data indicating at least two operations dependent upon the identified speculative operation, the taint matrix further storing data indicating that a speculative operation is caused by executing a memory load instruction and the conditional state is determined by executing a branch instruction.

### Claim 19

An apparatus comprising:
means for profiling an instruction stream to be executed by a processor for at least one performance criteria; and
means for selecting one of a plurality of mitigation schemes for a speculation-based attack based on the at least one performance criteria.

### Claim 20 (depends on 19)

The apparatus of claim 19, further comprising at least one of:
means for a delay mechanism;
means for a redo mechanism, or
means for an undo mechanism.
