Looking for breakthrough ideas for innovation challenges? Try Patsnap Eureka!

Kernel fault injection method and electronic device

A technology for fault injection and electronic equipment, applied in the computer field, can solve the problems of prolonged application development cycle and long waiting time for fault injection, and achieve the effect of reducing waiting time, shortening development cycle, and reducing the number of instructions

Active Publication Date: 2016-04-27
HUAWEI TECH CO LTD
View PDF6 Cites 10 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0004] However, the above-mentioned fault injection method in the prior art has the problem that the waiting time for fault injection is relatively long, so that the entire application development cycle is prolonged.

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Kernel fault injection method and electronic device
  • Kernel fault injection method and electronic device
  • Kernel fault injection method and electronic device

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0063] see figure 2 , is a schematic flow diagram of the kernel fault injection method provided in the embodiment of the present application, the flow includes:

[0064] Step 101: When an instruction in the kernel instruction set loaded into the memory is replaced by a breakpoint instruction in the Kprobes structure of the kernel dynamic probe, when the processor executes the breakpoint instruction, it turns to execute the breakpoint in the Kprobes structure The callback function associated with the instruction;

[0065] Step 102: After the processor finishes executing the callback function, it turns to execute the next kernel instruction after the function of the replaced instruction returns.

[0066] For ease of understanding, first introduce the setting of the detection point, that is, the process of replacing the detected kernel instruction with a breakpoint instruction, which is implemented in the registration process of the Kprobes structure. It should be noted that t...

Embodiment 2

[0105] In view of the technical problem in the prior art that there is a lack of injection methods for delay-type faults when kernel functions are called, Embodiment 2 of the present application provides a kernel fault injection method, see Figure 5 , the method includes the following:

[0106] Step 401: When an instruction in the kernel instruction set loaded into the memory is replaced by a breakpoint instruction in the Kprobes structure, when the processor executes the breakpoint instruction, it turns to execute the Kprobes structure associated with the breakpoint instruction The callback function generates a time delay of a set duration, where the set duration is the time parameter included in the callback function;

[0107] Step 402: The processor executes the replaced instruction after generating the set time delay.

[0108] Specifically, in step 401, in the kernel instruction set loaded into the memory, some instructions are replaced by breakpoint instructions when th...

Embodiment approach

[0113] First, when executing the callback function, first record the first time when the processor starts to execute the callback function; after recording the first time, record the time at that time again, and judge whether the time difference between this time and the first time reaches the setting If the duration is reached, it is determined that the time is the second time; otherwise, the above steps are repeated until the second time is determined. Wherein, the operation of recording the current time can be realized by calling the dogettimeofday function.

[0114] Second, when the callback function is executed, a timer will be started, and when the timer reaches the set time, the callback function will be executed. Wherein, the time difference between the set time and the time of starting the timer is the aforementioned set duration.

[0115] Through the above two methods, the purpose of manufacturing the set time delay can be realized quickly and accurately, and it is ...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The invention discloses a kernel fault injection method and an electronic device. The kernel fault injection method is used for solving a technical problem that the latency time for fault injection is long. The kernel fault injection method comprises following steps: when an instruction in a kernel instruction set loaded in a memory is replaced by a breakpoint instruction in a Kprobes (kernel dynamic probes) structure, a processor turns to execute a callback function in the Kprobes structure and related to the breakpoint instruction when the processor executes the breakpoint instruction; and when the processor completes the execution of the callback function, the processor turns to execute a next kernel instruction after a function where the replaced instruction is located returns.

Description

technical field [0001] The invention relates to the field of computers, in particular to a kernel fault injection method and electronic equipment. Background technique [0002] At present, the Linux system is widely used. When developing an application program for the Linux kernel, it is very important to test the effectiveness of the application program's fault-tolerant mechanism for Linux kernel faults. Fault injection in the Linux kernel is an essential link. However, for the sake of ensuring the correctness of the kernel code, the developers of the Linux system are unwilling to add a debugger in the Linux kernel source code tree, so as to avoid developers introducing bad corrections through the debugger in the kernel, so the Linux kernel Doing fault injection has always been a tricky problem. [0003] The appearance of kernel dynamic probe (KernelDynamicProbes, Kprobes) technology effectively solves the problem of kernel fault injection in Linux system, and improves the...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
IPC IPC(8): G06F11/36
Inventor 崔庆明王平王新宇
Owner HUAWEI TECH CO LTD
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Patsnap Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Patsnap Eureka Blog
Learn More
PatSnap group products