Introduction
Embedded systems, such as medical devices and smartcards, increasingly handle sensitive data that requires protection via secure, encrypted memories. However, these memories impose a significant "security tax" in the form of increased latency, power consumption, and code bloat due to specialized CPU instructions. Traditional manual data partitioning is error-prone, while securing all data is inefficient. This paper presents a compiler-driven strategy to automate data partitioning, ensuring security while minimizing performance and storage overhead.
Methodology
The proposed framework utilizes three primary techniques to optimize the use of secure memory hierarchies.
Automatic Security Propagation
The process begins with the programmer identifying "seed" data elements as sensitive. The compiler then performs a transitive data-flow analysis to mark all derived values as secure. For complex array accesses within loops, the system employs Presburger formulas and the Omega Library to precisely track which indices require protection.
Loop Iteration Scheduling
A significant source of code bloat in secure systems is the frequent interleaving of secure and non-secure memory access instructions. To mitigate this, the compiler identifies "security patterns"—sequences of secure ('s') and non-secure ('n') accesses within loop iterations.
By clustering iterations with identical or similar security patterns, the compiler can reuse instruction sequences, significantly reducing the binary size. This reordering strategy is crucial for maintaining a manageable code footprint.
Lifetime Analysis
To further optimize the limited secure memory space, the compiler performs a lifetime analysis using linear algebra and loop transformations. This allows the system to reuse secure memory locations for different variables at different times, effectively shrinking the required hardware footprint.
Experimental Evaluation
The approach was evaluated using five data-intensive embedded benchmarks: Med-Im04 (medical imaging), MxM (matrix multiplication), Radar (radar imaging), Shape (pattern recognition), and Track (visual tracking).
Key Results
- Selective Security: The compiler successfully reduced the amount of data requiring secure storage to between 29.6% and 66.9% of total memory.
- Performance Gains: Memory access times were reduced by approximately 60% compared to a baseline where all data is secured.
- Code Size Control: While naive use of security instructions led to a 243% increase in code size, the proposed loop scheduling strategy limited this increase to just 84%.
- Footprint Reduction: Lifetime analysis provided an additional 15.3% reduction in the required capacity for secure memory.
Conclusion
By treating security as a transitive property and leveraging polyhedral optimization techniques, this compiler-based approach effectively bridges the gap between high security and system efficiency. Future work will explore extending these techniques to more general-purpose code structures and explicitly quantifying energy savings in battery-constrained embedded environments.
Summary updated