Bit-Accurate Tracing Analysis for Memory Region Lifetime Tracking

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing debugging technologies are inadequate in detecting non-faulting memory accesses, which are difficult to locate and debug due to their potential to cause intermittent and random execution errors, and current methods either fail to detect all instances or alter program execution states.

Innovation Solution

The application of bit-accurate tracing analysis of time travel traces to track the lifetime of memory regions, enabling the identification of non-faulting, improper memory accesses by replaying prior execution and tracking memory region validity states, thereby pinpointing programming errors that cause these accesses.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Speed

If memory allocation functions reserve contiguous blocks of memory, then memory access efficiency is improved, but protection against out-of-bounds accesses is insufficient

Engineering Contradiction:
Improvememory access efficiencyVSAvoidprotection against out-of-bounds accesses
Core Design Contradiction:
SpeedVSReliability

Solution Approach 1:

The system performs preliminary actions by allocating guard pages before the actual memory allocation and setting up memory protection attributes in advance. This prevents out-of-bounds accesses by having protective measures already in place before the error can occur, rather than detecting it after the fact.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

Guard pages serve as intermediary elements between allocated memory blocks and unauthorized access regions. These intermediate pages act as a buffer that intercepts and detects out-of-bounds memory accesses before they can corrupt adjacent memory regions, thus protecting the integrity of allocated memory.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Difficulty of detecting and measuring

If debugging tools monitor memory accesses in real-time, then detection of improper accesses is improved, but program execution state is altered

Engineering Contradiction:
Improvedetection of improper memory accessesVSAvoidprogram execution state integrity
Core Design Contradiction:
Difficulty of detecting and measuringVSReliability

Solution Approach 1:

The system creates a copy of the original program execution by recording trace events during normal execution. This copy can then be analyzed separately to detect improper memory accesses without affecting the original program's execution state, allowing detection while preserving integrity.

Inventive Principle:
Principle #26Copying

Solution Approach 2:

The system performs preliminary recording of memory access patterns and execution traces before analysis. By capturing the execution state in advance and analyzing it separately, the system can detect errors without interfering with the actual program execution, thus maintaining execution state integrity.

Inventive Principle:
Principle #10Preliminary action

3Difficulty of detecting and measuring

If guard pages are inserted adjacent to allocated buffers, then detection of out-of-bounds reads is improved, but detection of writes beyond allocated buffer is limited

Engineering Contradiction:
Improvedetection of out-of-bounds readsVSAvoiddetection capability for different access types
Core Design Contradiction:
Difficulty of detecting and measuringVSAdaptability or versatility

Solution Approach 1:

The system implements a universal detection mechanism that handles both read and write operations uniformly. By using memory protection attributes and trace analysis that work for all memory access types, the system achieves versatile detection capability across different access patterns without requiring separate mechanisms for reads and writes.

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

Solution Approach 2:

The system uses feedback from recorded trace events to detect various types of improper accesses. By monitoring and analyzing memory access patterns, the system can identify both read and write operations that exceed allocation boundaries, providing comprehensive detection through feedback from the execution trace.

Inventive Principle:
Principle #23Feedback

4Difficulty of detecting and measuring

If pre-filling stack locations with predefined values is performed, then detection of uninitialized value usage is improved, but execution overhead increases

Engineering Contradiction:
Improvedetection of uninitialized value usageVSAvoidexecution overhead
Core Design Contradiction:
Difficulty of detecting and measuringVSProductivity

Solution Approach 1:

Instead of modifying the original execution by pre-filling stack locations, the system creates a copy of the execution trace and analyzes it for uninitialized value usage. This approach detects the error without adding overhead to the actual program execution, separating detection from execution.

Inventive Principle:
Principle #26Copying

Solution Approach 2:

The system performs analysis on a partial representation (the trace) rather than the full execution. By recording only essential events and analyzing them separately, the system achieves error detection without the excessive overhead of comprehensive real-time monitoring or pre-filling of all stack locations.

Inventive Principle:
Principle #16Partial or excessive action

Data Source

PatentEP3721346B1Bit-accurate-tracing analysis with applied memory region lifetimes
Publication Date: 2024.05.22 MICROSOFT TECHNOLOGY LICENSING LLC
  • EP3721346B1 patent drawingFigure 1~2
  • EP3721346B1 patent drawingFigure 3A~4
  • EP3721346B1 patent drawingFigure 5A~5B

AI summary

Detecting and providing notice of non-faulting memory accesses during prior execution of an application based on a replay-able trace of the application's execution. Embodiments include replaying portion(s) of prior execution of the application from a replay-able trace the application's prior execution, while tracking lifetime of memory region(s) used by the application. Based on tracking lifetime of the memory region, non-faulting but improper memory access(es) by the application during its prior execution are detected. Notification of these non-faulting but improper memory access(es) are provided at a user interface and/or to a software component.