WO2016123908A1 - Procédé et appareil de détection de débordements de mémoire - Google Patents
Procédé et appareil de détection de débordements de mémoire Download PDFInfo
- Publication number
- WO2016123908A1 WO2016123908A1 PCT/CN2015/084147 CN2015084147W WO2016123908A1 WO 2016123908 A1 WO2016123908 A1 WO 2016123908A1 CN 2015084147 W CN2015084147 W CN 2015084147W WO 2016123908 A1 WO2016123908 A1 WO 2016123908A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- memory
- detected
- program
- address
- memory block
- Prior art date
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
Definitions
- the invention relates to the field of memory management and memory detection of an embedded system, in particular to a method and device for detecting a memory out of bounds.
- the embodiment of the invention provides a method and a device for detecting a memory out of bounds, so as to at least solve the problem that the memory access is difficult to locate beyond the boundary in the related art.
- a method for detecting a memory out of bounds including:
- the release flag indicates that the memory block is not released, obtaining a first bias address of the to-be-detected program, where the first bias address is a bias address farthest from the start address;
- the first biased address falls within the memory range of the memory block; if the first biased address does not fall within the memory range of the memory block, it is determined that the memory of the program to be detected is out of bounds.
- the method further includes:
- a memory block is requested according to the operation information included in the program to be detected.
- the method further includes:
- the memory block is operated according to the operation information included in the program to be detected.
- the method further includes:
- the method further includes:
- step of obtaining the start address and the memory management header information of the memory block allocated to the program to be detected includes:
- a memory out-of-band detection apparatus including:
- a first obtaining module configured to obtain a starting address and a memory management header information of a memory block allocated to the program to be detected, where the memory management header information includes: a capacity of the memory block and a release flag;
- the first detecting module is configured to detect a release flag, and if the release flag indicates that the memory block has been released, determining that the memory to be detected is out of bounds;
- a second obtaining module configured to: when the release flag indicates that the memory block is not released, acquire a first bias address of the to-be-detected program, where the first bias address is a bias address farthest from the start address;
- the second detecting module is configured to detect, according to the capacity and the starting address of the memory block, whether the first biasing address falls within the memory range of the memory block; if the first biasing address does not fall within the memory range of the memory block, determining The detection program has a memory out of bounds.
- the detecting device that the memory is out of bounds further includes:
- the application module is configured to apply for a memory block according to the operation information included in the program to be detected.
- the detecting device that the memory is out of bounds further includes:
- the operation module is configured to operate the memory block according to the operation information included in the program to be detected.
- the detecting device that the memory is out of bounds further includes:
- the processing module is configured to record the program to be detected that the memory is out of bounds, and suspend the process of executing the program to be detected.
- the detecting device that the memory is out of bounds further includes:
- the extension module is set to obtain the input processing strategy and perform corresponding operations according to the processing policy.
- the first obtaining module includes:
- a receiving unit configured to receive a memory management header address of the program to be detected
- the obtaining unit is configured to search for a starting address of the memory block according to the memory management head address, and read the memory management header information stored in the memory block management header address.
- the beneficial effects of the embodiment of the present invention are: a method and device for detecting a memory out of bounds, by detecting the legality of a memory block of the program to be detected first, and then detecting whether the program to be detected all falls within the legal range of the memory block, thereby detecting Whether the program to be detected has a memory out of bounds, realizing rapid positioning of the memory out of bounds, improving the fault tolerance, reliability and usability of the entire system executing the program to be detected.
- FIG. 1 is a schematic flow chart 1 of a method for detecting a memory out of bounds according to the present invention
- FIG. 2 is a schematic flow chart 2 of a method for detecting a memory out of bounds according to the present invention
- Fig. 3 is a block diagram showing the apparatus for detecting a memory out of bounds according to the present invention.
- 101 a first acquisition module, 102, a second detection module, 103, a second acquisition module, 104, a second detection module.
- an embodiment of the present invention provides a memory out-of-bounds detection method, which can detect whether the program has a memory out of bounds after each program is executed, and A program that has a memory out of bounds is recorded.
- the detection method includes:
- Step 10 Obtain a start address and a memory management header information of a memory block allocated to the program to be detected, and the memory management header information includes: a capacity of the memory block and a release flag.
- a program to be detected needs to be detected whether it has a memory out of bounds, it is necessary to acquire the starting address of the memory block allocated by the system to the program to be detected and the memory management header information of the memory block.
- the system allocates a memory block for the to-be-detected program, the start address of the memory block and the memory management header address are recorded, so that it is necessary to detect whether the program to be detected has a memory out of bounds problem.
- the capacity of the memory block and the release flag are recorded in the memory management header information.
- the memory block capacity is the memory block size.
- the start address of the memory block is known, the end address of the memory block can be obtained according to the size of the memory block.
- the release flag indicates whether the memory block is released.
- the meaning of the code can be customized. For example, all "1" indicates that it has not been released, and all "0" indicates that it has been released.
- Step 20 Detect the release flag. If the release flag indicates that the memory block has been released, it is determined that the memory to be detected is out of bounds.
- a release flag in the memory management header information of the memory block corresponding to the program to be detected is required, and if the release flag indicates that the memory block has been released, the release flag is released.
- all "0" is used, it indicates that the memory block has been released, and the memory block is illegal, but is still occupied by the program to be detected, indicating that the memory of the program to be detected has an out of bounds.
- Step 30 If the release flag indicates that the memory block is not released, the first bias address of the program to be detected is obtained, and the first bias address is a bias address farthest from the start address.
- the release flag indicates that the memory block is not released, that is, the release flag is all "1"
- the program to be detected can occupy or rewrite it.
- the system records each of the bias addresses, so the distance from the start address can be selected.
- the farthest bias address is the first bias address.
- Step 40 Detect whether the first bias address falls within the memory range of the memory block according to the capacity and the starting address of the memory block; if the first bias address does not fall within the memory range of the memory block, determine that the program to be detected generates memory. Cross the border.
- Step 10 has obtained the capacity and the starting address of the memory block, so that the memory range of the memory block is known, and the first bias address obtained in the detecting step 30 falls within the memory range of the memory block, if the first biased address does not fall.
- the first bias address is not between the start address and the end address, it is determined that the memory out of bounds problem occurs in the to-be-detected program. If the first biased address falls within the memory range of the memory block, that is, the first biased address is between the start address and the end address, it is determined that the memory out of bounds problem does not occur in the to-be-detected program, and then the corresponding indication may be made according to the system indication. action.
- the detecting method further includes:
- Step 01 Apply for a memory block according to the operation information included in the program to be detected.
- the operation information included in the program to be detected refers to the code information of the program to be detected, and the system can allocate a reasonable memory block according to the code information.
- the application process can call the memory application function. When the system allocates a memory block that can be used, it also returns the memory block start address and the memory management header address.
- the detecting method further includes:
- Step 02 The memory block is operated according to the operation information included in the program to be detected.
- the segment program may be processed according to a preset processing strategy, for example, the program to be detected is recorded, and the execution of the to-be-detected program is suspended. process.
- the processing strategy for what kind of processing is performed on the segment program may be customized, and the to-be-detected program is correspondingly operated according to the input processing strategy.
- a mature reserved command line may be adopted.
- step 10 includes:
- the general memory management header address is the previous address of the memory block start address.
- the start address of the memory block can be obtained.
- the memory management head address and the memory block start address recorded in the system can also be directly read.
- a memory management header information is recorded in the memory management header address, and the size of the corresponding memory block is recorded in the memory management header information, and a release flag of whether the memory block is released.
- the memory out-of-bounds detection method of the present invention detects the legality of the memory block of the program to be detected, and then detects whether the program to be detected all falls within the legal range of the memory block, thereby detecting whether the program to be detected has a memory out of bounds, and realizing The fast positioning of the memory out of bounds improves the fault tolerance, reliability and availability of the entire system executing the program to be tested.
- a device for detecting an out-of-band memory includes:
- the first obtaining module 101 is configured to obtain a starting address of the memory block allocated to the program to be detected and memory management header information, where the memory management header information includes: a capacity of the memory block and a release flag;
- the first detecting module 102 is configured to detect a release flag, and if the release flag indicates that the memory block has been released, determining that the memory to be detected is out of bounds;
- the second obtaining module 103 is configured to: when the release flag indicates that the memory block is not released, acquire a first bias address of the to-be-detected program, where the first bias address is a bias address farthest from the start address;
- the second detecting module 104 is configured to detect, according to the capacity and the starting address of the memory block, whether the first biasing address falls within the memory range of the memory block; if the first biasing address does not fall within the memory range of the memory block, determining The memory of the program to be tested is out of bounds.
- the detecting device that the memory is out of bounds further includes:
- the application module is configured to apply for a memory block according to the operation information included in the program to be detected.
- the detecting device that the memory is out of bounds further includes:
- the operation module is configured to operate the memory block according to the operation information included in the program to be detected.
- the detecting device that the memory is out of bounds further includes:
- the processing module is configured to record the program to be detected that the memory is out of bounds, and suspend the process of executing the program to be detected.
- the detecting device that the memory is out of bounds further includes:
- the extension module is set to obtain the input processing strategy and perform corresponding operations according to the processing policy.
- the first obtaining module includes:
- a receiving unit configured to receive a memory management header address of the program to be detected
- the obtaining unit is configured to search for a starting address of the memory block according to the memory management head address, and read the memory management header information stored in the memory block management header address.
- the device is a device corresponding to the above-mentioned memory out-of-band detection method. All the implementation manners in the foregoing method embodiments are applicable to the device embodiment, and the same technical effects can be achieved.
- the method and apparatus for detecting out-of-memory of the memory provided by the embodiment of the present invention have the following beneficial effects: realizing rapid positioning of memory out of bounds, improving fault tolerance, reliability, and availability of the entire system for executing the program to be detected. .
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
Procédé et appareil de détection de débordements de mémoire, le procédé comportant les étapes consistant à: obtenir une adresse de début et des informations d'en-tête de gestion de mémoire d'un bloc de mémoire attribué à un programme à détecter, les informations d'en-tête de gestion de mémoire comportant une capacité et un identifiant de libération du bloc de mémoire (S10); vérifier l'identifiant de libération, et si l'identifiant de libération indique que le bloc de mémoire a été libéré, déterminer que le programme à détecter présente un débordement de mémoire (S20); si l'identifiant de libération indique que le bloc de mémoire n'a pas été libéré, obtenir une première adresse de déviation du programme à détecter, la première adresse de déviation étant l'adresse de déviation la plus éloignée de l'adresse de début (S30); en fonction de la capacité et de l'adresse de début du bloc de mémoire, détecter si la première adresse de déviation se situe à l'intérieur d'une plage de mémoire du bloc de mémoire; si ce n'est pas le cas, déterminer que le programme à détecter présente un débordement de mémoire (S40). En vérifiant la validité du bloc de mémoire, puis en détectant si la totalité du programme à détecter se situe à l'intérieur d'une plage valide du bloc de mémoire, le procédé et l'appareil détectent si le program présente un débordement de mémoire, localisant rapidement un débordement de mémoire.
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510063377.6 | 2015-02-06 | ||
CN201510063377.6A CN105988921A (zh) | 2015-02-06 | 2015-02-06 | 一种内存越界的检测方法及装置 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2016123908A1 true WO2016123908A1 (fr) | 2016-08-11 |
Family
ID=56563380
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2015/084147 WO2016123908A1 (fr) | 2015-02-06 | 2015-07-15 | Procédé et appareil de détection de débordements de mémoire |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN105988921A (fr) |
WO (1) | WO2016123908A1 (fr) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110569037A (zh) * | 2019-09-06 | 2019-12-13 | 北京小米移动软件有限公司 | 数据写入的方法和装置 |
CN113377522A (zh) * | 2020-03-09 | 2021-09-10 | 大唐移动通信设备有限公司 | 内存池中内存块的处理方法、装置、电子设备和存储介质 |
CN115373964A (zh) * | 2022-10-24 | 2022-11-22 | 北京智芯微电子科技有限公司 | 内存越界检测方法、装置、设备及介质 |
CN115981831A (zh) * | 2021-10-14 | 2023-04-18 | 中移物联网有限公司 | 内存管理方法及相关设备 |
Families Citing this family (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111324450B (zh) * | 2017-01-25 | 2023-04-28 | 安科讯(福建)科技有限公司 | 一种基于lte协议栈的内存池泄露的方法及其系统 |
CN110895499A (zh) * | 2018-09-13 | 2020-03-20 | 北京奇虎科技有限公司 | 程序溢出保护方法及装置 |
CN109799992B (zh) * | 2018-12-05 | 2022-07-19 | 交控科技股份有限公司 | 一种城市轨道交通信号系统软件缓冲区范围检查方法 |
CN111338794A (zh) * | 2020-02-18 | 2020-06-26 | 苏州洞察云信息技术有限公司 | 一种内存越界监控方法、装置及存储介质 |
CN112631821A (zh) * | 2021-01-28 | 2021-04-09 | 长沙景嘉微电子股份有限公司 | 内存故障检测定位方法、装置、计算机设备及存储介质 |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101110042A (zh) * | 2006-07-20 | 2008-01-23 | 中兴通讯股份有限公司 | 一种检测内存访问越界的方法 |
WO2012055188A1 (fr) * | 2010-10-27 | 2012-05-03 | 中兴通讯股份有限公司 | Terminal et procédé de vérification de données dans une mémoire interne d'un terminal |
CN103745755A (zh) * | 2014-01-06 | 2014-04-23 | 中国科学院软件研究所 | 一种高效且高可用的空间内存错误检测方法 |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101561775B (zh) * | 2009-05-12 | 2010-09-15 | 华为技术有限公司 | 内存监控方法和装置 |
JP2012150535A (ja) * | 2011-01-17 | 2012-08-09 | Fujitsu Ltd | プログラム検証方法及び検証プログラム |
-
2015
- 2015-02-06 CN CN201510063377.6A patent/CN105988921A/zh not_active Withdrawn
- 2015-07-15 WO PCT/CN2015/084147 patent/WO2016123908A1/fr active Application Filing
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101110042A (zh) * | 2006-07-20 | 2008-01-23 | 中兴通讯股份有限公司 | 一种检测内存访问越界的方法 |
WO2012055188A1 (fr) * | 2010-10-27 | 2012-05-03 | 中兴通讯股份有限公司 | Terminal et procédé de vérification de données dans une mémoire interne d'un terminal |
CN103745755A (zh) * | 2014-01-06 | 2014-04-23 | 中国科学院软件研究所 | 一种高效且高可用的空间内存错误检测方法 |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110569037A (zh) * | 2019-09-06 | 2019-12-13 | 北京小米移动软件有限公司 | 数据写入的方法和装置 |
CN110569037B (zh) * | 2019-09-06 | 2023-03-31 | 北京小米移动软件有限公司 | 数据写入的方法和装置 |
CN113377522A (zh) * | 2020-03-09 | 2021-09-10 | 大唐移动通信设备有限公司 | 内存池中内存块的处理方法、装置、电子设备和存储介质 |
CN115981831A (zh) * | 2021-10-14 | 2023-04-18 | 中移物联网有限公司 | 内存管理方法及相关设备 |
CN115373964A (zh) * | 2022-10-24 | 2022-11-22 | 北京智芯微电子科技有限公司 | 内存越界检测方法、装置、设备及介质 |
CN115373964B (zh) * | 2022-10-24 | 2023-01-20 | 北京智芯微电子科技有限公司 | 内存越界检测方法、装置、设备及介质 |
Also Published As
Publication number | Publication date |
---|---|
CN105988921A (zh) | 2016-10-05 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2016123908A1 (fr) | Procédé et appareil de détection de débordements de mémoire | |
US7000225B2 (en) | Method for inserting global breakpoints | |
US10121004B2 (en) | Apparatus and method for monitoring virtual machine based on hypervisor | |
JP5832954B2 (ja) | タグ付与装置及びタグ付与方法 | |
US10817211B2 (en) | Method for completing a secure erase operation | |
WO2017148271A1 (fr) | Procédé de traitement de réinitialisation de système linux et dispositif, ainsi que support d'informations d'ordinateur | |
TW200419448A (en) | Privileged-based qualification of branch trace store data | |
US9189426B2 (en) | Protected access to virtual memory | |
US20090138969A1 (en) | Device and method for blocking autorun of malicious code | |
US20240095174A1 (en) | Method for detecting error of operating system kernel memory in real time | |
CN108898012B (zh) | 检测非法程序的方法和装置 | |
CN110727597A (zh) | 一种基于日志排查无效代码补全用例的方法 | |
CN104461880A (zh) | 一种嵌入式系统中自动检测内存越界的方法及系统 | |
US9778969B2 (en) | Automatic memory leak detection | |
JP2016537730A (ja) | 割り付けられていないメモリ、または初期化されていないメモリに対するリード・アクセスを検出すること | |
CN107766385B (zh) | 一种转换虚拟磁盘文件格式的方法与设备 | |
US8028142B2 (en) | Controller of storage device, storage device, and control method of storage device | |
CN107707856B (zh) | 一种多媒体节目录制的方法及装置 | |
CN103164290A (zh) | 应用内存管理方法和装置 | |
JP2009217617A (ja) | メモリリーク箇所の特定方法及び装置 | |
EP2960798B1 (fr) | Détection de fuite de mémoire automatique | |
CN111338794A (zh) | 一种内存越界监控方法、装置及存储介质 | |
CN105808445A (zh) | 一种嵌入式闪存及其扇区处理方法、装置 | |
JP2006018705A (ja) | メモリアクセストレースシステムおよびメモリアクセストレース方法 | |
Guo et al. | A function oriented methodology to validate and verify forensic copy function of digital forensic tools |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 15880863 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 15880863 Country of ref document: EP Kind code of ref document: A1 |