CN112231165A - Memory fault simulation method based on link library injection and memory mapping mode - Google Patents
Memory fault simulation method based on link library injection and memory mapping mode Download PDFInfo
- Publication number
- CN112231165A CN112231165A CN202011053886.8A CN202011053886A CN112231165A CN 112231165 A CN112231165 A CN 112231165A CN 202011053886 A CN202011053886 A CN 202011053886A CN 112231165 A CN112231165 A CN 112231165A
- Authority
- CN
- China
- Prior art keywords
- command
- memory
- fault
- fault simulation
- simulator
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/22—Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
- G06F11/26—Functional testing
- G06F11/261—Functional testing by simulating additional hardware, e.g. fault simulation
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Computer Hardware Design (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Techniques For Improving Reliability Of Storages (AREA)
- Test And Diagnosis Of Digital Computers (AREA)
Abstract
The invention relates to a memory fault simulation method based on a link library injection and memory mapping mode, which comprises the following steps: the method comprises the steps that a fault simulator is started on a target server, a Command interface is initialized, a user inputs a fault simulation Command, the fault simulator receives the fault simulation Command and then transmits the Command to a Command Dispatcher, the Command Dispatcher analyzes the fault simulation Command, and a corresponding Command processor is found according to a Command mapping table; and the command processor completes corresponding fault injection according to the corresponding fault simulation command. The memory fault simulation method based on the link library injection and memory mapping mode can simulate the memory fault on the premise of not damaging the memory hardware and is used for verifying the disaster tolerance of software to the memory fault. With non-intrusive transparency, the original hardware need not be corrupted and the original code need not be modified.
Description
Technical Field
The invention relates to the technical field of memory faults, in particular to a memory fault simulation method based on a link library injection and memory mapping mode.
Background
With the development of science and technology, computers have entered into thousands of households. The hardware system of the computer is composed of an arithmetic unit, a controller, a memory, an input device and an output device. The memory in a computer is divided into internal memory and external memory. The memory is used to store programs and data that are currently in use or are needed at any time. Once a memory error or fault occurs, a program cannot work normally or is down. Therefore, the method has important significance for researching possible faults of the memory.
Memory failures are one of the most common failures in computer systems, and in critical systems with extremely high availability requirements, the fault tolerance of the memory failures needs to be evaluated. The most effective method for fault injection type fault-tolerant mechanism evaluation. The fault injection refers to that aiming at a specific fault model, faults are intentionally hasten in a target system, the occurrence of errors and failures of the target system is accelerated, and the fault tolerance, the fault safety and other information of the target system can be verified by analyzing the response information of the system to the injected faults.
Disclosure of Invention
The invention provides a memory fault simulator which simulates memory faults on the premise of not damaging memory hardware through link library injection and memory mapping and is used for verifying the disaster tolerance of software to the memory faults.
The invention relates to a memory fault simulation method based on a link library injection and memory mapping mode, which comprises the following steps:
1. the memory fault simulation method based on the link library injection and memory mapping mode is characterized by comprising the following steps:
A. starting a fault simulator on a target server, initializing a command interface, and waiting for a user to input a fault simulation command;
B. a user inputs fault simulation commands, including a memory allocation failure command and a memory shortage command;
C. after receiving the fault simulation Command, the fault simulator transmits the fault simulation Command to the Command Dispatcher, and the Command Dispatcher analyzes the fault simulation Command and finds a corresponding Command processor according to the Command mapping table;
D. and the command processor completes corresponding fault injection according to the corresponding fault simulation command.
The invention simulates the memory fault on the premise of not damaging the memory hardware, is used for verifying the disaster tolerance of software to the memory fault, has non-invasive transparency, does not need to damage the original hardware, and does not need to modify the original code.
Further, step D includes: the fault simulation command comprises a memory allocation failure command and a memory shortage command;
the execution steps of the memory allocation failure command are as follows:
after the command processor receives the distribution failure command, the fault simulator sets an LD _ PRELOAD environment variable to an operating system, loads newmalloc.so with a memory distribution failure function in advance, covers malloc and brk functions in glibc.so and causes memory distribution failure when software applies for memories through the malloc and brk functions;
the execution steps of the insufficient memory command are as follows:
after the command processor receives the memory shortage command, the fault simulator firstly executes mkdir-p/mnt/tmps & & mount tmpfs/mnt/tmps-t tmps and maps the file into the memory; and then circularly executing dd if/dev/zero of 1M/mnt/tmpfs bs to write 1M data into the memory mapping file, wherein the system memory is continuously reduced, namely, the memory is insufficient.
The command principle of memory allocation failure in the step D is as follows: the software process runs on runtime provided by an operating system, the runtime provides malloc and brk functions for software to use, the malloc and brk functions are used for applying for memory from the operating system, and any memory allocation function is finally realized by using brk. The malloc, brk functions are located in glibc.
The command principle of insufficient memory in the step D is as follows: the operating system supports mapping a part of the memory into a file through memory mapping, and a large amount of data is written in the mapped file, so that the memory of the operating system can be consumed conveniently and rapidly, and the fault of insufficient memory is simulated.
The memory fault simulation method based on the link library injection and memory mapping mode can simulate the memory fault on the premise of not damaging the memory hardware and is used for verifying the disaster tolerance of software to the memory fault. With non-intrusive transparency, the original hardware need not be corrupted and the original code need not be modified.
Drawings
FIG. 1 is a block diagram of a memory failure application architecture for simulating a memory failure according to the present invention.
FIG. 2 is a block diagram of an architecture for simulating memory failure resulting in memory shortage according to the present invention.
Detailed Description
The present invention will be described in further detail with reference to the following examples. This should not be understood as limiting the scope of the above-described subject matter of the present invention to the following examples. Various substitutions and alterations according to the general knowledge and conventional practice in the art are intended to be included within the scope of the present invention without departing from the technical spirit of the present invention as described above.
As shown in fig. 1, the architecture of the present invention for simulating a memory failure resulting in a memory application failure,
the fault simulator sets LD _ PRELOAD environment variables to an operating system, loads newmalloc.so with a memory allocation failure function in advance, covers malloc and brk functions in glibc.so as to cause memory allocation failure when software applies for a memory through the malloc or brk functions;
specifically, a fault simulator is started on a target server, a command interface is initialized, and a user inputs a memory allocation failure command; after receiving the memory allocation failure Command, the fault simulator transmits the Command to the Command Dispatcher, and the Command Dispatcher analyzes the fault simulation Command and finds a corresponding Command processor according to the Command mapping table; after the command processor triggers a memory allocation failure command, the fault simulator sets LD _ PRELOAD environment variables to an operating system, loads newmalloc.so with a memory allocation failure function in advance, covers malloc and brk functions in glibc.so as to cause memory allocation failure when software applies for a memory through the malloc or brk functions;
FIG. 2 shows an architecture for simulating memory shortage caused by memory failure according to the present invention
The fault simulator firstly executes mkdir-p/mnt/tmps & & mount tmpfs/mnt/tmpfs-t tmpfs and maps the file into a memory. And then circularly executing dd if/dev/zero of 1M/mnt/tmpfs bs to 1M, and writing 1M data into the memory mapping file, wherein it can be seen that the system memory is continuously reduced, and the memory shortage simulation is successful.
The method comprises the following steps that a fault simulator is started on a target server, a Command interface is initialized, a user inputs a memory shortage Command, the fault simulator transmits the Command to a Command Dispatcher after receiving the memory shortage Command, the Command Dispatcher analyzes the fault simulation Command, and a corresponding Command processor is found according to a Command mapping table; after the command processor triggers a memory shortage command, the fault simulator firstly executes mkdir-p/mnt/tmps & & mount tmpfs/mnt/tmps-t tmps and maps the file into the memory. And then circularly executing dd if/dev/zero of 1M/mnt/tmpfs bs to 1M, and writing 1M data into the memory mapping file, wherein it can be seen that the system memory is continuously reduced, and the memory shortage simulation is successful.
Claims (2)
1. The memory fault simulation method based on the link library injection and memory mapping mode is characterized by comprising the following steps:
A. starting a fault simulator on a target server, initializing a command interface, and waiting for a user to input a fault simulation command;
B. a user inputs fault simulation commands, including a memory allocation failure command and a memory shortage command;
C. after receiving the fault simulation Command, the fault simulator transmits the fault simulation Command to the Command Dispatcher, and the Command Dispatcher analyzes the fault simulation Command and finds a corresponding Command processor according to the Command mapping table;
D. the command processor triggers a corresponding fault according to a corresponding fault simulation command.
2. The method according to claim 1, wherein the step D comprises: the fault simulation command comprises a memory allocation failure command and a memory shortage command;
the execution steps of the memory allocation failure command are as follows:
after the command processor receives the distribution failure command, the fault simulator sets an LD _ PRELOAD environment variable to an operating system, loads newmalloc.so with a memory distribution failure function in advance, covers malloc and brk functions in glibc.so and causes memory distribution failure when software applies for memories through the malloc and brk functions;
the execution steps of the insufficient memory command are as follows:
after the command processor receives the memory shortage command, the fault simulator firstly executes mkdir-p/mnt/tmps & & mount tmpfs/mnt/tmps-t tmps and maps the file into the memory; and then circularly executing dd if/dev/zero of 1M/mnt/tmpfs bs to write 1M data into the memory mapping file, wherein the system memory is continuously reduced, namely, the memory is insufficient.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011053886.8A CN112231165B (en) | 2020-09-29 | 2020-09-29 | Memory fault simulation method based on link library injection and memory mapping modes |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011053886.8A CN112231165B (en) | 2020-09-29 | 2020-09-29 | Memory fault simulation method based on link library injection and memory mapping modes |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112231165A true CN112231165A (en) | 2021-01-15 |
CN112231165B CN112231165B (en) | 2023-06-06 |
Family
ID=74120810
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011053886.8A Active CN112231165B (en) | 2020-09-29 | 2020-09-29 | Memory fault simulation method based on link library injection and memory mapping modes |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112231165B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113918401A (en) * | 2021-09-30 | 2022-01-11 | 四川新网银行股份有限公司 | Network fault simulation method and simulator based on iptables |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20180293123A1 (en) * | 2017-04-10 | 2018-10-11 | Western Digital Technologies, Inc. | Detecting Memory Failures in the Runtime Environment |
CN111491037A (en) * | 2020-06-28 | 2020-08-04 | 四川新网银行股份有限公司 | Communication method with object storage server through SFTP data stream |
US20200285571A1 (en) * | 2019-03-05 | 2020-09-10 | Honeywell International Inc. | Systems and methods for fault injection and ensuring failsafe fms saas platforms |
-
2020
- 2020-09-29 CN CN202011053886.8A patent/CN112231165B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20180293123A1 (en) * | 2017-04-10 | 2018-10-11 | Western Digital Technologies, Inc. | Detecting Memory Failures in the Runtime Environment |
US20200285571A1 (en) * | 2019-03-05 | 2020-09-10 | Honeywell International Inc. | Systems and methods for fault injection and ensuring failsafe fms saas platforms |
CN111491037A (en) * | 2020-06-28 | 2020-08-04 | 四川新网银行股份有限公司 | Communication method with object storage server through SFTP data stream |
Non-Patent Citations (3)
Title |
---|
于航;王晶;周继芹;李亚;张伟功;: "面向单粒子翻转效应的模拟故障注入技术", 计算机工程与设计 * |
王振江,盛四清,顾雪平: "网络模式的电网故障仿真培训系统", 广西电力 * |
苏雄: "一种面向龙芯3A平台的软件模拟故障注入系统设计与实现", 《中国优秀硕士论文》 * |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113918401A (en) * | 2021-09-30 | 2022-01-11 | 四川新网银行股份有限公司 | Network fault simulation method and simulator based on iptables |
Also Published As
Publication number | Publication date |
---|---|
CN112231165B (en) | 2023-06-06 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108027722B (en) | Dynamically updating applications in compilation and deployment | |
US9535820B2 (en) | Technologies for application validation in persistent memory systems | |
CN109144515B (en) | Off-line simulation method and device for DCS graphical algorithm configuration | |
US9898388B2 (en) | Non-intrusive software verification | |
US10949332B2 (en) | Data race analysis based on altering function internal loads during time-travel debugging | |
CN103617120A (en) | Unit testing method and device | |
CN115952758A (en) | Chip verification method and device, electronic equipment and storage medium | |
CN102331961B (en) | Method, system and dispatcher for simulating multiple processors in parallel | |
US9658849B2 (en) | Processor simulation environment | |
US20120124425A1 (en) | Method and Apparatus Useful In Manufacturing Test Case Operations | |
CN110704315A (en) | Fault injection device for embedded software test | |
CN112231165A (en) | Memory fault simulation method based on link library injection and memory mapping mode | |
Kooli et al. | Cache-and register-aware system reliability evaluation based on data lifetime analysis | |
US10650174B1 (en) | System and method for visualizing event sequences for expressions using both hardware and software state information | |
Kim et al. | Unit testing of flash memory device driver through a SAT-based model checker | |
CN112559336A (en) | Method, device and system for adaptively debugging heterogeneous computing chip and mainboard chip | |
CN112256554A (en) | Method and equipment for testing based on scene test case | |
US8914274B1 (en) | Method and system for instruction set simulation with concurrent attachment of multiple debuggers | |
CN117251118B (en) | Virtual NVMe simulation and integration supporting method and system | |
CN111857664B (en) | Application development method, device, equipment and storage medium | |
US11151294B1 (en) | Emulated register access in hybrid emulation | |
CN111352843B (en) | Method and system for realizing test script verification | |
Phillips | Enhanced debugging with traces | |
Posadas et al. | Automatic HW/SW interface modeling for scratch-pad and memory mapped HW components in native source-code co-simulation | |
Sandhu | Comparison of Fault Simulation Over Custom Kernel Module Using Various Techniques |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |