Exceptional Flow Control in Protected Code via Memory Layers
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing methods for exceptional flow control in protected code, such as patching, are incompatible with copy-protected code and can negate memory advantages gained through process cloning, as they modify the original code and disrupt implicit sharing relationships.
Innovation Solution
A system and method that provides exceptional flow control by instantiating a master process in a memory space and cloning it into a child layer, allowing temporary modifications in a separate exception layer or private memory layer without altering the original code, using copy-on-write semantics to maintain memory efficiency and preserve copy protection.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Ease of operation
If code patching is used to implement exceptional flow control, then flow control functionality is achieved, but copy protection is destroyed and memory sharing advantages are negated
Solution Approach 1:
The code is divided into read-only protected segments and writable temporary segments. The exception handling code is placed in separate writable memory regions rather than patching the protected code directly, allowing flow control while preserving copy protection of the original code segments.
Solution Approach 2:
Instead of modifying the original protected code, the system creates copies of exception handling code in writable memory regions. These copies are executed when exceptions occur, while the original protected code remains unchanged and can be shared across processes.
2Productivity
If code patching is used for garbage collection safepoints, then garbage collection efficiency is improved, but process cloning memory advantages are destroyed
Solution Approach 1:
The memory space is segmented into shared read-only code segments and private writable data segments. Garbage collection safepoints are implemented in the writable segments, allowing efficient GC operations while the shared code segments maintain copy-on-write semantics for memory efficiency.
Solution Approach 2:
A separate exception handling layer is introduced as an intermediary between the protected code and the exception handling mechanism. This layer contains the garbage collection safepoints and can be modified without affecting the shared protected code, preserving memory sharing advantages.
Data Source
AI summary
A system and method for providing exceptional flow control in protected code through memory layers. Code is generated. The generated code includes a sequence of normal operations and is subject to protection against copying during execution of the generated code. The generated code is instantiated as a master process into a master layer in a memory space. The master process is cloned by instantiating a copy of the master process as a child layer in the memory space. Execution points within the generated code are identified. A copy of at least a portion of the generated code containing each execution point as an exception layer is instantiated in the memory space. The generated code in the exception layer is patched at each identified execution point with operations exceptional to the normal operations sequence and which are performed upon a triggering of each execution point during execution of the generated code.


