Runtime Patch Redirection for Restart-Free Defect Fixing

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing programs face defects that require correction without suspending operation, affecting performance and efficiency.

Innovation Solution

A patch execution method and apparatus that inserts an exception instruction into a program function, modifying it to a jump instruction to access a patch function without kernel dependence, allowing patching without restarting.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If the program is suspended to fix the defect, then the defect can be corrected, but performance of the program and running efficiency 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 a patch area before the program runs. The exception instruction is inserted beforehand to enable future patching without program suspension. This preliminary preparation allows defects to be fixed on-demand without affecting program performance during normal operation.

Inventive Principle:
Principle #10Preliminary action

2Adaptability or versatility

If an exception instruction is inserted to suspend threads, then all threads accessing the original function are suspended, but there is no need to trap into an operating system kernel

Engineering Contradiction:
Improvekernel independenceVSAvoidpatching mechanism complexity
Core Design Contradiction:
Adaptability or versatilityVSDevice complexity

Solution Approach 1:

The patent extracts the thread suspension mechanism from the operating system kernel and implements it directly in user space through exception instructions inserted in the program code. This removes dependency on kernel trapping mechanisms and enables patching in environments where kernel access is restricted or unavailable.

Inventive Principle:
Principle #2Taking out (Extraction)

Solution Approach 2:

The exception instruction acts as an intermediary mechanism between the patching system and thread execution. Instead of directly interacting with the operating system kernel to suspend threads, the exception instruction serves as a self-contained mediator that suspends threads locally within the program, eliminating kernel dependency.

Inventive Principle:
Principle #24Intermediary (Mediator)

3Reliability

If the exception instruction is modified to a jump instruction, then threads jump to the patch area to execute the patch function, but the jump distance is limited

Engineering Contradiction:
Improvepatch execution accuracyVSAvoidjump instruction handling
Core Design Contradiction:
ReliabilityVSDevice complexity

Solution Approach 1:

The patent segments the patching process into two parts: a near patch area within jump distance that can be directly accessed, and a far patch area that requires an intermediate trampoline function. This segmentation allows the system to handle both short and long distance patches reliably while managing the limitations of jump instruction distance.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

When the patch area is beyond direct jump distance, the patent introduces a trampoline function as an intermediary. The jump instruction jumps to the trampoline, which then performs another jump to the actual patch area. This intermediary mechanism overcomes the jump distance limitation while maintaining reliable patch execution.

Inventive Principle:
Principle #24Intermediary (Mediator)

Data Source

PatentEP4675423A1Patch execution method and apparatus
Publication Date: 2026.01.07 HUAWEI TECH CO LTD
  • EP4675423A1 patent drawingFigure 1
  • EP4675423A1 patent drawingFigure 2
  • EP4675423A1 patent drawingFigure 3~4(a)

AI summary

This application provides a patch execution method and apparatus. The method includes: 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. In this way, a defect in a to-be-patched original function in a program can be fixed by using a patch function. In addition, the program can be patched without restarting the program, thereby improving program execution efficiency and patching efficiency.