Function Header Hot Patching Without Program Suspension

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing methods to fix defects in programs require suspension, affecting performance and efficiency.

Innovation Solution

A patch execution method that inserts an exception instruction into a function header, modifying it to a jump instruction to access a patch function without restarting the program, allowing threads to be suspended and redirected without kernel dependency.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If the program is suspended to fix the defect, then the defect can be corrected, but the performance and running efficiency of the program are affected

Engineering Contradiction:
Improvedefect correctionVSAvoidprogram execution efficiency
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The patch function is prepared in advance and stored in the patch area before the defect needs to be fixed. The exception instruction is inserted beforehand to enable future redirection. When the defect needs correction, the patch is already ready and can be activated without suspending the running program, thus maintaining execution efficiency while ensuring defect correction.

Inventive Principle:
Principle #10Preliminary action

2Reliability

If the program is restarted to apply the patch, then the defect can be fixed, but the running efficiency and execution efficiency are reduced

Engineering Contradiction:
Improvedefect fixingVSAvoidprogram restart time
Core Design Contradiction:
ReliabilityVSLoss of time

Solution Approach 1:

An intermediate mechanism is introduced: the exception instruction acts as a mediator between the original function and the patch function. When activated, this instruction redirects control flow to the patch area without requiring program restart. This intermediary mechanism enables hot-patching, fixing defects while avoiding the time loss associated with restarting the program.

Inventive Principle:
Principle #24Intermediary (Mediator)

3Ease of operation

If an exception instruction is inserted into the function header, then threads can be suspended and redirected to the patch function, but the complexity of the patching process increases

Engineering Contradiction:
Improvethread redirection capabilityVSAvoidpatching process complexity
Core Design Contradiction:
Ease of operationVSDevice complexity

Solution Approach 1:

The exception handling mechanism is extracted from the normal execution flow and placed in a dedicated patch area. The exception instruction is inserted only at the function header entry point, separating the patching logic from the main program code. This extraction simplifies the overall structure by concentrating patching functionality in a specific location, making the process more manageable despite the added capability.

Inventive Principle:
Principle #2Taking out (Extraction)

4Adaptability or versatility

If the patch function is stored in the patch area with different address, then the original function can be modified, but the address mapping and jump instruction generation become more complex

Engineering Contradiction:
Improvefunction modification capabilityVSAvoidaddress mapping complexity
Core Design Contradiction:
Adaptability or versatilityVSDevice complexity

Solution Approach 1:

The manual address mapping process is replaced with automated calculation. The system automatically computes the offset between the original function address and the patch function address, and generates the appropriate jump instruction with the correct target address. This substitution of automated computation for manual address management reduces the complexity of address mapping while maintaining the ability to modify functions at different addresses.

Inventive Principle:
Principle #28Mechanics substitution (Replace mechanical system)

Data Source

PatentUS20260017053A1Patch execution method and apparatus
Publication Date: 2026.01.15 HUAWEI TECH CO LTD
  • US20260017053A1 patent drawing
  • US20260017053A1 patent drawing
  • US20260017053A1 patent drawing

AI summary

A patch execution method is provided, including: obtaining a first patch function, and storing the first patch function in a patch area, where the first patch function is used to modify a first original function in a program, an address of the first original function is a first address, and an address of the first patch function is a second address; inserting an exception instruction before a first instruction in the first original function, where the exception instruction is used by a thread to suspend execution of an instruction in the first original function after execution advances to the exception instruction; and modifying the exception instruction to a jump instruction based on the first address and the second address, where the jump instruction is used by the thread to jump to the patch area when the first original function is accessed, to execute an instruction in the first patch function.