Use-After-Free Memory Error Root Cause Detection

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Use-after-free (UAF) memory corruption errors are difficult to detect and diagnose due to their non-deterministic nature and the long time gap between memory deallocation and error occurrence, making it challenging to identify the root cause.

Innovation Solution

A system that captures and logs program state information, including call stack and branch trace information, during memory deallocation, allowing for the identification of potential root cause locations by providing detailed program state information when a UAF error is detected, using a memory protection system like MPX to track memory allocations and deallocations and store metadata in a deallocation metadata table.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Measurement precision

If memory deallocation is performed without logging program state information, then memory management efficiency is maintained, but the ability to diagnose use-after-free errors is severely limited

Engineering Contradiction:
Improveerror diagnosis capabilityVSAvoidmemory management system complexity
Core Design Contradiction:
Measurement precisionVSDevice complexity

Solution Approach 1:

The system performs preliminary actions by logging program state information (call stack, branch trace, register state) at the moment of memory deallocation. This preparatory data collection enables later error diagnosis without interfering with normal memory management operations, resolving the contradiction between diagnostic capability and system complexity.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent introduces an intermediary mechanism (memory protection system with logging capability) that sits between the memory management subsystem and the error detection process. This intermediary captures and stores program state information, enabling precise error diagnosis while keeping the core memory management system unchanged and efficient.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Loss of information

If detailed program state information is logged at memory deallocation, then root cause identification of UAF errors is enabled, but system overhead and storage requirements increase

Engineering Contradiction:
Improveprogram state information retentionVSAvoidstored data volume
Core Design Contradiction:
Loss of informationVSQuantity of substance

Solution Approach 1:

The system applies local quality by selectively logging specific program state information (call stack, branch trace, register state) rather than all possible data. This targeted approach retains the essential information needed for UAF error diagnosis while minimizing the overall data volume stored, balancing information retention with storage efficiency.

Inventive Principle:
Principle #3Local quality

3Measurement precision

If the system tracks and logs all memory allocations and deallocations with program state information, then UAF error detection accuracy is improved, but execution performance decreases

Engineering Contradiction:
ImproveUAF error detection accuracyVSAvoidprogram execution speed
Core Design Contradiction:
Measurement precisionVSProductivity

Solution Approach 1:

The memory protection system operates autonomously to log program state information at deallocation points without requiring external intervention or complex coordination. This self-service approach enables accurate UAF error detection while minimizing the overhead burden on the executing program, as the logging is performed automatically as part of the memory management process.

Inventive Principle:
Principle #25Self-service

Data Source

PatentUS10198335B2Detecting root causes of use-after-free memory errors
Publication Date: 2019.02.05 INTEL CORP
  • US10198335B2 patent drawing
  • US10198335B2 patent drawing
  • US10198335B2 patent drawing

AI summary

Methods, systems, and computer programs are presented for detecting the root cause in use-after-free (UAF) memory corruption errors. A method includes an operation for tracking access to memory by a program to detect access to memory not allocated by the program. The method further includes operations for tracking allocations and deallocations of memory by the program, and for storing, in response to detecting a deallocation of memory by the program, at least part of a state of a program stack at a time of the deallocation of memory. Further, the method includes an operation for detecting, after the deallocation, access by the program to the memory associated with the deallocation of memory. In response to the detecting, the state of the program stack is saved in permanent storage at the time of the deallocation.