Linux Kernel Hot Patching via Atomic Instruction Code Modification

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

The traditional 'cold patch' method for addressing kernel and kernel module failures in Linux systems requires system restarts, leading to instability and poor user experience, especially in complex communication scenarios with increasing user demands.

Innovation Solution

A method for implementing Linux kernel hot patching that modifies the header instruction code of patched functions in an atomic operation mode, allowing direct or indirect jumping from the patched function address to the patching function address without system restarts, ensuring stability and improved user experience.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If the traditional 'cold patch' method is used to solve kernel failure, then the kernel problem can be fixed by replacing the kernel or kernel modules, but the system must be restarted which affects user life and work greatly and reduces system stability

Engineering Contradiction:
Improvesystem stabilityVSAvoidsystem restart time
Core Design Contradiction:
ReliabilityVSLoss of time

Solution Approach 1:

The patent applies preliminary action by modifying the header instruction code of the patched function before the patching is activated. The atomic operation mode prepares the patching function in advance by modifying the instruction code to point to the patching function address, so that when the patch is activated, the transition can occur without system restart. This resolves the contradiction by preparing everything needed for the patch to work before actually applying it, avoiding the need for system restart while ensuring kernel reliability.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent introduces an intermediary mechanism through the atomic operation mode that mediates between the original kernel function and the patching function. By modifying the header instruction code to create a controlled transition path, the system can switch from the original function to the patched function without interrupting overall system operation. This intermediary approach allows kernel fixes without full system restart, maintaining stability while reducing downtime.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Reliability

If the system is restarted to replace kernel modules, then the kernel failure can be resolved, but user experience deteriorates due to interruption of life and work

Engineering Contradiction:
Improvekernel reliabilityVSAvoiduser experience
Core Design Contradiction:
ReliabilityVSEase of operation

Solution Approach 1:

The patent prepares the patching function in advance by modifying the header instruction code in atomic operation mode before activation. This preliminary preparation ensures that when the patch is applied, the transition from the original kernel function to the patched function can occur without system restart, thereby maintaining kernel reliability while avoiding disruption to user operations and experience.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent ensures continuity of useful action by enabling kernel patching without system restart. The atomic operation mode modifies the instruction code in a way that maintains continuous system operation, allowing the patched function to be activated while the system remains running. This continuity preserves user experience by avoiding interruptions to life and work while still resolving kernel failures.

Inventive Principle:
Principle #20Continuity of useful action

3Adaptability or versatility

If more kernel driver modules are loaded to handle complex application scenarios, then the system functionality increases, but the problem of kernel failure and kernel module failure increases

Engineering Contradiction:
Improvesystem functionalityVSAvoidkernel stability
Core Design Contradiction:
Adaptability or versatilityVSReliability

Solution Approach 1:

The patent applies segmentation by separating the kernel into original functions and patching functions. Each kernel module or function can be independently patched without affecting the entire kernel system. The atomic operation mode allows individual function modifications while maintaining the integrity of other kernel components. This segmentation enables the system to handle complex scenarios with multiple driver modules while reducing the impact of any single module failure through targeted patching.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent uses parameter changes by modifying the header instruction code parameters of patched functions to point to patching function addresses. This parameter modification approach allows the system to maintain the same kernel structure and functionality while changing the behavior of specific functions through patching. The atomic operation mode ensures these parameter changes are applied consistently, maintaining kernel stability even as functionality increases through additional driver modules.

Inventive Principle:
Principle #35Parameter changes

Data Source

PatentUS11868763B2Method for implementing Linux kernel hot patch, electronic device, and computer readable medium
Publication Date: 2024.01.09 ZTE CORP
  • US11868763B2 patent drawing
  • US11868763B2 patent drawing
  • US11868763B2 patent drawing

AI summary

A method for implementing LINUX kernel hot patch, an electronic device and a computer readable medium, the method includes: modifying header instruction code of a patched function in an atomic operation mode, and jumping directly or indirectly from a patched function address to a patching function address to activate a patching function. The method for implementing LINUX kernel hot patch can achieve the activation of the patching function without restarting the LINUX system.