Online Patch Activation via Middle Segment Jump
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing methods for activating on-line patches in Linux X86 systems are unreliable due to the potential for critical segments of original functions being covered by jump instructions, leading to program abnormalities, especially in multi-thread environments.
Innovation Solution
A method that reserves a middle segment before or after the entry position of each function in the application program, writes a long-jump instruction to this segment, and modifies the entry position instruction to a short-jump instruction, allowing the patch to be activated without covering other instructions in the critical segment, ensuring atomic operation and avoiding reliability issues.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Ease of manufacture
If the jump instruction replaces the instruction at the entry of the original function directly, then the patch activation is simple, but the critical segment of the original function is covered by the jump instruction, causing program abnormalities in multi-thread environments
Solution Approach 1:
The patent divides the instruction replacement process into two distinct segments: (1) writing the long-jump instruction to the middle segment, and (2) modifying the entry position instruction to a short-jump instruction. This segmentation prevents the critical segment from being covered while maintaining patch activation functionality.
Solution Approach 2:
The patent introduces a middle segment as an intermediary storage area between the original function entry and the patch function. The long-jump instruction is written to this middle segment first, then a short-jump instruction is created to redirect execution to the middle segment, which subsequently jumps to the patch function. This intermediary approach avoids direct coverage of the critical segment.
2Reliability
If the Pannus patching technology suspends progress and checks EIP values, then program abnormalities are avoided to a certain extent, but the process is complex and cannot guarantee security and reliability in multi-thread environments
Solution Approach 1:
The patent performs preliminary action by reserving the middle segment before patch activation is needed. The compiler reserves this storage space in advance, so when patch activation occurs, the middle segment is already prepared and ready to receive the long-jump instruction without requiring thread suspension or EIP value checking.
Solution Approach 2:
The patent enables self-service by making the middle segment reservation automatic through the compiler process. The compiler automatically reserves the middle segment for each function, eliminating the need for manual patch activation processes to check thread states or suspend execution. The system serves itself by automatically preparing the necessary storage space.
3Productivity
If multiple instructions at the entry of the original function are covered by the jump instruction, then the patch can be activated, but threads switched during execution of the critical segment will experience program abnormalities
Solution Approach 1:
The patent applies local quality by making the instruction modification local to the entry position only, rather than covering multiple instructions. The short-jump instruction is written to replace only the instruction at the entry position, creating a localized change that redirects execution without affecting other instructions in the critical segment, thus maintaining thread execution reliability.
Data Source
Figure 1~2
Figure 3a~3b
Figure 4~5
AI summary
Embodiments of the present invention provide a method, a device and a system for activating an on-line patch. The method comprises: positioning an address of a patch function and an entry address of a to-be-patched function; writing, in a middle segment, a long-jump instruction for jumping to the patch function based on the address of the patch function and the entry address of the to-be-patched function, wherein the middle segment is a storage space, which is located before or after the entry position of the to-be-patched function and can at least store one long-jump instruction; and modifying an instruction at the entry position of the to-be-patched function to a short-jump instruction for jumping to the middle segment, so as to jump to the middle segment after the short-jump instruction is executed, and then to jump to and execute the patch function through that instructions in the middle segment are executed. The security and reliability for the application software to activate the on-line patch can be improved through the embodiments of the invention.