Memory Access Fault Detection via Shadow Memory Tracking
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing memory management tools face challenges in detecting memory access errors such as 'use-after-free' and 'out-of-bounds' errors with high processor and memory overhead, leading to potential data corruption and runtime errors.
Innovation Solution
The implementation of a method that uses non-overlapping memory portions, where one portion tracks the allocation status of another, allowing for efficient detection of improper memory access by applying arithmetic operations to determine if a memory address is allocated for use, and executing error reporting code when necessary, thereby minimizing overhead.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If existing memory management tools are used to detect memory access errors, then detection capability is improved, but processor overhead and memory overhead increase
Solution Approach 1:
The memory space is divided into two non-overlapping portions: a first portion for application program use and a second portion for tracking allocation status. This segmentation allows independent management of application data and allocation tracking, enabling efficient error detection without requiring complex centralized memory management structures.
Solution Approach 2:
The second portion of memory acts as an intermediary tracking structure that stores allocation status information for addresses in the first portion. By using this intermediate tracking mechanism, the system can detect improper memory access through simple arithmetic operations and value comparisons, avoiding the need for complex detection algorithms.
2Reliability
If comprehensive memory tracking is implemented to prevent data corruption, then reliability is improved, but processor overhead increases
Solution Approach 1:
Allocation status values are pre-stored in the second portion of memory at locations corresponding to potential memory addresses. This preliminary preparation allows the detection mechanism to simply retrieve and compare values during runtime, rather than performing complex analysis, thereby reducing processor overhead while maintaining comprehensive tracking.
Solution Approach 2:
The system creates a simplified copy of allocation status information in the second memory portion, which mirrors the allocation state of the first memory portion. This copy mechanism enables efficient verification of memory access validity through straightforward address transformation and value comparison, minimizing processor intervention.
Data Source
AI summary
Detecting a fault in the operation of a computer having a processor and a memory is taught. Instrumentation code is placed within an application program during compilation, and runtime library routines are modified to support detection of invalid memory accesses. Memory space is divided into application, shadow and unmapped memories. When accessing application memory at an original address, an address in shadow memory is computed by shifting the address and adding an offset. If the value stored at the shadow address indicates that the original address is invalid (e.g., not allocated or already freed), then error reporting code is executed that indicates the type of error and the location and optionally halts the computer. Invalid memory references to heap, stack and global objects in application memory can be detected.


