Compiler Code Block Division for Atomic Software Patching
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing information processing systems face challenges in efficiently patching software during operation, particularly when the patch target region's word length is shorter than the relative branch instruction's word length, leading to potential execution failures and non-atomic patch application.
Innovation Solution
The system generates a second code that divides continuous code into blocks of 256 bytes or less, including a reservation region, and uses relative branch instructions to enable branching to the patch area, even when the patch target region is shorter than the relative branch instruction's length, by calculating offsets and inserting relative short branch instructions into reservation regions.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Adaptability or versatility
If the system uses relative branch instructions to patch software during operation, then patching capability is improved, but the patch application becomes non-atomic and may fail when the patch target region's word length is shorter than the relative branch instruction's word length
Solution Approach 1:
The patent divides continuous code into blocks of 256 bytes or less, each containing a reservation region. This segmentation allows the system to manage patch operations at a finer granularity, ensuring that patch applications can be performed atomically within each block without affecting the entire program. The reservation regions serve as dedicated spaces for patch instructions, isolating patch operations from the main code flow.
Solution Approach 2:
The patent pre-calculates offsets and prepares relative short branch instructions during the compilation phase, before the program runs. By preparing the patch infrastructure in advance (reservation regions and offset calculations), the system ensures that when patching is needed during operation, the patch can be applied atomically without runtime computation or complex coordination.
2Reliability
If the system divides continuous code into blocks with reservation regions, then atomic patch application is enabled, but code structure complexity increases
Solution Approach 1:
The patent applies different structures to different parts of the code: most code regions follow the standard block structure with reservation regions, but the actual code content within blocks remains unchanged. This local differentiation allows the system to introduce complexity only where necessary (in the block structure and reservation regions) while leaving the functional code untouched, minimizing the overall impact on code structure.
3Reliability
If the system uses relative short branch instructions in reservation regions, then branching to patch area is enabled without extending beyond memory boundaries, but the instruction length must be precisely controlled
Solution Approach 1:
The patent changes the parameter of branch instruction type from relative branch to relative short branch, which has a fixed and shorter length. By using relative short branch instructions with predetermined lengths, the system can precisely control the instruction size to fit within the 256-byte block boundaries. The offset calculations are adjusted accordingly to account for the shorter instruction length, ensuring that patched code remains within memory boundaries.
Data Source
AI summary
An information processing apparatus includes: a memory configured to store a first code; and a processor configured to compile a source file to generate the first code, wherein the processor: generates a second code, which is executable by the processor, based on a result of analysis of the source program; and divides the second code into blocks of a size equal to or smaller than a given size including a reservation region to generate the first code.


