A method for identifying variable-length hidden instructions based on instruction self-association error correction

By using an instruction self-association error correction method, a variable-length instruction space is generated and instruction padding and dual jump configuration are performed to identify and distinguish variable-length hidden instructions in DSP processors. This solves the problem of insufficient analysis of variable-length instructions in DSP processors and improves the efficiency and accuracy of processor security analysis.

CN123116281APending Publication Date: 2026-11-17UNIV OF ELECTRONICS SCI & TECH OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611120164.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-27
Publication Date
2026-11-17

AI Technical Summary

Technical Problem

Existing technologies lack effective methods for analyzing variable-length hidden instructions in DSP processors, making it difficult to prevent potential hazards such as system crashes and functional changes.

Method used

A method based on instruction self-association error correction mechanism is adopted to identify and distinguish variable-length hidden instructions by generating a variable-length instruction space, constructing an instruction bit array, executing program padding and double jump configuration, initializing register values, and analyzing instruction jump states and register value changes.

Benefits of technology

It enables effective differentiation and functional analysis of variable-length hidden instructions in DSP processors, improving the efficiency and accuracy of processor security analysis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123116281A_ABST
    Figure CN123116281A_ABST
Patent Text Reader

Abstract

This invention discloses a method for identifying variable-length hidden instructions based on instruction self-association error correction, belonging to the field of processor hardware security identification. The invention first clarifies the rules of the instruction machine code, generates a variable-length instruction space, and constructs an instruction bit array. Second, it selects and reads the variable-length instruction to be tested from the variable-length instruction space. Then, for the variable-length instruction to be tested, it configures the program for variable-length instruction padding and double jumps in the instruction execution program. Further, it initializes the processor register values ​​and begins executing the variable-length instruction to be tested. Then, it distinguishes between hidden instructions and abnormal instructions by judging whether the instruction to be tested is executable based on the program jump situation. In addition, it distinguishes the instruction length based on the specific jump state after the execution of the hidden instruction. After completing the above distinction steps, it compares the register values ​​after execution with the initial register values ​​to complete functional analysis and identify variable-length hidden instructions. Finally, it compresses the original variable-length instruction space based on the effective length of the identified variable-length instructions. This invention proposes instruction bit stuffing and instruction self-combining jump error correction technology to study the combination mode and inspection process of instruction code, and establishes an automatic detection system for instruction bit width consistency. It performs multiple length splicing and execution verification on the instruction under test, and realizes effective differentiation of instructions with different bit widths.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of processor hardware security identification, and in particular to a variable-length hidden instruction identification method based on instruction self-association error correction. Background Technology

[0002] Instruction set architecture is a core component of processor design, gradually evolving from complex instruction sets to reduced instruction set architectures. In addition to the evolution of architecture, processor instruction-level security analysis has also received increasing attention due to the potential dangers such as system crashes and functional changes caused by hidden instructions.

[0003] Internationally, research has been pioneering in the security analysis of hidden instructions in processors. In 2017, Domas of Intel developed the Sandsifter tool, which combines guided fuzzing with anomaly behavior analysis to systematically traverse the x86 processor instruction space. By gradually adjusting the instruction byte combinations and observing changes in instruction length and anomaly triggering, potential undocumented instructions can be inferred. Building on this, the iScanU tool can scan the processor instruction space in user space and identify potential hidden instructions by comparing execution results with the ISA specification. Furthermore, Strupe et al. used the Armshaker tool to enumerate instruction codes marked "undefined" or "unassigned" in the ISA and, based on execution behavior, determine whether the processor accepts their execution, thus identifying hidden instructions. In 2018, the security team at the Institute of Information Engineering, Chinese Academy of Sciences, proposed a comprehensive testing method for processor security, employing a segmented or batch scanning strategy to reduce the time overhead of instruction space searching to some extent. Subsequently, the security research team at the National Digital Switching System Engineering Technology Research Center proposed the UISFuzz method, introducing fuzzing concepts and constraining the search space based on instruction format characteristics, thereby effectively reducing invalid traversals. Recently, the security research team at Beijing University of Posts and Telecommunications combined instruction length detection and format analysis during the instruction search phase to trim redundant coding space, thereby reducing invalid traversals and improving overall search efficiency.

[0004] The development trends of processor hidden instruction security analysis both domestically and internationally clearly show that research primarily focuses on instruction set architectures such as x86 and ARM, with insufficient analysis of dedicated processors like DSPs. Furthermore, existing research lacks methods for analyzing variable-length hidden instructions in processors. Therefore, there is an urgent need to conduct research on analysis methods for variable-length hidden instructions in DSP processors to provide more comprehensive theoretical and methodological support for processor security research. Summary of the Invention

[0005] The purpose of this invention is to propose a variable-length hidden instruction analysis method based on an instruction self-association error correction mechanism to solve the problems of variable instruction length and ambiguous instruction boundaries in processors, thereby achieving effective differentiation of variable-length instructions in processors and mining and functional analysis of variable-length hidden instructions.

[0006] First, the machine code pattern of the instructions is clarified, a variable-length instruction space is generated, and an instruction bit array is constructed. Second, the variable-length instruction to be tested is selected and read from the variable-length instruction space. Then, for the variable-length instruction to be tested, the program configuration of variable-length instruction padding and double jump is performed in the instruction execution program. Further, the processor register values ​​are initialized, and the variable-length instruction to be tested is executed. Then, the executable status of the instruction to be tested is determined based on the program jump situation to distinguish between hidden instructions and abnormal instructions. In addition, the instruction length is distinguished based on the specific jump state after the execution of the hidden instruction. After completing the above distinction steps, the register values ​​after execution are compared with the initial register values ​​to complete the functional analysis and identify the variable-length hidden instructions. Finally, the original variable-length instruction space is compressed according to the effective length of the identified variable-length instructions.

[0007] The technical solution of this invention is a variable-length hidden instruction recognition method based on instruction self-association error correction, the method comprising:

[0008] Step 1: Generate a variable-length instruction space and construct an instruction bit array;

[0009] By examining the publicly available machine code, the structural composition of the processor's opcode, operands, and immediate values ​​is clarified, generating the variable-length instruction space E to be tested; and an array L of the number of bits in the variable-length instruction fields is constructed.

[0010] (1);

[0011] in, These represent instruction lengths of 8 bits, 16 bits, 24 bits, and 32 bits, respectively.

[0012] Step 2: Read the variable-length instruction to be tested;

[0013] The variable-length instruction space E to be tested is generated as follows:

[0014] (2);

[0015] Where N is the total number of instructions to be tested that generate a variable-length instruction space, and E n The nth instruction to be tested is located in the variable-length instruction space, and the instruction to be tested E is read. n ;

[0016] Step 3: Configure instruction padding and double jump for the variable-length instruction executor;

[0017] Step 4: Initialize register values ​​and execute the variable-length instruction to be tested;

[0018] Initialize the register values ​​in the processor and execute the nth instruction E in the variable-length instruction space E to be tested. n ;

[0019] Step 5: Analyze instruction jumps and abnormal states;

[0020] Based on the instruction jump status, determine whether the instruction can be executed; if an instruction jump has already occurred, it indicates that the instruction can be executed, and record the current instruction to be tested, E. n To hide the instruction, and to change the current test variable-length instruction E n Save to the hidden instruction table; the exact number of fields in the current test instruction cannot be determined solely by the execution status and must be matched in subsequent steps; if the instruction cannot jump and an abnormal program state occurs, it indicates that the instruction cannot run and is saved as an illegal abnormal instruction;

[0021] Step 6: Variable-length instruction length recognition with self-associative error correction;

[0022] When an instruction enters a jump state, the length of the variable-length instruction field is further analyzed and identified by the specific jump address of the instruction execution program.

[0023] Step 7: Compare and analyze the register values, and save the variable-length hidden instructions;

[0024] When the instruction execution program has jumped back to address P, save the current state value of the register and compare and analyze the initial value of the register with the current state value; if the register value changes and has a program execution effect, then record the specific function of the hidden instruction; if the register value does not change and has no program execution effect, then retain the record of the instruction.

[0025] The above steps have been used to determine the hidden instructions and the instruction length of the instruction under test, and the instructions with obvious functions in the hidden instructions have been recorded; these variable-length hidden instructions have been sorted and classified, and hidden instructions have been divided and saved according to different length bits.

[0026] Step 8: Compress the space of the corresponding field;

[0027] Let test instruction E n It has been identified as a hidden instruction, and its instruction length L has been determined through Step 6. j Therefore, E was excluded. n Having the same height L j The instruction to be tested, E, is a bit. n+1 To achieve space compression of the same-position field, update n by incrementing n by 2, indicating that the test of the instruction E with the same high-order bit is skipped. n+1Execute the (n+2)th instruction E in the execution space. n+2 If the instruction to be tested is E n+1 No two of the same height L j If the instruction is bit-wise, then update n by incrementing n by 1, indicating that the (n+1)th instruction E to be tested in the memory space will be executed. n+1 ; until all instructions to be tested have been tested.

[0028] Furthermore, the specific method of Step 3 is as follows:

[0029] Step 3.1: Obtain the variable-length instruction E to be tested n The storage address P;

[0030] Step 3.2: Write jump instruction A at address P and calculate jump address P1; denoted as variable-length jump address, its calculation formula is as follows:

[0031] (3);

[0032] Among them, P op and P A These represent the number of operands and the address space occupied by the jump instruction A, respectively.

[0033] Step 3.3: At the last field of jump instruction A, use the NOP null instruction to pad it to a 64-bit field length;

[0034] Step 3.4: After the jump instruction A, continue to write the jump instruction B to make the program jump to the specified address P2, and record it as the fixed jump address;

[0035] Step 3.5: Write a RET instruction at the variable-length jump address P1 to make the program jump back to the address where the jump instruction B is located, control the pointer to jump back, complete this execution test and continue running the subsequent program; at this point, the program configuration of instruction padding and double jump is completed.

[0036] Furthermore, the specific method of Step 6 is as follows:

[0037] Step 6.1: If the instruction execution program has jumped back to address P, it means that the program has executed the jump instruction A and jumped to the variable-length jump address P1, and at the same time, the RET instruction was executed at address P1 to jump back to address P;

[0038] The variable-length instruction E to be tested n The field length is denoted as L_E n Then L_E n The instruction bit width is consistent with that of the current instruction executor:

[0039] (4);

[0040] At this time, the variable-length instruction E to be tested n That is, L j Hidden instructions of a certain length;

[0041] Step 6.2: If the instruction executor does not jump back to address P and jumps to the specified address P2, it indicates that the variable-length instruction E under test is... n Since the jump instruction A, which has already been padded with a NOP (no-op) instruction, cannot be executed, the instruction execution program continues to run, returning to Step 2 and updating j. Therefore:

[0042] (5).

[0043] Furthermore, the specific method of Step 8 is as follows:

[0044] (6).

[0045] By using a variable-length hidden instruction analysis method based on instruction self-association error correction, we can address the issues of instruction length variation and instruction boundary ambiguity in the TMS320C55x series processors. We propose instruction bit stuffing and instruction self-association jump error correction techniques to study the combination mode and inspection process of instruction code. We have established an automatic instruction bit width consistency detection system to perform multi-length splicing and execution verification on the instruction under test, thereby achieving effective differentiation of instructions with different bit widths. Attached Figure Description

[0046] Figure 1 This is a flowchart of the overall process of the method described in this invention.

[0047] Figure 2 For L j Flowchart of bit-length variable instruction padding and double jump configuration.

[0048] Figure 3 L for self-associative error correction j Flowchart for identifying the length of a variable-length instruction.

[0049] Figure 4 A flowchart for identifying variable-length hidden instructions. Detailed Implementation

[0050] Step 1: Generate a variable-length instruction space and construct an instruction bit array.

[0051] Taking the TMS320C55x series DSP processor as an example, its publicly available instruction set documentation includes instructions with variable-length fields. First, by examining the publicly available instruction machine code, the structural composition of its opcode, operands, and immediate values ​​is clarified, generating the variable-length instruction space E to be tested. Then, an array L representing the number of bits in the variable-length instruction fields is constructed.

[0052] (1);

[0053] in, , , and , representing instruction lengths of 8 bits, 16 bits, 24 bits, and 32 bits, respectively.

[0054] Step 2: Read the variable-length instruction to be tested

[0055] Secondly, the variable-length instruction space E to be tested can be written as follows:

[0056] (2);

[0057] Where N is the total number of instructions to be tested that generate a variable-length instruction space, and E n The nth instruction to be tested is located in the variable-length instruction space, and the instruction to be tested E is read. n .

[0058] Step 3: Variable-length instruction padding and double jump program configuration

[0059] Subsequently, instruction padding and double jump configuration are performed on the variable-length instruction executor. The flowchart for the specific configuration is as follows: Figure 2 As shown. In the program configuration step, the variable-length instruction E to be tested is obtained. n The storage address P is determined; a jump instruction A is written at address P, and the jump address P1 is calculated, denoted as the variable-length jump address. The calculation formula is as follows:

[0060] (3);

[0061] Among them, P op and P A These represent the number of bits operated on by the jump instruction A and the address space it occupies, respectively.

[0062] At the last field of jump instruction A, the NOP instruction is used to pad it to a 64-bit field length. After this, jump instruction B is written after the padded jump instruction A, causing the program to jump to the specified address P2, which is then recorded as a fixed jump address. Finally, a RET instruction is written at the variable-length jump address P1, causing the program to jump back to the address of jump instruction B, the control pointer jumps back, completing this execution test and continuing to run the subsequent program. This completes the program configuration for instruction padding and double jumps.

[0063] Step 4: Initialize register values ​​and execute the variable-length instruction to be tested.

[0064] Initialize the register values ​​in the processor and execute the nth instruction E in the variable-length instruction space E to be tested.n .

[0065] Step 5: Analyze instruction jumps and abnormal states

[0066] Based on the instruction jump status, determine whether the instruction can be executed. If an instruction jump has already occurred, it indicates that the instruction can be executed, and the current instruction to be tested, E, is recorded. n To hide the instruction, and to change the current test variable-length instruction E n Save to the hidden instruction table. The exact number of fields in the current test instruction cannot be determined solely by the execution status; matching is required in subsequent steps. If the instruction cannot jump and an abnormal program state occurs, it indicates that the instruction cannot run and should be saved as an illegal exception instruction.

[0067] Step 6: Variable-length instruction length recognition for self-associative error correction

[0068] When an instruction enters a jump state, the length of the variable-length instruction field is further analyzed and identified by the specific jump address of the instruction execution program. The specific process is as follows: Figure 3 As shown. If the instruction execution program has jumped back to address P, it indicates that the program has executed the jump instruction A and jumped to the variable-length jump address P1, and simultaneously executed the RET instruction at address P1 to jump back to address P. The variable-length instruction E to be tested... n The field length is denoted as L_E n Then L_E n It has the same instruction bit width as the currently executing program, that is:

[0069] (4)

[0070] At this time, the variable-length instruction E to be tested n That is, L j Long hidden instructions.

[0071] If the instruction executor does not jump back to address P and jumps to the specified address P2, it indicates that the variable-length instruction E under test is... n Since the jump instruction A, which has already been padded with a NOP (no-op) instruction, cannot be executed, the instruction execution program continues to run, returning to Step 2 and updating j. Therefore:

[0072] (5);

[0073] Step 7: Compare and analyze register values, and save variable-length hidden instructions.

[0074] When the instruction execution program jumps back to address P, it saves the current state value of the register and compares and analyzes the initial value and the current state value of the register. If the register value changes and has a program execution effect, the specific function of the hidden instruction is recorded, such as modifying the register value; if the register value does not change and has no program execution effect, the instruction is retained and recorded. The specific process for identifying the function of variable-length hidden instructions is as follows: Figure 4 As shown. The above steps have identified hidden instructions and determined their lengths, recording those with explicit functions within the hidden instructions. This next step requires organizing and categorizing these variable-length hidden instructions, classifying them according to their length (number of bits) and saving them.

[0075] Step 8: Compress the space of the same field.

[0076] Assuming the test instruction E n It has been identified as a hidden instruction, and its instruction length L has been determined through Step 6. j Therefore, we exclude E. n Having the same height L j The instruction to be tested, E, is a bit. n+1 To achieve space compression of the same-position field, update n by incrementing n by 2, indicating that the test of the instruction E with the same high-order bit is skipped. n+1 Execute the (n+2)th instruction E in the execution space. n+2 If the instruction to be tested is E n+1 No two of the same height L j If the instruction is bit-wise, then update n by incrementing n by 1, indicating that the (n+1)th instruction E to be tested in the memory space will be executed. n+1 ; until all instructions to be tested have been tested. There are:

[0077] (6);

[0078] This invention was experimentally verified on the TI TMS320C55x series TMS320C5515 eZdsp USB Stick board, which distinguished the variable-length instructions in the target board. Table 1 shows the number of hidden instructions of different lengths mined by the method of this invention.

[0079] Table 1. Hidden Instruction Analysis Results of TMS320C5515

[0080]

Claims

1. A method for identifying variable-length hidden instructions based on instruction self-association error correction, the method comprising: Step 1: Generate a variable-length instruction space and construct an instruction bit array; By examining the publicly available machine code, the structural composition of the processor's opcode, operands, and immediate values ​​is clarified, generating the variable-length instruction space E to be tested; and an array L of the number of bits in the variable-length instruction fields is constructed. (1); in, These represent instruction lengths of 8 bits, 16 bits, 24 bits, and 32 bits, respectively. Step 2: Read the variable-length instruction to be tested; The variable-length instruction space E to be tested is generated as follows: (2); Where N is the total number of instructions to be tested that generate a variable-length instruction space, and E n The nth instruction to be tested is located in the variable-length instruction space, and the instruction to be tested E is read. n ; Step 3: Configure instruction padding and double jump for the variable-length instruction executor; Step 4: Initialize register values ​​and execute the variable-length instruction to be tested; Initialize the register values ​​in the processor and execute the nth instruction E in the variable-length instruction space E to be tested. n ; Step 5: Analyze instruction jumps and abnormal states; Based on the instruction jump status, determine whether the instruction can be executed; if an instruction jump has already occurred, it indicates that the instruction can be executed, and record the current instruction to be tested, E. n To hide the instruction, and to change the current test variable-length instruction E n Save to the hidden instruction table; the exact number of fields in the current test instruction cannot be determined solely by the execution status and must be matched in subsequent steps; if the instruction cannot jump and an abnormal program state occurs, it indicates that the instruction cannot run and is saved as an illegal abnormal instruction; Step 6: Variable-length instruction length recognition with self-associative error correction; When an instruction enters a jump state, the length of the variable-length instruction field is further analyzed and identified by the specific jump address of the instruction execution program. Step 7: Compare and analyze the register values, and save the variable-length hidden instructions; When the instruction execution program has jumped back to address P, save the current state value of the register and compare and analyze the initial value of the register with the current state value; if the register value changes and has a program execution effect, then record the specific function of the hidden instruction; if the register value does not change and has no program execution effect, then retain the record of the instruction. The above steps have been used to determine the hidden instructions and the instruction length of the instruction under test, and the instructions with obvious functions in the hidden instructions have been recorded; these variable-length hidden instructions have been sorted and classified, and hidden instructions have been divided and saved according to different length bits. Step 8: Compress the space of the corresponding field; Let test instruction E n It has been identified as a hidden instruction, and its instruction length L has been determined through Step 6. j Therefore, E was excluded. n Having the same height L j The instruction to be tested, E, is a bit. n+1 To achieve space compression of the same-position field, update n by incrementing n by 2, indicating that the test of the instruction E with the same high-order bit is skipped. n+1 Execute the (n+2)th instruction E in the execution space. n+2 If the instruction to be tested is E n+1 No two of the same height L j If the instruction is bit-wise, then update n by incrementing n by 1, indicating that the (n+1)th instruction E to be tested in the memory space will be executed. n+1 ; until all instructions to be tested have been tested.

2. The variable-length hidden instruction recognition method based on instruction self-association error correction as described in claim 1, characterized in that the specific method of Step 3 is as follows: Step 3.1: Obtain the variable-length instruction E to be tested n The storage address P; Step 3.2: Write jump instruction A at address P and calculate jump address P1; denoted as variable-length jump address, its calculation formula is as follows: (3); in, P op and P A These represent the number of operands and the address space occupied by the jump instruction A, respectively. Step 3.3: At the last field of jump instruction A, use the NOP null instruction to pad it to a 64-bit field length; Step 3.4: After the jump instruction A, continue to write the jump instruction B to make the program jump to the specified address P2, and record it as the fixed jump address; Step 3.5: Write a RET instruction at the variable-length jump address P1 to make the program jump back to the address where the jump instruction B is located, control the pointer to jump back, complete this execution test and continue running the subsequent program; at this point, the program configuration of instruction padding and double jump is completed.

3. The variable-length hidden instruction recognition method based on instruction self-association error correction as described in claim 2, characterized in that the specific method of Step 6 is as follows: Step 6.1: If the instruction execution program has jumped back to address P, it means that the program has executed the jump instruction A and jumped to the variable-length jump address P1, and at the same time, the RET instruction was executed at address P1 to jump back to address P; The variable-length instruction E to be tested n The field length is denoted as L_E n Then L_E n The instruction bit width is consistent with that of the current instruction executor: (4); At this time, the variable-length instruction E to be tested n That is, L j Hidden instructions of a certain length; Step 6.2: If the instruction executor does not jump back to address P and jumps to the specified address P2, it indicates that the variable-length instruction E under test is... n Since the jump instruction A, which has already been padded with a NOP (no-op) instruction, cannot be executed, the instruction execution program continues to run, returning to Step 2 and updating j. Therefore: (5)。 4. The variable-length hidden instruction identification method based on instruction self-association error correction as described in claim 3, characterized in that the specific method of Step 8 is as follows: (6)。