Memory Tag Auditing for Overrun Detection in C/C++

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Software developers face difficulties in debugging memory management issues such as memory leaks, overruns, and de-allocation errors due to lack of effective tools in programming languages like C and C++, and poor visibility in real-time operating systems like VxWorks, leading to application crashes.

Innovation Solution

A system and method for auditing memory that includes populating a memory tag with a stack depth component and a traceback stack component, determining available memory, and allocating memory units with a data area and footer to detect memory overruns and analyze source of memory problems.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If traditional memory management in C/C++ and real-time operating systems is used, then applications can run with simple memory allocation, but memory management problems such as leaks, overruns, and de-allocation errors occur leading to application crashes

Engineering Contradiction:
Improvememory management reliabilityVSAvoidmemory auditing system complexity
Core Design Contradiction:
ReliabilityVSDevice complexity

Solution Approach 1:

The memory allocation unit is segmented into distinct functional components: a header portion containing metadata (allocation size, timestamp, task ID), a data area for application data, and a footer portion with boundary markers. This segmentation enables targeted auditing of different memory regions without requiring complex global monitoring, thus improving reliability while controlling complexity.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The system performs preliminary actions by populating memory tags with stack depth and traceback stack information at the moment of memory allocation. The footer is pre-filled with boundary marker values before the application writes data. This preliminary population of audit information enables detection of memory problems before they cause crashes, improving reliability without adding runtime complexity.

Inventive Principle:
Principle #10Preliminary action

2Difficulty of detecting and measuring

If memory auditing with traceback stacks is implemented, then the source of memory problems can be analyzed, but the memory structure becomes more complex with additional tags and components

Engineering Contradiction:
Improvememory problem detection capabilityVSAvoidmemory structure complexity
Core Design Contradiction:
Difficulty of detecting and measuringVSDevice complexity

Solution Approach 1:

The system extracts only the essential debugging information needed for memory problem detection: the traceback stack containing return addresses and the stack depth counter. By extracting specifically these elements from the full program state and storing them in compact memory tag structures, the system achieves effective memory problem detection while minimizing the added structural complexity compared to comprehensive process monitoring.

Inventive Principle:
Principle #2Taking out (Extraction)

Solution Approach 2:

The memory tag structure serves as an intermediary between the memory allocation unit and the auditing system. It contains populated fields (stack depth, traceback stack pointer) that mediate between the application's memory usage and the auditor's analysis needs. This intermediary structure simplifies detection capability by providing pre-processed audit information without requiring complex direct interaction between the auditor and application memory state.

Inventive Principle:
Principle #24Intermediary (Mediator)

3Reliability

If footer boundary markers are used to detect overruns, then memory overrun detection is enabled, but each memory allocation unit requires additional space for headers and footers

Engineering Contradiction:
Improvememory overrun detectionVSAvoidmemory overhead
Core Design Contradiction:
ReliabilityVSQuantity of substance

Solution Approach 1:

The system applies local quality by placing footer boundary markers specifically at the end of each allocated memory block, and header information specifically at the beginning. This localized placement of audit structures provides targeted overrun detection exactly where needed (at memory boundaries) without requiring global memory restructuring. The overhead is confined to local header/footer regions rather than affecting the entire memory space.

Inventive Principle:
Principle #3Local quality

Solution Approach 2:

The system changes parameters by using compact fixed-size header and footer structures with defined fields (allocation size, timestamp, task ID in headers; boundary markers in footers). By standardizing these parameter structures and populating them with specific audit information, the overhead becomes predictable and manageable. The parameter changes in the memory structure enable automatic overrun detection through comparison of accessed memory addresses against footer boundary markers.

Inventive Principle:
Principle #35Parameter changes

Data Source

PatentUS7512765B2System and method for auditing memory
Publication Date: 2009.03.31 OL SECURITY LLC
  • US7512765B2 patent drawing
  • US7512765B2 patent drawing
  • US7512765B2 patent drawing

AI summary

According to one embodiment of the invention, a method of auditing memory in a system comprises receiving a request for memory from an application and populating a memory tag with a stack depth component and a traceback stack component. The traceback stack component contains a pointer to a traceback stack. The stack depth component defines a size of the traceback stack. The traceback stack contains information from a program stack associated with the application. The embodiment may further comprise determining if a memory pool has enough free memory to satisfy the request and allocating, from the memory pool, a memory allocation unit if the memory pool has enough free memory to satisfy the request. The memory allocation unit may include a data area and a footer. The data area defines an area to which the application may write data and the footer bounds the data area with a special code.