Thread-Local Variable Patching Without Process Suspension

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing methods for fixing defects in processes often require suspension, which affects performance and running speed.

Innovation Solution

A patch execution method that invokes thread-local variables in processes and dynamic libraries by using a Global Offset Table (GOT) to update offsets and module IDs, allowing for defect fixes without suspending the process.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

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

Engineering Contradiction:
Improvedefect correctionVSAvoidperformance and running speed
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The patch file is prepared in advance with a GOT structure containing offset and module ID fields. The offset is pre-calculated based on the thread-local variable's position in the dynamic library, and the module ID is pre-set to identify the target dynamic library. This preliminary preparation enables the patch to be applied without suspending the process, as all necessary information is already in place for immediate execution.

Inventive Principle:
Principle #10Preliminary action

2Reliability

If the process is suspended to apply the patch, then the defect can be fixed, but the process execution time is increased

Engineering Contradiction:
Improvedefect fixationVSAvoidprocess execution time
Core Design Contradiction:
ReliabilityVSLoss of time

Solution Approach 1:

The GOT (Global Offset Table) serves as an intermediary structure between the patch file and the thread-local variable in the dynamic library. The GOT contains the offset and module ID that mediate the connection, allowing the patch to locate and modify the thread-local variable without direct process suspension. This intermediary mechanism enables seamless patch application during process execution.

Inventive Principle:
Principle #24Intermediary (Mediator)

3Device complexity

If the patch file directly references the thread-local variable, then the patch can be simple, but it cannot locate variables in dynamic libraries with changing addresses

Engineering Contradiction:
Improvepatch structureVSAvoidvariable location capability
Core Design Contradiction:
Device complexityVSAdaptability or versatility

Solution Approach 1:

The patch file's GOT is segmented into distinct fields: the offset field and the module ID field. This segmentation allows each field to serve a specific function - the offset locates the variable within the dynamic library's address space, while the module ID identifies the target dynamic library. This structured segmentation enables the patch to adapt to dynamic libraries with changing addresses while maintaining a manageable patch structure.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The GOT uses changeable parameters (offset and module ID) that can be updated based on the dynamic library's loading address. When the dynamic library is loaded at a different address, the offset parameter is recalculated to reflect the new position of the thread-local variable, while the module ID parameter identifies the library. This parameter-based approach allows the patch to adapt to address changes without requiring a complete patch redesign.

Inventive Principle:
Principle #35Parameter changes

Data Source

PatentEP4682711A1Patch execution method and apparatus
Publication Date: 2026.01.21 HUAWEI TECH CO LTD
  • EP4682711A1 patent drawingFigure 1
  • EP4682711A1 patent drawingFigure 2
  • EP4682711A1 patent drawingFigure 3A

AI summary

This application provides a patch execution method and apparatus. The method includes: obtaining a patch file, where the patch file is used to fix a defect in a first process, and a first thread-local variable is referenced in the patch file; creating a GOT in the patch file, where the GOT includes a first entry and a second entry; learning that an offset of the first thread-local variable is a first offset and a module ID of a module in which the first thread-local variable is located is a first ID; updating the first offset and the first ID to the GOT to obtain an updated patch file; running the updated patch file and obtaining an address of the first thread-local variable by using a first function, where the first function obtains the address of the first thread-local variable through the first offset and the first ID in the GOT; and invoking the first thread-local variable through the address of the first thread-local variable. Through this method, the patch file can invoke a thread-local variable in a process and a thread-local variable in a dynamic library.