Hardware Metadata Retrieval for Legacy Code Type Safety

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing memory safety techniques, such as ARM's PAC, MTE, and Intel's MPX, are inefficient and impose significant memory overhead, failing to effectively enforce type safety and perform memory bound checks without modifying pointer sizes, which leads to incompatibility with legacy code.

Innovation Solution

A hardware-supported metadata retrieval system that uses a metadata retrieval hardware module to efficiently retrieve object metadata, allowing for fast memory bound checks without undue memory overhead, and is compatible with legacy code by not altering pointer sizes.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If software-based memory safety checks are implemented, then type safety can be enforced, but the checking speed becomes very slow

Engineering Contradiction:
Improvetype safety enforcementVSAvoidchecking speed
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The patent replaces software-based memory safety checks with hardware-based checks. The processor includes dedicated hardware modules (metadata retrieval module, bound checking module) that perform type safety verification and memory bound checks in hardware circuitry rather than through software execution, thereby dramatically improving checking speed while maintaining reliability

Inventive Principle:
Principle #28Mechanics substitution (Replace mechanical system)

Solution Approach 2:

The patent introduces object metadata as an intermediary data structure that stores type information and memory bounds. This metadata acts as a mediator between the pointer and the actual object, allowing the hardware to perform efficient type verification and bound checking by retrieving and comparing metadata information rather than performing complex software-based type analysis

Inventive Principle:
Principle #24Intermediary (Mediator)

2Reliability

If shadow memory is used to tag each memory chunk and pointer, then type safety can be verified, but the memory overhead scales with both the size of physical memory and the cache

Engineering Contradiction:
Improvetype safety verificationVSAvoidmemory overhead
Core Design Contradiction:
ReliabilityVSQuantity of substance

Solution Approach 1:

The patent extracts the type information and memory bounds from the object itself and stores them separately in a compact metadata structure. This allows the main object memory to remain unchanged while only the metadata (which is much smaller and can be shared) stores the safety information, thereby reducing the overall memory overhead compared to duplicating type information in every memory chunk

Inventive Principle:
Principle #2Taking out (Extraction)

Solution Approach 2:

The patent creates a shared metadata pool where a single metadata entry can serve multiple objects of the same type. Instead of having separate type information for each individual object or memory chunk, the metadata structure provides universal type verification for multiple objects, thereby reducing redundant memory overhead while maintaining comprehensive type safety verification

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

3Reliability

If pointer size is modified to include type information (fat-pointer techniques), then type safety can be enforced, but incompatibility with legacy code occurs and code assumptions about pointer size are broken

Engineering Contradiction:
Improvetype safety enforcementVSAvoidcompatibility with legacy code
Core Design Contradiction:
ReliabilityVSAdaptability or versatility

Solution Approach 1:

The patent segments the type information from the pointer itself, storing it in separate metadata structures. The pointer retains its original size and format for compatibility with legacy code, while the metadata (retrieved via offset from the pointer) contains the type information needed for safety verification. This separation allows type safety enforcement without modifying pointer semantics or breaking legacy code assumptions

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent uses metadata as an intermediary that bridges the gap between legacy pointers and type safety requirements. The metadata structure, accessed through an offset from the original pointer, provides type information without requiring modification of the pointer itself. This intermediary approach maintains backward compatibility while enabling modern type-safe memory access patterns

Inventive Principle:
Principle #24Intermediary (Mediator)

Data Source

PatentUS11200158B1Methods, devices, and media for hardware-supported object metadata retrieval
Publication Date: 2021.12.14 HUAWEI TECH CANADA CO LTD
  • US11200158B1 patent drawing
  • US11200158B1 patent drawing
  • US11200158B1 patent drawing

AI summary

Methods and devices for hardware-supported schemes for efficient metadata retrieval are described. The schemes may use hardware to efficiently enforce type safety and speed up memory bound checks without imposing undue memory overhead. Multiple such schemes may be supported by a device, permitting the selection of an optimal scheme based on a given memory allocation request. The schemes may be compatible with legacy code and applicable to a wide range of data objects and system constraints. Compilation, instrumentation, and linking of code to effect such schemes is also described.