Method and device for protecting stack

A stack and max-heap technology, applied in the direction of instrumentation, error detection/correction, calculation, etc., can solve the problems of stack memory usage, detection lag, etc., and achieve the effect of solving detection lag and convenient and fast detection

Active Publication Date: 2017-08-04
ZTE CORP
View PDF9 Cites 9 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0008] The present invention provides a stack protection method and device to at least solve the problem in the related art that the dynamic stack detection is used to cause detection lag, while the static stack detection analysis is in terms of stack memory occupation

Method used

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

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Method and device for protecting stack
  • Method and device for protecting stack
  • Method and device for protecting stack

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0031] Functional overview of the technical solution of this embodiment: in related technologies, when the function call is too deep or the local variable is too large, etc., the allocated stack will be overflowed and an exception will be generated. (Executable and Linking Format, referred to as ELF) to obtain the corresponding assembly source code, scan the assembly source code to analyze and calculate the maximum stack occupancy of each function; in addition, scan the ELF file symbol table to obtain each own scheduling entity when designing the own scheduling entity The stack configuration value of the entity, calculate the stack occupancy value of the maximum depth of the self-scheduling entity according to the call path starting from the entry. Then compare the stack configuration value of each self-owned scheduling entity with the corresponding maximum stack occupancy calculation value. If the configuration value is less than the count value, there is an overflow risk, and...

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

PUM

No PUM Login to view more

Abstract

The invention provides a method and a device for protecting stack. The method comprises: obtaining a maximum stack numerical value of each function occupation in an executable file, wherein the executable file is configured with a plurality of threads and one or more entities used to operate the stack are hung under each thread; according to the maximum stack numerical value, calculating a maximum stack calculated value of respective occupation of one or more entities; obtaining a symbol used to identify one or more entities, and according to the symbol, respectively obtaining a configuration value of configuration of one or more entities; when the configuration value is smaller than the calculated value, outputting a comparative result of the configuration value and the calculated value. Through the method, problems in the prior art of detection lag caused by using dynamic stack detection, and stack memory occupation using static stack detection analysis are solved, so that detection on stack overflow is conveniently and rapidly realized.

Description

technical field [0001] The present invention relates to the field of computers, in particular to a stack protection method and device. Background technique [0002] During the running of an executable program, the stack used by the program is a very important resource. If the stack overflows, it will cause unexpected and irreparable running exceptions. Therefore, it is very important to protect and detect the stack. [0003] At present, in terms of stack detection, the following two methods are used in related technologies for stack detection: [0004] 1. Dynamic stack detection: Dynamic detection is to take certain means to detect stack overflow or overflow warning during the running of the program. The stack size detection used by the program to the maximum depth that has been running is direct and accurate. But once an overflow is found, it is often necessary to replace it with a new version of the program to solve it, that is, the detection is lagging; and this detecti...

Claims

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

Application Information

Patent Timeline
no application Login to view more
Patent Type & Authority Applications(China)
IPC IPC(8): G06F11/36
CPCG06F11/3612G06F11/36
Inventor 刘雪峰缪红保
Owner ZTE CORP
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products