Branch Prediction State Save and Restore for Side-Channel Mitigation

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Branch prediction circuitry in data processing apparatuses can be exploited by attackers to gain unauthorized access to sensitive information, as branch prediction state from one execution context can be used to mispredict branches in another context, leading to potential security breaches and performance issues during context switches.

Innovation Solution

Implementing a branch state buffer to save and restore active branch prediction state, with compression techniques to reduce storage needs, and controlling branch prediction to prevent predictions based on outdated state, ensuring secure isolation between execution contexts without significant performance loss.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If branch prediction state is shared across execution contexts to improve prediction accuracy, then performance is improved, but security is worsened due to speculative side-channel attacks

Engineering Contradiction:
Improveprediction accuracyVSAvoidsecurity vulnerability
Core Design Contradiction:
ProductivityVSObject-affected harmful factors

Solution Approach 1:

The branch prediction state is segmented into execution context-specific portions. The branch predictor maintains separate state for different execution contexts, allowing accurate predictions within each context while preventing cross-context attacks. This is achieved by associating branch prediction state with execution context identifiers and only allowing predictions when the current context matches the state's associated context.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

An execution context identifier acts as an intermediary between the branch prediction state and the prediction logic. This intermediary ensures that branch outcomes are only predicted based on state from the same execution context, blocking potential side-channel attacks while maintaining prediction accuracy for legitimate branches.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Object-affected harmful factors

If branch prediction state is cleared on context switch to improve security, then security is improved, but performance is worsened due to loss of prediction accuracy

Engineering Contradiction:
ImprovesecurityVSAvoidprediction accuracy
Core Design Contradiction:
Object-affected harmful factorsVSProductivity

Solution Approach 1:

Instead of clearing all branch prediction state globally on context switch, the system applies local quality by clearing only the state associated with the outgoing execution context while preserving state for other contexts. This allows the incoming context to benefit from accurate predictions for its own branches without exposing security vulnerabilities from the previous context's state.

Inventive Principle:
Principle #3Local quality

Solution Approach 2:

The system performs preliminary actions by saving branch prediction state associated with an execution context before the context switch occurs. This saved state can be restored when the context is resumed, ensuring both security (by clearing current state) and performance (by restoring previously trained state).

Inventive Principle:
Principle #10Preliminary action

3Productivity

If branch prediction state is saved and restored to maintain performance during context switches, then productivity is improved, but device complexity is worsened

Engineering Contradiction:
Improveperformance during context switchesVSAvoidbranch prediction control complexity
Core Design Contradiction:
ProductivityVSDevice complexity

Solution Approach 1:

The branch prediction control logic is merged with the execution context management infrastructure. By integrating context identifiers into the existing branch prediction data structures and using existing context switch detection mechanisms, the system reduces overall complexity while enabling save/restore functionality.

Inventive Principle:
Principle #5Merging (Combining)

Solution Approach 2:

The branch prediction state structure is designed to be universal, supporting multiple execution contexts simultaneously. The same data structures and control logic handle both single-context and multi-context scenarios, reducing the need for separate complex mechanisms for each context while maintaining performance.

Inventive Principle:
Principle #6Universality (Multi-functionality)

Data Source

PatentUS10838730B2Saving and restoring branch prediction state
Publication Date: 2020.11.17 ARM LTD
  • US10838730B2 patent drawing
  • US10838730B2 patent drawing
  • US10838730B2 patent drawing

AI summary

A branch predictor is provided with a branch state buffer, branch prediction save circuitry responsive to a branch prediction save event associated with a given execution context to save at least a portion of the active branch prediction state associated with the given execution context to a branch state buffer; and branch prediction restore circuitry responsive to a branch prediction restore event associated with the given execution context to restore active branch prediction state based on previously saved branch prediction state stored in the branch state buffer for the given execution context. This is useful for reducing the performance impact of mitigating against speculative side-channel attacks.