Single event upset monitoring method, device and equipment, medium and program product
By comparing the hash values of disk program code segments and memory process code segments, the errors caused by single-particle flip are monitored and corrected in real time, and the problem of difficulty in protecting memory code segments in the existing technology is solved, and efficient and low-cost single-particle flip monitoring and correction is achieved.
Patent Information
- Application Number
- CN202411619551.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-13
- Publication Date
- 2025-04-15
AI Technical Summary
The prior art is difficult to monitor and protect process code segments that have been loaded into memory in real time from single-particle flips, and the method development cost of intervening in the compilation stage is high and user program transplantation costs are increased.
By scanning the disk program code segment of the user program to be monitored on the disk and the process code segment in memory, calculate the hash value corresponding to the starting address of the two, and compare it. If the hash value is different, pause process execution, read disk code content overwrite memory code content, and resume process execution to correct errors caused by single-particle flip.
Real-time monitoring and correction of single-particle flips is realized, which can protect process code segments that have been loaded into memory, prevent data loss or corruption, and eliminate the need for intervention in the program compilation stage. The development and transplantation cost is low, and the software is highly versatile.
Smart Images

Figure CN119829356A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of single particle upset detection technology, and in particular to a single particle upset monitoring method, device, equipment, medium and program product. Background Art
[0002] Single-Event Upset (SEU) is a phenomenon that occurs in semiconductor devices and integrated circuits. It is mainly caused by high-energy particles in the space radiation environment (such as protons and heavy ions in cosmic rays, or alpha particles from radioactive elements, etc.) hitting sensitive areas inside semiconductor devices. When high-energy particles hit semiconductor devices (such as memory cells, logic gates, etc.), additional charges are generated inside the device. These charges may change the data state in the memory cell or cause errors in the output of the logic gate. For example, in the memory cell of a digital circuit, the data originally stored is "0", which may be flipped to "1" due to a single-particle upset, resulting in data errors.
[0003] Currently, errors caused by single-particle upsets are usually monitored and corrected in real time at the software level. One method is triple-mode redundancy technology, which provides protection by adding redundant branches and redundant functions. When a single module has an error due to a single-particle upset, the error can be shielded through a majority voting mechanism, but triple-mode redundancy cannot protect the process code segment that has been loaded into the memory. The other method is to intervene in the compilation stage to detect whether a single-particle upset has occurred, but the development cost is high, which increases the porting cost of the user program. Summary of the invention
[0004] In order to solve the above technical problems or at least partially solve the above technical problems, the present application provides a single-particle flip monitoring method, device, equipment, medium and program product, which can realize real-time monitoring of single-particle flips and protect process code segments that have been loaded into memory.
[0005] In order to achieve the above purpose, the technical solutions provided by the embodiments of the present application are as follows:
[0006] In a first aspect, the present application provides a single-particle flip monitoring method, comprising: scanning a disk program code segment corresponding to a user program to be monitored on a disk, and determining first information of the disk program code segment, the first information including a first starting address; starting the user program to be monitored, scanning a process code segment corresponding to the user program to be monitored in a memory, and determining second information of the process code segment, the second information including a second starting address and a length; respectively calculating hash values corresponding to the first starting address and the second starting address, and comparing whether they are the same; if so, determining that no single-particle flip has occurred in the user program to be monitored.
[0007] As an optional implementation provided in an embodiment of the present application, respectively calculating the hash values corresponding to the first starting address and the second starting address, and comparing whether they are the same includes: calculating the first hash value according to the first starting address and the length; calculating the second hash value according to the second starting address and the length; and comparing whether the first hash value and the second hash value are the same.
[0008] As an optional implementation provided in an embodiment of the present application, after respectively calculating the hash values corresponding to the first starting address and the second starting address and comparing whether they are the same, the method also includes: if the hash values corresponding to the first starting address and the second starting address are different, pausing the execution of the process; reading the target code content corresponding to the first starting address in the disk program code segment; modifying the code content corresponding to the second starting address in the process code segment to the target code content; and resuming the execution of the process.
[0009] As an optional implementation provided in an embodiment of the present application, if the hash values corresponding to the first starting address and the second starting address are different, after pausing the execution of the process, and before reading the target code content corresponding to the first starting address in the disk program code segment, the method also includes: modifying the page table attributes to release the read-only permission of the process code segment; after modifying the code content corresponding to the first starting address in the process code segment to the target code content, and before resuming the execution of the process, the method also includes: restoring the page table attributes.
[0010] As an optional implementation method provided in an embodiment of the present application, after scanning the disk program code segment corresponding to the user program to be monitored on the disk and determining the second information of the disk program code segment, the method also includes: creating a periodic monitoring task, performing operations of respectively calculating the hash values corresponding to the first starting address and the second starting address in each cycle, and comparing whether they are the same; if the hash values corresponding to the first starting address and the second starting address are the same, wait for the next cycle until the cycle timing is reached.
[0011] In a second aspect, the present application provides a single event upset monitoring device, the device comprising:
[0012] A first scanning module, used for scanning a disk program code segment corresponding to a user program to be monitored on the disk, and determining first information of the disk program code segment, wherein the first information includes a first starting address;
[0013] A second scanning module is used to start the user program to be monitored, scan the process code segment corresponding to the user program to be monitored in the memory, and determine the second information of the process code segment, where the second information includes a second starting address and a length;
[0014] A calculation module, used to calculate the hash values corresponding to the first starting address and the second starting address respectively, and compare whether they are the same;
[0015] The judgment module is used to determine if a single event upset has occurred in the user program to be monitored.
[0016] As an optional implementation provided in an embodiment of the present application, the calculation module is specifically used to: calculate a first hash value according to a first starting address and a length; calculate a second hash value according to a second starting address and a length; and compare whether the first hash value and the second hash value are the same.
[0017] As an optional implementation provided in an embodiment of the present application, the device also includes a correction module, which is used to: suspend the execution of the process if the hash values corresponding to the first starting address and the second starting address are different; read the target code content corresponding to the first starting address in the disk program code segment; modify the code content corresponding to the second starting address in the process code segment to the target code content; and resume the execution of the process.
[0018] As an optional implementation provided in an embodiment of the present application, the correction module, after suspending the execution of the process if the hash values corresponding to the first starting address and the second starting address are different, and before reading the target code content corresponding to the first starting address in the disk program code segment, is further used to: modify the page table attribute to release the read-only permission of the process code segment;
[0019] The correction module is further used to restore the page table attributes after modifying the code content corresponding to the first start address in the process code segment to the target code content and before resuming the execution of the process.
[0020] As an optional implementation provided in an embodiment of the present application, the first scanning module is also used to: create a periodic monitoring task, and perform operations in each cycle to calculate the hash values corresponding to the first starting address and the second starting address, and compare whether they are the same; if the hash values corresponding to the first starting address and the second starting address are the same, wait for the next cycle until the cycle timing is reached.
[0021] In a third aspect, the present application provides an electronic device comprising: a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein when the computer program is executed by the processor, the single-particle flip monitoring method as described in the first aspect or any one of its optional embodiments is implemented.
[0022] In a fourth aspect, the present application provides a computer-readable storage medium, comprising: a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the single-particle flip monitoring method as described in the first aspect or any optional embodiment thereof is implemented.
[0023] In a fifth aspect, the present application provides a computer program product, comprising: the computer program product comprises a computer program, and when the computer program runs on a computer, the computer implements the single particle flip monitoring method as described in the first aspect or any optional embodiment thereof.
[0024] Compared with the prior art, the technical solution provided by the embodiments of the present application has the following advantages:
[0025] The disclosed embodiment provides a monitoring method, device, equipment, medium and program product for a single particle flip, wherein the method first scans the disk program code segment corresponding to the user program to be monitored on the disk, and determines that the first information of the disk program code segment includes the first starting address; then starts the user program to be monitored, so that the user program to be monitored is loaded into the memory, and scans the corresponding process code segment in the memory to determine that the second information of the process code segment includes the second starting address and length; then calculates the hash value corresponding to the first starting address and the second starting address, and when the hash value of the first starting address and the hash value of the second starting address are compared and obtained to be the same, it is determined that the user program to be monitored has not experienced a single particle flip. In this way, the present application realizes effective monitoring of single particle flips by comparing the hash value corresponding to the starting address of the disk program code segment in the disk with the hash value corresponding to the starting address of the process code segment in the memory, and can protect the process code segment that has been loaded into the memory to prevent data loss or damage; there is no need to intervene in the program compilation stage, the development and transplantation costs are low, and the software has strong versatility. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0027] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0028] Figure 1 A schematic diagram of a flow chart of a single event upset monitoring method provided in an embodiment of the present application;
[0029] Figure 2 A schematic diagram of the structure of a single event upset monitoring device provided in an embodiment of the present application;
[0030] Figure 3 A schematic diagram of the structure of an electronic device described in an embodiment of the present application. DETAILED DESCRIPTION
[0031] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the technical terms required to be used in the embodiments or the prior art description are briefly introduced below:
[0032] The process code segment is a part of the process memory space, which contains the machine instructions of the executable program. When a program is loaded into the memory and runs as a process, its code segment is mapped to the virtual address space of the process. These machine instructions are binary codes that can be directly executed by the CPU to complete the functions designed by the program, such as performing mathematical calculations, controlling input and output devices, etc. The process code segment is stored in the memory in the form of virtual memory addresses.
[0033] The disk program code segment refers to the code portion of the program file stored on the disk (such as hard disk, solid state drive). This code segment exists in the form of a file and is a series of binary data on the disk. It is the original storage form of the program and is kept on the disk until the program is executed. It contains all the instructions of the program and related data structure definitions, waiting to be loaded into the memory by the operating system for execution.
[0034] When a program needs to run, the operating system's loader reads the disk program code segment from the disk into the memory. The loader first parses the format of the disk program file to determine the location and size of the code segment. Then, it allocates enough space for the process in the memory and copies the binary data in the disk program code segment to the corresponding location in the memory. This process is called loading. Once the disk program code segment is loaded into the memory and becomes the process code segment, some conversion and optimization operations may be performed.
[0035] The detection and protection of single-particle upsets at the software level mainly include the following: (1) Control flow check: By inserting control flow checkpoints, verify whether the program execution runs according to the expected control flow graph; (2) Data redundancy check: Redundant storage of key data, such as storing the same data through double or triple write, and then comparing the consistency of each copy before use. If inconsistency is found, the correct data can be restored from the copy; (3) Redundant calculation: Execute the same operation multiple times and perform a three-choice two-out-of-three vote; (4) Radiation-resistant software algorithm design: By designing fault-tolerant algorithms, the dependence of certain algorithms on single bits is reduced to ensure that even if a single-bit error occurs in the data, the deviation of the overall calculation result is still within an acceptable range; (5) Parallel redundant execution: In a multi-core system, the program can execute the same task in parallel on multiple cores, and monitor the impact of a single-particle upset on one of the cores by comparing the execution results between the cores.
[0036] Although the above methods have achieved certain results in monitoring and correcting data errors, they are unable to monitor in real time whether the program code segment loaded into the memory is affected by a single-particle upset.
[0037] In order to more clearly understand the above-mentioned purposes, features and advantages of the present application, the scheme of the present application will be further described below. It should be noted that the embodiments of the present application and the features in the embodiments can be combined with each other without conflict.
[0038] In the following description, many specific details are set forth to facilitate a full understanding of the present application, but the present application may also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only part of the embodiments of the present application, rather than all of the embodiments.
[0039] In order to solve some or all of the technical problems existing in the related art, the embodiment of the present application provides a monitoring method, device, equipment, medium and program product for a single particle flip, wherein the method first scans the disk program code segment corresponding to the user program to be monitored on the disk, and determines that the first information of the disk program code segment includes the first starting address; then starts the user program to be monitored, so that the user program to be monitored is loaded into the memory, and scans the corresponding process code segment in the memory to determine that the second information of the process code segment includes the second starting address and length; then calculates the hash value corresponding to the first starting address and the second starting address, and when the hash value of the first starting address and the hash value of the second starting address are the same, it is determined that the user program to be monitored has not undergone a single particle flip. In this way, the present application realizes effective monitoring of single particle flips by comparing the hash value corresponding to the starting address of the disk program code segment in the disk with the hash value corresponding to the starting address of the process code segment in the memory, and can protect the process code segment that has been loaded into the memory to prevent data loss or damage; there is no need to intervene in the program compilation stage, the development and transplantation costs are low, and the software has strong versatility.
[0040] A monitoring method for a single particle flip provided in the embodiment of the present application can be implemented by a monitoring device or an electronic device for a single particle flip, and the electronic device includes but is not limited to a personal computer, a laptop computer, a tablet computer, a smart phone, etc. The operating system of the electronic device may include Android (Android), a mobile operating system (iOS) developed by Apple, an operating system (Windows) developed by Microsoft Corporation of the United States, etc., and the embodiment of the present application is not limited to this. The electronic device can be operated alone to implement the present application, or it can be connected to a network and implemented by interactive operations with other computer devices in the network. Among them, the network in which the electronic device is located includes but is not limited to the Internet, a wide area network, a metropolitan area network, a local area network, a virtual private network (Virtual Private Network, VPN) network, etc.
[0041] It should be noted that the protection scope of the single-particle flip monitoring method described in the embodiment of the present application is not limited to the execution order of the steps listed in this embodiment. All solutions implemented by adding, reducing or replacing steps in the prior art based on the principles of the present application are included in the protection scope of the present application.
[0042] like Figure 1 As shown, Figure 1 This is a flow chart of a single-particle upset monitoring method according to an embodiment of the present application. The method can be performed by a single-particle upset monitoring device or electronic device, wherein the device can be implemented by software and / or hardware and can generally be integrated in an electronic device. The method mainly includes the following steps S101 to S104:
[0043] S101 , scanning a disk program code segment corresponding to a user program to be monitored on a disk, and determining first information of the disk program code segment.
[0044] The first information includes a first starting address, which can be recorded as ADDR1. The first information also includes a length LEN.
[0045] In some embodiments, before executing step S101, a user program path PATH inputted by a system driver interface is obtained, and the user program to be monitored is obtained according to the user program path.
[0046] When the user program to be monitored is not running, it is stored on the disk in the form of a disk program code segment. The disk is scanned to determine the first starting address of the disk code segment and other information. Specifically, the program header table of the user program path PATH is read to obtain the first starting address ADDR1 of the disk code segment.
[0047] The above embodiment scans the disk program code segment corresponding to the user program to be monitored on the disk in order to obtain the original value of the single event upset detection so as to perform subsequent steps for comparison with the process code segment in the memory.
[0048] S102: Start the user program to be monitored, scan the process code segment corresponding to the user program to be monitored in the memory, and determine the second information of the process code segment.
[0049] The second information includes a second starting address and a length.
[0050] When the monitored user program is started, the operating system loads the disk program code into the memory to form a process code segment. The process code segment in the memory is scanned to determine the starting address of the process code segment, that is, the second starting address (which can be recorded as ADDR2), and the length.
[0051] S103, respectively calculating the hash values corresponding to the first starting address and the second starting address, and comparing whether they are the same.
[0052] When executing step S103 , a hash value H1 corresponding to the first start address and a hash value H2 corresponding to the second start address are calculated, and the hash value H1 corresponding to the first start address and the hash value H2 corresponding to the second start address are compared to see whether they are the same.
[0053] In some embodiments, when executing step S103, the following process is included: calculating a first hash value according to the first starting address and the length included in the second information; calculating a second hash value according to the second starting address and the length included in the second information, and comparing whether the first hash value and the second hash value are the same.
[0054] Specifically, starting from the first starting address ADDR1 of the disk program code segment, read the first code content with a length of LEN, and calculate the first hash value H1 of the first code content; starting from the second starting address ADDR2 of the process code segment, read the second code content with a length of LEN, and calculate the second hash value H2 of the second code content; compare whether the first hash value H1 is equal to the second hash value H2.
[0055] In some embodiments, after executing step S102, the present application also includes the following steps: creating a periodic monitoring task, executing step S103 (calculating the hash values corresponding to the first starting address and the second starting address respectively, and comparing whether they are the same) in each cycle; if the hash values corresponding to the first starting address and the second starting address are the same, wait for the next cycle until the cycle timing is reached.
[0056] Optionally, obtain the verification period PERIOD passed in by the system driver interface, create a periodic monitoring task, use the verification period PERIOD as the task period, and perform operations of respectively calculating the hash values corresponding to the first starting address and the second starting address and comparing whether they are the same within the verification period PERIOD. If the hash values corresponding to the first starting address and the second starting address are the same, it means that the verification has passed, and the user program to be monitored has not experienced a single particle upset within the current task period, and wait for the verification of the next period until the period timing is reached. Real-time monitoring of single particle upsets is achieved.
[0057] In some embodiments, after executing step S103, if the hash value corresponding to the first starting address and the hash value corresponding to the second starting address are different, indicating that the verification fails and a single-particle upset occurs in the monitored user program, the following steps are performed: first, the execution of the process is suspended, and then the target code content corresponding to the first starting address in the disk program code segment is read, and then the code content corresponding to the second starting address in the process code segment is modified to the target code content, and then the execution of the process is resumed. The error caused by the single-particle upset is corrected.
[0058] Specifically, based on the aforementioned embodiment, if the first hash value H1 is not equal to the second hash value H2, the execution of the process is first suspended, and then the first code content in the disk program code segment is used to overwrite the second code content in the process code segment, and then the execution of the process is resumed, thereby correcting the process code segment error caused by the single-particle flip.
[0059] In the above embodiment, after the execution of the process is suspended, the page table attribute is first modified to release the read-only permission of the process code segment, so that the process code segment can be edited, and then the target code content corresponding to the first starting address in the disk code segment is read to modify the code content corresponding to the second starting address of the process code segment. After the execution of the process is resumed, the page table attribute is restored, and the process code segment returns to the read-only state. Thus, the security and integrity of the process code segment are ensured.
[0060] S104: If yes, determine that no single event upset occurs in the user program to be monitored.
[0061] When the hash value corresponding to the first starting address is compared to the hash value corresponding to the second starting address and is identical, it is determined that a single event upset occurs during the process of loading the user program to be detected from the disk to the memory.
[0062] The above embodiment compares the disk program code segment with the process code segment, especially compares the hash value of each starting address, so as to timely detect whether a single particle upset occurs, which is of great significance for extending the service life of electronic products and improving the stability of performance.
[0063] In summary, the present application provides a method for monitoring a single-particle flip, which first scans the disk program code segment corresponding to the user program to be monitored on the disk, and determines that the first information of the disk program code segment includes the first starting address; then starts the user program to be monitored, so that the user program to be monitored is loaded into the memory, and scans the corresponding process code segment in the memory to determine that the second information of the process code segment includes the second starting address and length; then calculates the hash value corresponding to the first starting address and the second starting address, and when the hash value of the first starting address and the hash value of the second starting address are compared and obtained to be the same, it is determined that the user program to be monitored has not experienced a single-particle flip. In this way, the present application realizes effective monitoring of single-particle flips by comparing the hash value corresponding to the starting address of the disk program code segment on the disk with the hash value corresponding to the starting address of the process code segment in the memory, and can protect the process code segment that has been loaded into the memory to prevent data loss or damage; there is no need to intervene in the program compilation stage, the development and transplantation costs are low, and the software has strong versatility.
[0064] In addition, in some embodiments of the present application, when a single-particle upset is detected in a user program, the disk program code segment is used to overwrite the process code segment, and corrective measures are taken, which is conducive to extending the service life of the chip and the device, ensuring the stable performance of the chip and the device, and protecting the integrity of the data, ensuring the integrity and availability of the data, and enhancing the data security in the storage system.
[0065] like Figure 2 As shown, Figure 2 A single event upset monitoring device provided in an embodiment of the present application includes:
[0066] The first scanning module 201 is used to scan the disk program code segment corresponding to the user program to be monitored on the disk, and determine the first information of the disk program code segment, the first information including the first starting address;
[0067] The second scanning module 202 is used to start the user program to be monitored, scan the process code segment corresponding to the user program to be monitored in the memory, and determine the second information of the process code segment, the second information including the second starting address and length;
[0068] A calculation module 203 is used to calculate the hash values corresponding to the first starting address and the second starting address respectively, and compare whether they are the same;
[0069] The judgment module 204 is used to determine that if yes, no single event upset occurs in the user program to be monitored.
[0070] As an optional implementation provided in an embodiment of the present application, the calculation module 203 is specifically used to: calculate a first hash value according to a first starting address and a length; calculate a second hash value according to a second starting address and a length; and compare whether the first hash value and the second hash value are the same.
[0071] As an optional implementation provided in an embodiment of the present application, the device also includes a correction module, which is used to: suspend the execution of the process if the hash values corresponding to the first starting address and the second starting address are different; read the target code content corresponding to the first starting address in the disk program code segment; modify the code content corresponding to the second starting address in the process code segment to the target code content; and resume the execution of the process.
[0072] As an optional implementation provided in an embodiment of the present application, the correction module, after suspending the execution of the process if the hash values corresponding to the first starting address and the second starting address are different, and before reading the target code content corresponding to the first starting address in the disk program code segment, is further used to: modify the page table attribute to release the read-only permission of the process code segment;
[0073] The correction module is further used to restore the page table attributes after modifying the code content corresponding to the first start address in the process code segment to the target code content and before resuming the execution of the process.
[0074] As an optional implementation provided in an embodiment of the present application, the first scanning module 201 is also used to: create a periodic monitoring task, and perform operations of respectively calculating the hash values corresponding to the first starting address and the second starting address in each cycle, and comparing whether they are the same; if the hash values corresponding to the first starting address and the second starting address are the same, wait for the next cycle until the cycle timing is reached.
[0075] In summary, the embodiment of the present application provides a monitoring device for a single particle flip, which first scans the disk program code segment corresponding to the user program to be monitored on the disk, and determines that the first information of the disk program code segment includes the first starting address; then starts the user program to be monitored, so that the user program to be monitored is loaded into the memory, and scans the corresponding process code segment in the memory to determine that the second information of the process code segment includes the second starting address and length; then calculates the hash value corresponding to the first starting address and the second starting address, and when the hash value of the first starting address and the hash value of the second starting address are compared and obtained to be the same, it is determined that the user program to be monitored has not experienced a single particle flip. In this way, the present application realizes effective monitoring of single particle flips by comparing the hash value corresponding to the starting address of the disk program code segment on the disk with the hash value corresponding to the starting address of the process code segment in the memory, and can protect the process code segment that has been loaded into the memory to prevent data loss or damage; there is no need to intervene in the program compilation stage, the development and transplantation costs are low, and the software has strong versatility.
[0076] For the specific definition of the monitoring device for single particle upset, please refer to the definition of the monitoring method for single particle upset mentioned above, which will not be repeated here. Each module in the above-mentioned monitoring device for single particle upset can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0077] In one embodiment, the present application provides an electronic device, which may be a terminal, and its internal structure diagram may be as follows: Figure 3 As shown. The electronic device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the electronic device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, near field communication (NFC) or other technologies. When the computer program is executed by the processor, a single particle flip monitoring method is implemented. The display screen of the electronic device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the electronic device can be a touch layer covered on the display screen, or a key, trackball or touchpad set on the housing of the electronic device, or an external keyboard, touchpad or mouse, etc.
[0078] Those skilled in the art will understand that Figure 3The structure shown in the figure is merely a block diagram of a partial structure related to the scheme of the present application, and does not constitute a limitation on the electronic device to which the scheme of the present application is applied. The specific electronic device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
[0079] In one embodiment, the single-particle upset monitoring device provided in the present application can be implemented in the form of a computer program. The computer program can be used in Figure 3 The memory of the electronic device may store various program modules constituting the single-particle upset monitoring device, for example, Figure 2 The first scanning module 201, the second scanning module 202, the calculation module 203 and the judgment module 204 are shown. The computer program composed of various program modules enables the processor to execute the steps of the single event upset monitoring method of each embodiment of the present application described in this specification.
[0080] For example, Figure 3 The electronic device shown can be Figure 2 The electronic device in the single-particle flip monitoring device shown can use the first scanning module 201 to scan the disk program code segment corresponding to the user program to be monitored on the disk, and determine the first information of the disk program code segment, wherein the first information includes a first starting address; the electronic device can use the second scanning module 202 to start the user program to be monitored, scan the process code segment corresponding to the user program to be monitored in the memory, and determine the second information of the process code segment, wherein the second information includes a second starting address and a length; the electronic device can use the calculation module 203 to respectively calculate the hash values corresponding to the first starting address and the second starting address, and compare whether they are the same; the electronic device can use the judgment module 204 to determine that if so, the user program to be monitored has not experienced a single-particle flip.
[0081] In one embodiment, the present application provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0082] Scan the disk program code segment corresponding to the user program to be monitored on the disk to determine the first information of the disk program code segment, the first information including the first starting address; start the user program to be monitored, scan the process code segment corresponding to the user program to be monitored in the memory, and determine the second information of the process code segment, the second information including the second starting address and length; calculate the hash values corresponding to the first starting address and the second starting address respectively, and compare whether they are the same; if so, determine that the user program to be monitored has not experienced a single particle flip.
[0083] In one embodiment, when the processor executes the computer program, the following steps are also implemented: respectively calculating the hash values corresponding to the first starting address and the second starting address, and comparing whether they are the same, including: calculating the first hash value according to the first starting address and the length; calculating the second hash value according to the second starting address and the length; comparing whether the first hash value and the second hash value are the same.
[0084] In one embodiment, when the processor executes the computer program, the following steps are also implemented: after respectively calculating the hash values corresponding to the first starting address and the second starting address and comparing whether they are the same, the method also includes: if the hash values corresponding to the first starting address and the second starting address are different, pausing the execution of the process; reading the target code content corresponding to the first starting address in the disk program code segment; modifying the code content corresponding to the second starting address in the process code segment to the target code content; and resuming the execution of the process.
[0085] In one embodiment, the processor further implements the following steps when executing the computer program: if the hash values corresponding to the first starting address and the second starting address are different, after pausing the execution of the process, and before reading the target code content corresponding to the first starting address in the disk program code segment, the method also includes: modifying the page table attributes to release the read-only permission of the process code segment; after modifying the code content corresponding to the first starting address in the process code segment to the target code content, and before resuming the execution of the process, the method also includes: restoring the page table attributes.
[0086] In one embodiment, when the processor executes the computer program, the following steps are also implemented: after scanning the disk program code segment corresponding to the user program to be monitored on the disk and determining the second information of the disk program code segment, the method also includes: creating a periodic monitoring task, and performing the operation of calculating the hash values corresponding to the first starting address and the second starting address respectively and comparing whether they are the same in each cycle; if the hash values corresponding to the first starting address and the second starting address are the same, waiting for the next cycle until the cycle timing is reached.
[0087] When the processor in the electronic device provided by the present application executes a computer program, it first scans the disk program code segment corresponding to the user program to be monitored on the disk, and determines that the first information of the disk program code segment includes the first starting address; then starts the user program to be monitored, so that the user program to be monitored is loaded into the memory, and scans the corresponding process code segment in the memory to determine that the second information of the process code segment includes the second starting address and length; then calculates the hash value corresponding to the first starting address and the second starting address, and when the hash value of the first starting address and the hash value of the second starting address are compared and obtained to be the same, it is determined that the user program to be monitored has not experienced a single particle flip. In this way, the present application realizes effective monitoring of single particle flips by comparing the hash value corresponding to the starting address of the disk program code segment on the disk with the hash value corresponding to the starting address of the process code segment in the memory, and can protect the process code segment that has been loaded into the memory to prevent data loss or damage; there is no need to intervene in the program compilation stage, the development and transplantation costs are low, and the software has strong versatility.
[0088] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by the computer program, the following steps are implemented:
[0089] Scan the disk program code segment corresponding to the user program to be monitored on the disk to determine the first information of the disk program code segment, the first information including the first starting address; start the user program to be monitored, scan the process code segment corresponding to the user program to be monitored in the memory, and determine the second information of the process code segment, the second information including the second starting address and length; calculate the hash values corresponding to the first starting address and the second starting address respectively, and compare whether they are the same; if so, determine that the user program to be monitored has not experienced a single particle flip.
[0090] In one embodiment, when the computer program executes the computer program, the following steps are also implemented: respectively calculating the hash values corresponding to the first starting address and the second starting address, and comparing whether they are the same includes: calculating the first hash value according to the first starting address and the length; calculating the second hash value according to the second starting address and the length; comparing whether the first hash value and the second hash value are the same.
[0091] In one embodiment, when the computer program executes the computer program, the following steps are also implemented: after respectively calculating the hash values corresponding to the first starting address and the second starting address and comparing whether they are the same, the method also includes: if the hash values corresponding to the first starting address and the second starting address are different, pausing the execution of the process; reading the target code content corresponding to the first starting address in the disk program code segment; modifying the code content corresponding to the second starting address in the process code segment to the target code content; and resuming the execution of the process.
[0092] In one embodiment, the computer program further implements the following steps when executing the computer program: if the hash values corresponding to the first starting address and the second starting address are different, after pausing the execution of the process, and before reading the target code content corresponding to the first starting address in the disk program code segment, the method also includes: modifying the page table attributes to release the read-only permission of the process code segment; after modifying the code content corresponding to the first starting address in the process code segment to the target code content, and before resuming the execution of the process, the method also includes: restoring the page table attributes.
[0093] In one embodiment, when the computer program executes the computer program, the following steps are also implemented: after scanning the disk program code segment corresponding to the user program to be monitored on the disk and determining the second information of the disk program code segment, the method also includes: creating a periodic monitoring task, and performing the operation of calculating the hash values corresponding to the first starting address and the second starting address respectively and comparing whether they are the same in each cycle; if the hash values corresponding to the first starting address and the second starting address are the same, wait for the next cycle until the cycle timing is reached.
[0094] When the computer program in the computer-readable storage medium provided by the present application executes the computer program, the disk program code segment corresponding to the user program to be monitored on the disk is first scanned to determine that the first information of the disk program code segment includes the first starting address; then the user program to be monitored is started so that the user program to be monitored is loaded into the memory, and the corresponding process code segment in the memory is scanned to determine that the second information of the process code segment includes the second starting address and length; and then the hash value corresponding to the first starting address and the second starting address is calculated, and when the hash value of the first starting address and the hash value of the second starting address are compared and obtained to be the same, it is determined that the user program to be monitored has not experienced a single-particle flip. In this way, the present application realizes effective monitoring of single-particle flips by comparing the hash value corresponding to the starting address of the disk program code segment on the disk with the hash value corresponding to the starting address of the process code segment in the memory, and can protect the process code segment that has been loaded into the memory to prevent data loss or damage; there is no need to intervene in the program compilation stage, the development and transplantation costs are low, and the software has strong versatility.
[0095] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media that include computer-usable program code.
[0096] In several embodiments provided by the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0097] In the present application, the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0098] In this application, memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
[0099] In this application, computer-readable media includes permanent and non-permanent, removable and non-removable storage media. Storage media can be implemented by any method or technology to store information, and the information can be computer-readable instructions, data structures, modules of programs or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. According to the definition in this article, computer-readable media does not include temporary computer-readable media (transitory media), such as modulated data signals and carrier waves.
[0100] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0101] The above is only a specific implementation of the present application, so that those skilled in the art can understand or implement the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to these embodiments herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for monitoring a single event upset, characterized in that: include: Scanning a disk program code segment corresponding to a user program to be monitored on a disk, and determining first information of the disk program code segment, wherein the first information includes a first starting address; Starting the user program to be monitored, scanning the process code segment corresponding to the user program to be monitored in the memory, and determining the second information of the process code segment, where the second information includes a second starting address and a length; Calculate the hash values corresponding to the first starting address and the second starting address respectively, and compare whether they are the same; If so, it is determined that no single event upset occurs in the user program to be monitored.
2. The method according to claim 1, characterized in that: The calculating the hash values corresponding to the first starting address and the second starting address respectively and comparing whether they are the same includes: Calculate a first hash value according to the first starting address and the length; Calculate a second hash value according to the second starting address and the length; Compare the first Hash value and the second Hash value to see if they are the same.
3. The method according to claim 1, characterized in that After respectively calculating the hash values corresponding to the first starting address and the second starting address and comparing whether they are the same, the method further includes: If the hash values corresponding to the first starting address and the second starting address are different, pausing the execution of the process; Reading the target code content corresponding to the first starting address in the disk program code segment; Modify the code content corresponding to the second starting address in the process code segment into the target code content; Resuming execution of the process.
4. The method according to claim 3, characterized in that After pausing the execution of the process if the hash values corresponding to the first starting address and the second starting address are different, and before reading the target code content corresponding to the first starting address in the disk program code segment, the method further includes: modifying the page table attribute to release the read-only permission of the process code segment; After modifying the code content corresponding to the first start address in the process code segment to the target code content and before resuming the execution of the process, the method further includes: restoring the page table attributes.
5. The method according to claim 1, characterized in that After scanning the disk program code segment corresponding to the to-be-monitored user program on the disk and determining the second information of the disk program code segment, the method further includes: Creating a periodic monitoring task, and performing operations of respectively calculating the hash values corresponding to the first starting address and the second starting address and comparing whether they are the same in each period; If the hash values corresponding to the first starting address and the second starting address are the same, wait for the next cycle until the cycle timing is reached.
6. A single event upset monitoring device, characterized in that: include: A first scanning module, used for scanning a disk program code segment corresponding to a user program to be monitored on the disk, and determining first information of the disk program code segment, wherein the first information includes a first starting address; A second scanning module, used for starting the user program to be monitored, scanning the process code segment corresponding to the user program to be monitored in the memory, and determining the second information of the process code segment, wherein the second information includes a second starting address and a length; A calculation module, used to calculate the hash values corresponding to the first starting address and the second starting address respectively, and compare whether they are the same; The judgment module is used to determine that if so, no single event upset occurs in the user program to be monitored.
7. The device according to claim 6, characterized in that The device also includes a correction module, which is used to: If the hash values corresponding to the first starting address and the second starting address are different, pausing the execution of the process; Reading the target code content corresponding to the first starting address in the disk program code segment; Modify the code content corresponding to the second starting address in the process code segment into the target code content; Resuming execution of the process.
8. An electronic device, characterized in that: include: A processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the single event upset monitoring method according to any one of claims 1 to 5.
9. A computer-readable storage medium, characterized in that: include: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the single event upset monitoring method according to any one of claims 1 to 5 is implemented.
10. A computer program product, characterized in that include: The computer program product comprises a computer program, and when the computer program is executed on a computer, the computer is enabled to implement the single event upset monitoring method according to any one of claims 1 to 5.