Error injection method and device, computer equipment and storage medium
By acquiring and utilizing the preset detection capabilities of PCIE devices, targeted tampering with packets for error injection, the problems of low efficiency and poor targeting in traditional methods are solved, and more efficient and targeted error injection detection is achieved.
Patent Information
- Application Number
- CN202411833382.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-12
- Publication Date
- 2025-04-08
AI Technical Summary
The traditional error injection detection method is low in efficiency and the error injection is poorly targeted, so it is impossible to effectively test the error handling mechanism of PCIE devices.
By obtaining the preset detection capability of the target device, it detects whether the first message carried by the message request is a preset message type. If so, based on the target policy corresponding to the target error type, the first message is tampered with the second message and the second message is sent to the target device to achieve targeted error injection.
It improves the efficiency and targetedness of error injection, avoids the situation of multiple attempts of error injection, and ensures that the target device uses the expected error packets during read and write operations to meet the detection requirements.
Smart Images

Figure CN119782060A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to an error injection method, device, computer equipment and storage medium. Background Art
[0002] Peripheral Component Interconnect Express (PCIE) devices are peripheral devices that transmit data to servers. Their performance directly affects the integrity of data transmission, especially the error handling mechanism of PCIE devices is one of the important performances of PCIE devices. In order to test the error handling mechanism of PCIE devices, error injection detection is usually used to determine whether the error handling mechanism of PCIE devices is perfect.
[0003] The traditional method of error injection detection is usually to obtain random memory data by tampering with the random data in the memory space of the PCIE device in the operating system (OS), and triggering when the central processing unit (CPU) reads and writes to the PCIE device, and writes the random memory data as an error message to the PCIE device or reads from the PCIE device to achieve the purpose of error injection detection. However, since the PCIE device does not necessarily use the random memory data during read and write operations, there is a single error injection failure, and it is necessary to try the error injection multiple times, resulting in a low efficiency of error injection. In addition, even if the PCIE device accesses the memory address storing the random memory data during read and write operations, since the random memory data is random, it will cause the error injection to be successful, but the error type is random, which is not what the tester expects, and then the error injection is poorly targeted. Summary of the invention
[0004] In view of this, the present invention provides an error injection method, apparatus, computer device and storage medium to solve the problems of low error injection efficiency and poor error injection targeting.
[0005] In a first aspect, the present invention provides an error injection method, applied to a controller, the method comprising: when receiving a message request, obtaining a preset detection capability of a target device, the preset detection capability being used to indicate message error injection detection of N error types that the target device should support, the message request carrying a first message; detecting whether the first message is a preset message type, the preset message type being a message type corresponding to a target error type, the target error type being any one of the N error types; if so, based on a target policy corresponding to the target error type, tampering the first message into a second message; and sending the second message to the target device to perform error injection on the target device.
[0006] Based on the method of the first aspect above, when receiving a message request, the controller obtains the preset detection capability of the target device; detects whether the first message carried by the message request is of a preset message type; if so, based on the target policy corresponding to the target error type, tampering the first message into a second message, and sending the second message to the target device, so as to inject errors into the target device.
[0007] Since the controller can obtain the preset detection capability of the target device when receiving the message request, that is, the controller can detect whether the first message is a message corresponding to the error type that the target device should support based on the obtained preset detection capability, and then tamper with the first message based on the target policy corresponding to the target error type to achieve targeted error injection; in addition, the second message is sent to the target device, so that the target device must use the second message during read and write operations, thereby avoiding the situation in the related technology where error injection needs to be repeated multiple times, thereby improving the efficiency of error injection.
[0008] In an optional embodiment, when a message request is received, a preset detection capability of the target device is obtained, including: when a message request is received, triggering the generation of an interrupt instruction; in response to the interrupt instruction, detecting whether the target storage address in the kernel space of the controller stores a preset field corresponding to the preset detection capability, the preset field being a string consisting of multiple binary characters, each binary character corresponding to an error type; if so, obtaining the preset detection capability based on the multiple binary characters and the numerical value of each binary character, the numerical value of each binary character being used to determine whether the target device supports message error injection detection of an error type.
[0009] In an embodiment of the present invention, by responding to an interrupt instruction, detecting a preset field stored in the target storage address, obtaining a preset detection capability corresponding to the preset field, and then determining the message error injection detection of the error type supported by the target device, so as to facilitate subsequent tampering of the first message based on the preset detection capability.
[0010] In an optional embodiment, before receiving the message request, the method also includes: when loading the driver of the target device, registering the file node, creating an error subdirectory corresponding to the target device in the file node, and creating a preset file under the error subdirectory; detecting the preset detection capability, and writing the preset detection capability into the preset file to obtain the target file, and the target file is stored in the user space of the terminal tool that sends the message request.
[0011] In an embodiment of the present invention, when loading the driver of the target device, a file node can be registered, and the detection capability of the target device can be detected, and the target file storing the detection capability can be stored in the user space, so that the user can set the preset detection capability of the target device from the user space to the kernel space of the controller through the terminal tool, so that the controller can perform error injection based on the preset detection capability.
[0012] In an optional embodiment, the method also includes: in response to a read instruction input by a user in a terminal tool, returning the preset detection capability stored in the target file to the terminal tool through a file node, so that the user can set a preset field corresponding to the preset detection capability through the terminal tool, and send the preset field to the controller; receiving and storing the preset field to the target storage address in the kernel space.
[0013] In the implementation manner of the present invention, the user can set the preset detection capability of the target device from the user space to the kernel space of the controller through a terminal tool, so that the controller can perform error injection based on the preset detection capability.
[0014] In an optional implementation, the multiple binary characters include P high-address bit characters and Q low-address bit characters; the error type corresponding to each high-address bit character is an uncorrectable error type; and the error type corresponding to each low-address bit character is a correctable error type.
[0015] In the implementation manner of the present invention, different types of error types can be set by setting binary characters at different addresses of the preset fields.
[0016] In an optional implementation, based on a target policy corresponding to a target error type, a first message is tampered with into a second message, including: based on a target policy corresponding to the target error type, determining a first field from the first message, the first field being a field that the target policy indicates is tampered with; and tampering the first field into a second field to obtain a second message.
[0017] In an embodiment of the present invention, based on the target strategy corresponding to the target error type, the first field in the first message can be tampered with in a targeted manner to obtain an error injection message corresponding to the error type that the target device should support, so that the second message is the message expected to be error injected, thereby meeting the error injection detection requirements.
[0018] In an optional embodiment, the method also includes: when the target error type is a correctable error type, receiving a response message returned by the target device after receiving the second message; parsing the response message to obtain an error code and a status identifier, the error code being used to indicate a true error type corresponding to the second message identified by the target device, and the status identifier being used to indicate whether the target device corrects a message error injection of the target error type; comparing the true error type with the target error type; if the true error type is consistent with the target error type, and the status identifier indicates that the target device has corrected the message error injection of the target error type, determining that the target device supports message error injection detection of the target error type.
[0019] In the implementation manner of the present invention, whether the target device supports message error injection detection of the target error type can be detected based on the response message returned by the target device after receiving the second message, thereby realizing the detection of whether the error handling mechanism of the target device is perfect.
[0020] In a second aspect, the present invention provides a controller, which includes: a transceiver module, which is used to obtain a preset detection capability of a target device when receiving a message request, the preset detection capability is used to indicate message error injection detection of N error types that the target device should support, and the message request carries a first message; a processing module, which is used to detect whether the first message is a preset message type, the preset message type is a message type corresponding to a target error type, and the target error type is any one of the N error types; the processing module is also used to, if so, tamper with the first message into a second message based on a target policy corresponding to the target error type; the transceiver module is also used to send the second message to the target device to perform error injection on the target device.
[0021] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the error injection method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.
[0022] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the error injection method of the first aspect or any corresponding embodiment thereof.
[0023] In a fifth aspect, the present invention provides a computer program product, comprising computer instructions, wherein the computer instructions are used to enable a computer to execute the error injection method of the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0025] Figure 1 is a topological diagram of an error injection system according to an embodiment of the present invention;
[0026] Figure 2 is a flow chart of an error injection method according to an embodiment of the present invention;
[0027] Figure 3 is a flow chart of another error injection method according to an embodiment of the present invention;
[0028] Figure 4 is a structural block diagram of a controller according to an embodiment of the present invention;
[0029] Figure 5 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0030] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0031] The embodiment of the present invention is applied to the scenario of detecting whether the error handling mechanism of the PCIE device is perfect. For example, the embodiment of the present invention is applicable to the scenario where the user writes a message to the target device through a terminal tool, and the controller performs error injection message detection. It is also applicable to the scenario where the user reads a message from the target device through a terminal tool, and the controller performs error injection message detection.
[0032] As described in the background art, the traditional error injection detection method is highly random, and there is a situation where a single error injection fails and multiple attempts at error injection are required, resulting in low error injection efficiency and poor error injection targeting.
[0033] In order to solve the above technical problems, an embodiment of the present invention provides an error injection method, which obtains the preset detection capability of the target device and obtains the error injection message corresponding to the preset detection capability to achieve targeted error injection detection, so as to improve the efficiency of error injection and improve the targeted effect of error injection.
[0034] Below Figure 1 The method provided by the embodiment of the present invention is described by taking the error injection system 100 as an example. Figure 1 It is only a schematic diagram and does not constitute a limitation on the applicable scenarios of the technical solution provided in this application.
[0035] like Figure 1 As shown, Figure 1 is a topological diagram of an error injection system according to an embodiment of the present invention. Figure 1 In the embodiment, the error injection system 100 may include a controller 101 , a terminal tool 102 , and a target device 103 .
[0036] In the embodiment of the present invention, the controller 101 may be any device having computing and communication functions. For example, the controller 101 may be a controller of a PCIE device.
[0037] In the embodiment of the present invention, the terminal tool 102 may be software for text interaction with the operating system, providing a command line interface. For example, the terminal tool 102 may be a terminal emulator or a command line tool.
[0038] In the embodiment of the present invention, the target device 103 may be any PCIE device, for example, a graphics card, a network interface card, a solid state drive, a sound card, or a video capture card.
[0039] Figure 1 The error injection device 100 shown is only used as an example and is not used to limit the technical solution of the present application. Those skilled in the art should understand that in the specific implementation process, the error injection device 100 can also include other devices, and the number of target devices can also be determined according to specific needs without limitation.
[0040] According to an embodiment of the present invention, an error injection method embodiment is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0041] In this embodiment, an error injection method is provided, which can be used in the above-mentioned controller. Figure 2 is a flow chart of an error injection method according to an embodiment of the present invention. Figure 2As shown, the process includes the following steps:
[0042] S201: When receiving a message request, obtaining a preset detection capability of a target device.
[0043] The message request carries a first message, and is used to request that the first message be written into a target device.
[0044] In the embodiment of the present invention, the preset detection capability is used to indicate the message error injection detection of N error types that the target device should support. For example, the error type may be a single-bit error type, a correctable error type in a multi-bit error, a retransmission error type, a parity error type, and an unsupported request error type.
[0045] For example, Figure 1 For example, after the user inputs a message request, the terminal tool 102 sends the message request to the controller 101. When the controller 101 receives the request message, the preset detection capability of the target device 103 is obtained.
[0046] In some optional embodiments, when the controller receives a message request sent from a terminal tool, it triggers the generation of an interrupt instruction; in response to the interrupt instruction, it detects whether the target storage address in the kernel space of the controller stores a preset field corresponding to the preset detection capability; if so, the preset detection capability is obtained based on multiple binary characters and the numerical value of each binary character.
[0047] The interrupt instruction is generated when the controller driver is executed, applying for device interrupt and binding the interrupt processing function.
[0048] The preset field is a string consisting of multiple binary characters. Each binary character corresponds to an error type. The value of each binary character is used to determine whether the target device supports message error injection detection of an error type.
[0049] The multiple binary characters include P high-address bit characters and Q low-address bit characters; the error type corresponding to each high-address bit character is an uncorrectable error type; and the error type corresponding to each low-address bit character is a correctable error type.
[0050] Among them, the uncorrectable error type indicates an error that the target device cannot automatically correct. The correctable error type indicates an error that the target device can detect and automatically correct.
[0051] In one example, the character string may include 64 binary characters, that is, the preset field corresponds to 64 error types, and the 64 binary characters include 32 high-address characters and 32 low-address characters.
[0052] For example, taking the target binary character as an example, the target binary character corresponds to the first error, and the target binary character belongs to the low address character. If the value of the binary character is 0, it means that the controller determines that the target device does not support the message error injection detection of the first error type. If the value of the binary character is 1, it means that the controller determines that the target device supports the message error injection detection of the first error type. In addition, the controller can also confirm that the first error type is a correctable error type.
[0053] It is understandable that if the controller detects that the target storage address in the kernel space does not store the preset field corresponding to the preset detection capability, the first message is sent to the target device, that is, the controller cannot perform error injection on the target device.
[0054] In some optional embodiments, before receiving a message request sent from a terminal tool, the controller registers a file node when loading the driver of the target device, creates an error subdirectory corresponding to the target device in the file node, and creates a preset file under the error subdirectory; detects the preset detection capability, and writes the preset detection capability into the preset file to obtain the target file.
[0055] The target file is stored in the user space of the terminal tool.
[0056] Exemplarily, when loading the driver of the target device, the controller executes controller_probe, registers the node as a debugfs node, creates an error subdirectory (error subdirectory), and creates a preset file (inject file) under the error subdirectory.
[0057] The inject file allows the terminal tool to perform read or write operations. The implementation of the read or write operation is defined by inject_ops.
[0058] In some optional embodiments, the controller responds to a read instruction input by the user in the terminal tool, and returns the preset detection capability stored in the target file to the terminal tool through the file node, so that the user can set the preset field corresponding to the preset detection capability through the terminal tool and send the preset field to the controller; the preset field is received and stored at the target storage address in the kernel space.
[0059] It can be understood that when the user enters the read instruction for the first time in the terminal tool, that is, when accessing the inject file, the debugfs_open function is triggered, the regular variables of the preset file are initialized through the debugfs_open function, and the final execution function (debugfs_read function) when the terminal tool triggers the read operation is bound.
[0060] Specifically, the user sets the preset field corresponding to the preset detection capability through the terminal tool, including: the user executes the debugfs_read function through the terminal tool to fill in the preset field corresponding to the preset detection capability to complete the preset detection capability of the target device, and sends the preset field to the controller, and triggers the write operation of the controller. The controller receives the preset field and calls the debugfs_store function to write the preset field to the target storage address in the kernel space.
[0061] S202: Detect whether the first message is of a preset message type.
[0062] Among them, the preset message type is the message type corresponding to the target error type.
[0063] The target error type is any error type among the N error types.
[0064] The first message may be a data transmission basis (Transaction Layer Packet, TLP) message.
[0065] For example, taking a request whose target error type is a pcie uncorrectable error and is not supported as an example, the preset message type corresponding to the target error type is a configuration read request message type.
[0066] S203: If yes, based on the target policy corresponding to the target error type, the first message is tampered into the second message.
[0067] In some optional implementations, the controller determines a first field from the first message based on a target policy corresponding to a target error type, where the first field is a field that the target policy indicates has been tampered with; and tampers the first field into a second field to obtain a second message.
[0068] For example, taking a request whose target error type is an uncorrectable error and is not supported as an example, the target strategy corresponding to the target error type is to tamper with the function field in the TL message header according to the PCIE protocol, that is, the value of the function field in the second message after tampering is different from the value of the function field in the first message.
[0069] In one example, after determining the first field from the first message based on the target strategy corresponding to the target error type, the controller can also increase or decrease the numerical value corresponding to the first field by a preset numerical value to obtain a second message, or can replace the first character in the first field with the second character to obtain a second message.
[0070] The preset value can be set as needed. For example, the preset value can be 1.
[0071] S204: Send the second message to the target device to perform error injection on the target device.
[0072] In one example, when the target error type is a correctable error type, the controller receives a response message returned by the target device after receiving the second message; parses the response message to obtain an error code and a status identifier; compares the actual error type with the target error type; if the actual error type is consistent with the target error type, and the status identifier indicates that the target device has corrected the message error injection of the target error type, it is determined that the target device supports message error injection detection of the target error type.
[0073] The error code is used to indicate the real error type corresponding to the second message identified by the target device. The state identifier is used to indicate whether the target device corrects the message error injection of the target error type.
[0074] Optionally, if the actual error type is inconsistent with the target error type, or the status flag indicates that the target device has not corrected the message error injection of the target error type, the controller determines that the target device does not support message error injection detection of the target error type.
[0075] Further, the controller determines that the target device does not support message error injection detection of the target error type, and then reports that the target device does not support message error injection detection of the target error type to the firmware or operating system for error processing.
[0076] In the above S201-S204, since the controller can obtain the preset detection capability of the target device when receiving the message request, that is, the controller can detect whether the first message is a message corresponding to the error type that the target device should support based on the obtained preset detection capability, and then tamper with the first message based on the target policy corresponding to the target error type to achieve targeted error injection; in addition, the second message is sent to the target device, so that the target device must use the second message during read and write operations, thereby avoiding the situation in the related technology where error injection needs to be repeated multiple times, thereby improving the efficiency of error injection.
[0077] In this embodiment, another error injection method is provided. Figure 3 is a schematic diagram of another error injection method according to an embodiment of the present invention, such as Figure 3 As shown, Figure 3 In the user space side, the user reads the preset detection capability of the target device through the terminal tool, and sets the preset field corresponding to the preset detection capability.
[0078] On the kernel space side, the controller loads the driver of the target device, registers the file node, registers the interrupt and binds the interrupt function; and when receiving a message request, it triggers the generation of an interrupt instruction to determine whether a preset field corresponding to the preset detection capability is set; if so, when the first message is of the preset message type, the first message is tampered with into a second message and the second message is sent to the target device; if not, the first message is sent to the target device.
[0079] In this embodiment, a controller is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceived.
[0080] This embodiment provides a controller such as Figure 4 As shown, Figure 4 It is a structural block diagram of a controller according to an embodiment of the present invention; it includes: a transceiver module 401, which is used to obtain the preset detection capability of the target device when receiving a message request, and the preset detection capability is used to indicate the message error injection detection of N error types that the target device should support, and the message request carries a first message.
[0081] The processing module 402 is used to detect whether the first message is a preset message type, where the preset message type is a message type corresponding to a target error type, and the target error type is any error type among N error types.
[0082] The processing module 402 is further configured to, if yes, tamper the first message into a second message based on a target policy corresponding to the target error type.
[0083] The transceiver module 401 is further configured to send the second message to the target device so as to perform error injection on the target device.
[0084] In some optional embodiments, the transceiver module 401 is specifically used to trigger the generation of an interrupt instruction when a message request is received; in response to the interrupt instruction, it detects whether the target storage address in the kernel space of the controller stores a preset field corresponding to a preset detection capability, where the preset field is a string composed of multiple binary characters, and each binary character corresponds to an error type; if so, the preset detection capability is obtained based on the multiple binary characters and the numerical value of each binary character, and the numerical value of each binary character is used to determine whether the target device supports message error injection detection of an error type.
[0085] In some optional embodiments, before receiving the message request, the processing module 402 is also used to register the file node when loading the driver of the target device, and create an error subdirectory corresponding to the target device in the file node, and create a preset file under the error subdirectory; detect the preset detection capability, and write the preset detection capability into the preset file to obtain the target file, and the target file is stored in the user space of the terminal tool that sends the message request.
[0086] In some optional embodiments, the processing module 402 is also used to respond to a read instruction input by the user in the terminal tool, and return the preset detection capability stored in the target file to the terminal tool through the file node, so that the user can set the preset field corresponding to the preset detection capability through the terminal tool, and send the preset field to the controller; receive and store the preset field to the target storage address in the kernel space.
[0087] In some optional embodiments, the multiple binary characters include P high address bit characters and Q low address bit characters; the error type corresponding to each high address bit character is an uncorrectable error type; and the error type corresponding to each low address character is a correctable error type.
[0088] In some optional implementations, the processing module 402 is further specifically used to determine a first field from the first message based on a target policy corresponding to a target error type, where the first field is a field that the target policy indicates has been tampered with; and tamper the first field into a second field to obtain a second message.
[0089] In some optional embodiments, the transceiver module 401 is also used to receive a response message returned by the target device after receiving the second message when the target error type is a correctable error type; the processing module 402 is also used to parse the response message to obtain an error code and a status identifier, the error code is used to indicate the real error type corresponding to the second message identified by the target device, and the status identifier is used to indicate whether the target device corrects the message error injection of the target error type; the processing module 402 is also used to compare the real error type with the target error type; the processing module 402 is also used to determine that the target device supports message error injection detection of the target error type if the real error type is consistent with the target error type and the status identifier indicates that the target device has corrected the message error injection of the target error type.
[0090] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.
[0091] The controller in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0092] The embodiment of the present invention also provides a computer device having the above Figure 4 Controller shown.
[0093] See also Figure 5 , Figure 5 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 5 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 5 A processor 10 is taken as an example.
[0094] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.
[0095] The memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.
[0096] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0097] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.
[0098] The computer device further comprises a communication interface 30 for the computer device to communicate with other devices or a communication network.
[0099] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.
[0100] Part of the present application may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present application through the operation of the computer. Those skilled in the art should understand that the existence of computer program instructions in computer-readable media includes but is not limited to source files, executable files, installation package files, etc., and accordingly, the way in which computer program instructions are executed by a computer includes but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to the computer.
[0101] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. An error injection method, characterized in that: Applied to a controller; the method comprises: When receiving a message request, obtaining a preset detection capability of a target device, the preset detection capability being used to indicate message error injection detection of N error types that the target device should support, the message request carrying a first message; Detecting whether the first message is a preset message type, where the preset message type is a message type corresponding to a target error type, and the target error type is any one of the N error types; If yes, based on the target policy corresponding to the target error type, tampering the first message into a second message; The second message is sent to the target device to perform error injection on the target device.
2. The method according to claim 1, characterized in that: When receiving the message request, obtaining the preset detection capability of the target device includes: When receiving the message request, triggering the generation of an interrupt instruction; In response to the interrupt instruction, detecting whether a target storage address in the kernel space of the controller stores a preset field corresponding to the preset detection capability, wherein the preset field is a string consisting of a plurality of binary characters, and each of the binary characters corresponds to an error type; If so, the preset detection capability is obtained based on the multiple binary characters and the numerical value of each of the binary characters, and the numerical value of each of the binary characters is used to determine whether the target device supports the message error injection detection of the one error type.
3. The method according to claim 2, characterized in that Before receiving the message request, the method further includes: When loading the driver of the target device, register a file node, create an error subdirectory corresponding to the target device in the file node, and create a preset file in the error subdirectory; The preset detection capability is detected, and the preset detection capability is written into the preset file to obtain a target file, and the target file is stored in the user space of the terminal tool that sends the message request.
4. The method according to claim 3, characterized in that The method further comprises: In response to a read instruction input by a user in the terminal tool, returning the preset detection capability stored in the target file to the terminal tool through the file node, so that the user sets the preset field corresponding to the preset detection capability through the terminal tool, and sends the preset field to the controller; The preset field is received and stored at the target storage address in the kernel space.
5. The method according to claim 2, characterized in that: The multiple binary characters include P high address bit characters and Q low address bit characters; the error type corresponding to each of the high address bit characters is an uncorrectable error type; and the error type corresponding to each of the low address characters is a correctable error type.
6. The method according to claim 5, characterized in that The tampering of the first message into a second message based on the target policy corresponding to the target error type includes: Based on the target policy corresponding to the target error type, determine a first field from the first message, where the first field is a field indicated by the target policy as tampered; The first field is tampered with into a second field to obtain a second message.
7. The method according to claim 6, characterized in that The method further comprises: In a case where the target error type is the correctable error type, receiving a response message returned by the target device after receiving the second message; Parsing the response message to obtain an error code and a status identifier, wherein the error code is used to indicate a real error type corresponding to the second message identified by the target device, and the status identifier is used to indicate whether the target device corrects the message error injection of the target error type; comparing the actual error type with the target error type; If the actual error type is consistent with the target error type, and the status flag indicates that the target device has corrected the message error injection of the target error type, it is determined that the target device supports message error injection detection of the target error type.
8. A controller, characterized in that: The controller comprises: a transceiver module, configured to obtain a preset detection capability of a target device when receiving a message request, wherein the preset detection capability is used to indicate message error injection detection of N error types that the target device should support, and the message request carries a first message; A processing module, used to detect whether the first message is a preset message type, the preset message type is a message type corresponding to a target error type, and the target error type is any one of the N error types; The processing module is further configured to, if yes, tamper the first message into a second message based on a target policy corresponding to the target error type; The transceiver module is further used to send the second message to the target device to perform error injection on the target device.
9. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the error injection method according to any one of claims 1 to 7 by executing the computer instructions.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the error injection method according to any one of claims 1 to 7.
Citation Information
Patent Citations
ARINC664 bus fault injection system and method
CN108494599A
Configuration method and verification method of error information injection capability, equipment and medium
CN116185689A
Fault injection test method and device, electronic equipment and storage medium
CN117527272A
Cited By
Error injection method and device of processor core, computer equipment and storage medium
CN122285399A