Tag-Based Code Change Detection in Binary Files

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing methods for identifying and locating changed program code are complex and time-consuming, particularly when comparing binary files, which affects accuracy and reliability due to the need for multiple compiler options and potential conflicts.

Innovation Solution

A method involving adding a tag to the function to be changed in the source code, compiling it into a binary file to acquire position and relocation information, and using this information to quickly identify and modify the changed code without comparing pre- and post-compilation source codes.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Measurement precision

If source code analysis and comparison is used to identify changed program code, then the method can detect changes at the source code level, but the process becomes complex and has limitations in identifying final compilation effects

Engineering Contradiction:
Improveidentification accuracyVSAvoididentification complexity
Core Design Contradiction:
Measurement precisionVSDevice complexity

Solution Approach 1:

The patent introduces a special compiler option that acts as an intermediary between source code and binary code. This compiler option embeds position information and relocation information directly into the binary code during compilation, enabling accurate identification of changed functions without complex source code analysis. The compiler option serves as a mediator that preserves function identification capabilities through the compilation process.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Reliability

If binary file comparison is used to identify changed program code, then the final compilation effect can be known, but the process becomes time-consuming and requires multiple compiler options that may conflict

Engineering Contradiction:
Improveidentification reliabilityVSAvoididentification time
Core Design Contradiction:
ReliabilityVSLoss of time

Solution Approach 1:

The patent applies preliminary action by embedding position information and relocation information into the binary code during the compilation process itself. This allows the identification of changed functions to be performed directly on the compiled binary code without requiring time-consuming comparisons with source code or multiple compilation passes. The information is prepared in advance during compilation, enabling fast and reliable identification.

Inventive Principle:
Principle #10Preliminary action

3Loss of information

If multiple compiler options are used for binary file comparison, then comprehensive information can be obtained, but conflicts between options affect the reliability of identification

Engineering Contradiction:
Improveinformation completenessVSAvoididentification reliability
Core Design Contradiction:
Loss of informationVSReliability

Solution Approach 1:

The patent merges multiple information requirements into a single compiler option. Instead of using multiple separate compiler options that may conflict, the invention combines position information and relocation information embedding into one unified compiler option. This eliminates conflicts between options while ensuring that all necessary information is obtained for reliable identification of changed functions.

Inventive Principle:
Principle #5Merging (Combining)

Data Source

PatentUS10019240B2Method and apparatus for detecting code change
Publication Date: 2018.07.10 HUAWEI TECH CO LTD
  • US10019240B2 patent drawing
  • US10019240B2 patent drawing
  • US10019240B2 patent drawing

AI summary

The present disclosure provides a method and an apparatus for detecting a code change. The method includes adding a tag to a function to be changed in a source code, and compiling the source code to acquire, according to the tag, position information and relocation information of the function to be changed in the compiled source code. In embodiments of the present disclosure, a tag is added to a function to be changed, a source code is compiled into a binary file, and position information and relocation information of the function to be changed in the binary file are acquired by using the tag, so that in subsequent operations, a hot patch file modifies, according to the position information and the relocation information, the function to be changed in software.