Guard Word Stack Corruption Detection
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing computing environments face challenges in detecting and preventing stack corruption, which can lead to unexpected program behavior or malicious code execution due to overwriting of return addresses in call stacks.
Innovation Solution
A computer system is configured to use a guard word placed in the stack frame of a caller routine, which is verified by called routines to detect any corruption, employing architected instructions like Store Guard Word and Verify Guard Word to ensure the integrity of the stack and prevent malicious returns.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If traditional stack execution is used without guard words, then execution speed is fast and overhead is low, but stack corruption detection capability is absent
Solution Approach 1:
The guard word is stored in the stack frame before the called routine executes, establishing a protection mechanism in advance. This preliminary action allows the called routine to later verify the guard word's integrity without adding complex runtime protection logic
Solution Approach 2:
The guard word acts as an intermediary element between the caller and called routine, serving as a verification token that mediates the detection of stack corruption. Instead of directly checking stack integrity through complex mechanisms, the system uses this intermediate guard word value to indicate corruption status
2Reliability
If guard word verification is performed at every routine return, then stack corruption is detected, but execution overhead increases
Solution Approach 1:
The verification mechanism applies local quality checking by examining only the specific guard word value at the particular stack location rather than performing comprehensive stack analysis. This localized verification reduces overhead while maintaining detection capability
Solution Approach 2:
The guard word verification uses a simple, inexpensive comparison operation that can be performed quickly and discarded after use. The verification logic is lightweight and does not require complex or long-lived data structures, enabling frequent checks with minimal performance impact
Data Source
AI summary
Corruption of call stacks is detected by using guard words placed in the call stacks. A store guard word instruction is used to store a guard word on a stack frame of a caller routine, and a verify guard word instruction issued by one or more callee routines is used to verify the guard word is an expected value. If the guard word is an unexpected value, corruption is indicated.


