CN108614772A - The framework and method of a kind of concurrently detection stacker buffer spilling - Google Patents
The framework and method of a kind of concurrently detection stacker buffer spilling Download PDFInfo
- Publication number
- CN108614772A CN108614772A CN201810313731.XA CN201810313731A CN108614772A CN 108614772 A CN108614772 A CN 108614772A CN 201810313731 A CN201810313731 A CN 201810313731A CN 108614772 A CN108614772 A CN 108614772A
- Authority
- CN
- China
- Prior art keywords
- buffer
- buffering area
- buffer information
- thread
- information
- 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.)
- Pending
Links
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
- G06F11/3604—Software analysis for verifying properties of programs
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/50—Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
- G06F21/52—Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems during program execution, e.g. stack integrity ; Preventing unwanted data erasure; Buffer overflow
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Software Systems (AREA)
- Computer Hardware Design (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Quality & Reliability (AREA)
- Debugging And Monitoring (AREA)
Abstract
The invention discloses a kind of framework that concurrently detection stacker buffer is overflowed and methods, are related to field of computer technology, this method includes:The buffer information of buffering area is dynamically inserted into Data buffer by user thread, buffer information in Data buffer is sent in data warehouse by transmission thread, the each buffer information of data warehouse storage, each buffer information of monitoring thread while buffer information is inserted into Data buffer by each user thread in ergodic data warehouse, and searched according to buffer information and overflow buffering area, carry out fault alarm to overflowing buffering area;The present invention is that the operational efficiency of program is improved by the data structure of no lock, the framework can support the information to buffering area of user thread and monitoring thread parallel to operate, the efficient inspection for supporting stacker buffer to overflow, can solve all stacker buffer overflow problems.
Description
Technical field
The present invention relates to field of computer technology, especially a kind of framework that concurrently detection stacker buffer is overflowed and method.
Background technology
With the development of computer industry, current various software programs are just rapidly being dissolved into our practical life
In work, and one ring of key developed as promotion all trades and professions, but the growth with society to the dependence of software systems, software
The failure that system generates can bring huge hidden danger to business system even Safety-Critical System, therefore software reliability becomes
User selects an important indicator of software systems, the requirement of software reliability to also become very important in Software Industry development
One side.Software reliability refer to software systems in certain circumstances and remained operational in special time period do not fail it is general
Rate, and software reliability engineering refers to developing and safeguarding software systems using the technology in some engineerings so that these softwares
The evaluation that the reliability of system can be quantified is compared with.The period generated according to software fault can summarize raising software
Four main aspects of system reliability:1, the wrong prevention of progress is developed by specification and mistake avoids;2, by verification and really
Recognize technology and realizes error detection and removal;3, make system service in mistake still meet under a situation arises by Redundancy Design to want
It asks;4, by software reliability model etc. to wrong existence, future failure possibility occurrence and failure effect etc. are predicted.
Above-mentioned four kinds of methods are mainly used in the development process of software, and in contrast to this, run time verification is that one kind exists
The technology that the software actual motion stage carries out property analysis verification can as a kind of efficient verification technique of newest proposition
It realizes and software is monitored in real time at runtime, whether verification software meets given attribute, this has the reliability for improving software
Breakthrough meaning.It verifies at runtime in required key technology, main includes two aspects, and one is to be verified
The generation of the description of property and corresponding validator, second is that monitor and validator is integrated.Current run time verification can not be high
Apply in the detection that stacker buffer is overflowed to effect.
Invention content
The present inventor is regarding to the issue above and technical need, it is proposed that a kind of framework that concurrently detection stacker buffer is overflowed and
Method improves the operational efficiency of program by the data structure of no lock, and user thread does not have to and monitoring thread contention lock, reduces
Influence to user thread.
Technical scheme is as follows:
A kind of framework that concurrently detection stacker buffer is overflowed, the framework include:Several user threads, monitoring thread, number
According to buffer, data warehouse and transmission thread, Data buffer and data warehouse support multithreading simultaneously without lock and data warehouse
Hair, transmission thread are non-obstruction thread;User thread calls memory allocation function application allocation buffer in heap memory, memory
Partition function returns to the buffer information dynamically distributed, and the buffer information of buffering area is dynamically inserted into data by user thread
In buffer, the buffer information in Data buffer is sent in data warehouse by transmission thread, data warehouse storage buffering
Area's information;Monitoring thread ergodic data warehouse while buffer information is inserted into Data buffer by each user thread
In each buffer information, and according to buffer information search overflow buffering area and failure buffering area, by data warehouse with
Buffering area buffer information corresponding with failure buffering area is overflowed to delete, it is the buffering area there are overflow error to overflow buffering area,
The buffering area that fails is the buffering area being released.
Its further technical solution is that Data buffer uses loop chain data structure, data warehouse to use nesting linked list
Structure.
A method of it concurrently detecting stacker buffer and overflows, method is based on above-mentioned framework, and this method includes:
Default dynamic shared library is inserted into memory allocation function by way of program pitching pile, in user thread calling
Partition function application allocation buffer in heap memory is deposited, memory allocation function returns to the buffer information dynamically distributed, user
The buffer information of buffering area is dynamically inserted into Data buffer by thread, and the corresponding buffer information of buffering area is wrapped successively
Include size field, labeling head field, buffer stopper field and tail tag field;
Buffer information in Data buffer is sent in data warehouse by transmission thread;
The each buffer information of data warehouse storage;
Monitoring thread ergodic data storehouse while buffer information is inserted into Data buffer by each user thread
Each buffer information in library, and searched according to buffer information and overflow buffering area, it is that there are overflow errors to overflow buffering area
Buffering area;
Monitoring thread carries out fault alarm, and fault alarm, which is used to indicate, overflows the overflow error that buffering area occurs.
Its further technical solution is that it includes constructor to preset dynamic shared library, and the value of size field is by buffering area
Size and first key encryption generate, and labeling head field is encrypted by buffer size, buffer zone address and the second key and generated, tail
Tag field is encrypted by buffer size, buffer zone address and third key and is generated, first key, the second key and third key
It is generated by constructor random initializtion.
Its further technical solution is, according to buffer information lookup spilling buffering area, including:
According in buffer information size field and the corresponding buffering area of labeling head field detection buffer information whether
There are upper overflow errors;
According in buffer information size field and the corresponding buffering area of tail tag field detection buffer information whether
In the presence of overflow error;
When there are when upper overflow error and/or lower overflow error, determine buffering area letter for the corresponding buffering area of buffer information
It is to overflow buffering area to cease corresponding buffering area.
Its further technical solution is, according to the size field and labeling head field detection buffering area in buffer information
The corresponding buffering area of information whether there is upper overflow error, including:
Size field in buffer information is decrypted to obtain buffer size;
Labeling head field in buffer information is decrypted to obtain buffer size;
Whether the buffer size that the buffer size that detected size field is decrypted is decrypted with labeling head field
Unanimously;
If inconsistent, it is determined that there are upper overflow errors for the corresponding buffering area of buffer information;
If consistent, it is determined that upper overflow error is not present in the corresponding buffering area of buffer information.
Its further technical solution is, according to the size field and tail tag field detection buffering area in buffer information
The corresponding buffering area of information whether there is lower overflow error, including:
Size field in buffer information is decrypted to obtain buffer size;
Tail tag field in buffer information is decrypted to obtain buffer size;
Whether the buffer size that the buffer size that detected size field is decrypted is decrypted with tail tag field
Unanimously;
If inconsistent, it is determined that overflow error in the presence of the corresponding buffering area of buffer information;
If consistent, it is determined that overflow error in the absence of the corresponding buffering area of buffer information.
Its further technical solution is that this method further includes:
User thread calls memory release function application release failure buffering area;
Monitoring thread deletes buffer information corresponding with failure buffering area in data warehouse.
Its further technical solution is that this method further includes:
Memory release function is that failure buffering area adds invalid markers and returns;
Monitoring thread deletes buffer information corresponding with failure buffering area in data warehouse, including:
Each buffer information in monitoring thread ergodic data warehouse simultaneously finds out the buffering area letter including invalid markers
Breath, monitoring thread release failure buffering area simultaneously delete buffer information corresponding with failure buffering area in data warehouse.
Its further technical solution is that this method further includes:
Memory discharges function and judges that failure buffering area whether there is overflow error according to the buffer information of failure buffering area;
When failure buffering area is there are when overflow error, memory discharges in the buffer information of function modification failure buffering area
Labeling head field, memory release function only mark failure buffering area and return;
Monitoring thread deletes buffer information corresponding with failure buffering area in data warehouse, including:
The value that monitoring thread detects the corresponding actual labeling head of buffering area is corresponding with the buffering area stored in data warehouse
Labeling head value it is whether identical;
If differing, it is determined that buffering area is failure buffering area and deletes corresponding with failure buffering area slow in data warehouse
Area's information is rushed, monitoring thread discharges the failure buffering area in heap memory simultaneously.
The method have the benefit that:
It is the number by no lock this application discloses a kind of framework that concurrently detection stacker buffer is overflowed and method, the present invention
The operational efficiency of program is improved according to structure, which can support the letter to buffering area of user thread and monitoring thread parallel
Breath is operated, and in this application, user thread is not directly to store information into data warehouse, but first by buffering area
Address and the storage to Data buffer of efficient informations such as size in, transmission thread is responsible for remaining information unloading work, this
Sample user thread does not have to and monitoring thread contention lock, and secondly memory release function only marks failure buffering area not discharge buffering
Area, but failure buffering area is discharged again after corresponding buffer information in deleting data warehouse by monitoring thread, it is right in this way
The performance influence of user thread is considerably reduced, and the present invention supports the height that the stacker buffer of C language and C Plus Plus program is overflowed
Effect checks, can solve all stacker buffer overflow problems, the effective reliability for improving software.The application uses one simultaneously
The representation method of the buffering area of kind extension, can easily judge whether buffering area is deposited using labeling head field and tail tag field
In overflow error.
Description of the drawings
Fig. 1 is the Organization Chart for the framework that concurrently detection stacker buffer disclosed in the present application is overflowed.
Fig. 2 is the structure chart of the buffering area of the application construction.
Specific implementation mode
The following further describes the specific embodiments of the present invention with reference to the drawings.
Referring to FIG. 1, this application discloses a kind of framework that concurrently detection stacker buffer is overflowed, which includes:It is several
A user thread, monitoring thread, the Data buffer without lock, the data warehouse without lock and transmission thread, Fig. 1 is to include user's line
For 1~N of journey, N is positive integer.Each user thread can store information on Data buffer, and data warehouse is supported multi-thread
Insertion, deletion or the access information of Cheng Bingfa, transmission thread are non-obstruction thread, for replicating the information in Data buffer
Into data warehouse.
Wherein, the data structure of Data buffer is the FIFO (FirstInput based on a single producer list consumer
First Output, First Input First Output) buffer circle of N-free diet method realizes, this structure allow producer thread and
Consumer thread simultaneously operates this buffer circle, while in order to avoid that can not be entered when buffer circle is full
Team operates, and it is exactly that many annulars are slow in fact that the application further uses loop chain data structure, this loop chain to Data buffer
Rush the chained list that area is constituted.Whenever there are one rings to have expired just there are one the generation of new ring, producer thread creates twice of appearance
The new ring of amount is simultaneously connected on the tail of previous full ring, and then producer thread starts to be inserted into element into new ring.Phase
It answers, when carrying out dequeue operation, if as soon as annular space and the ring that do not consume also below, discharge this ring and connect
The next ring of processing.Because the size of ring is exponentially increased, as long as producer thread and the speed of consumer thread are
Consistent, then the size of entire loop chain data structure will enter a stable state quickly.Each producer thread is right
Answer a ring, all such rings can be all inserted into the form of linked list element in loop chain, and consumer each in this way can be along
Loop chain accesses the corresponding ring of all producer threads.In this application, producer thread is user thread, and consumer thread is
Transmit thread.
Data warehouse uses a specific nesting linked list structure, nesting linked list to mean each element of chained list
It is a child list, the head node of child list is all a sentinel node, each new node is in sentry's node and first section
It is inserted between point.
Based on framework shown in FIG. 1, disclosed herein as well is a kind of method that concurrently detection stacker buffer is overflowed, this method
Include the following steps:
1st step:Construct buffering area.User program calls memory allocation function application allocation buffer in heap memory, together
When change buffer information by way of program pitching pile, this is that the default dynamic that is inserted into memory allocation function with one is shared
Library is come what is realized, and the application is by taking memory allocation function is malloc functions as an example.Default dynamic shared library includes constructor, when
It can start this constructor at the beginning of monitoring programme to execute the work of initialization.The construction master of buffering area in the application
If being inserted into two tag fields, a head tag field and a tail tag field at the both ends of each buffering area, then construct
The structure of obtained buffering area is as shown in Fig. 2, include size field, labeling head field, buffer stopper field and tail marker word successively
Section:
(1) value of size field by buffer size and first key encryption generate, using this size field value just
The address of tail tag note can be positioned will not thus be utilized since buffer size is encrypted by potential attacker.
(2) labeling head field is encrypted by buffer size, buffer zone address and the second key and is generated, due to being using buffering
Regional address generates the value of labeling head field, therefore there are one unique labeling head fields each buffering area, even if buffering area
Labeling head field reveal, attacker also is difficult to forgery one of going down the case where not knowing buffer size and buffer zone address
Head tag field.
(3) tail tag field is encrypted by buffer size, buffer zone address and third key and is generated, due to being using buffering
Regional address generates the value of tail tag field, therefore there are one unique tail tag fields each buffering area, even if buffering area
Tail tag field reveal, attacker also is difficult to forgery one of going down the case where not knowing buffer size and buffer zone address
A tail tag field.
In constructor, the value of above-mentioned first key, the second key and third key is all random initializtion, the application
Framework in data structure be exactly to be created and initialize in this way, it and user thread have shared an address space, institute
The memory block for storing data structure and each key that the present invention uses is distributed with mmap functions, and by two
A these data of inaccessible page protection, in this way these data would not be spilled off.
2nd step:Memory allocation function calls the buffer information for the buffering area that can return to dynamic allocation, and user thread is not
It is that the buffer information for directly returning to memory allocation function is stored into data warehouse, but first returns to memory allocation function
Buffer information be dynamically inserted into Data buffer, buffer information includes buffer size and buffer zone address etc..
Specifically, as described previously for each user thread, when it, which encounters first malloc, calls, which will
It executes above-mentioned 1st step and creates ring corresponding with the user thread, it is temporary to be then inserted into data as a linked list element
In the loop chain of storage.
3rd step, transmission thread are responsible for remaining information unloading work, the buffer information in Data buffer are sent to
In data warehouse.
4th step is stored in data warehouse by being inserted into thread by each buffer information that thread is sent is transmitted.In journey
When sequence is incipient, there are one the child lists of data warehouse, and supports one to be inserted into thread and be inserted into node thereto, with
The operation of program, if there is new insertion thread needs to be inserted into data with regard to one new child list of corresponding establishment, and by the son
Chained list is connected to the end of a child list.
5th step, monitoring thread traverse while buffer information is inserted into Data buffer by each user thread
Each buffer information in data warehouse typically calls traversal function to carry out traversal detection, namely is being inserted into thread to number
When according to being inserted into node in warehouse, while allowing to traverse the entire nesting linked list of thread traverses, the operation of the two threads can be parallel,
But it should be recognized that being inserted into thread only operates oneself corresponding child list, and all child lists can be traversed by traversing thread.
Monitoring thread is searched according to buffer information overflows buffering area, and it is the buffering area there are overflow error to overflow buffering area, due to it
Preceding step has been ready for sufficient preparation, and the process of detection is very simple, mainly according to the size of buffer information
The comparison of the value of field, labeling head field and tail tag field judges whether buffering area overflows:
The first situation, if a upper buffer overflow for a buffering area, to the buffering area, namely there are upper spillings
When mistake, then the value of the labeling head field of the buffering area will be inconsistent with the value that is recorded in data warehouse, due to buffering area
Size field and labeling head field in information are all to be encrypted to generate by buffer size, namely all have recorded buffering area, because
This in buffer information size field and labeling head field decrypt obtain buffer size respectively, if size field is decrypted
To the buffer size decrypted of buffer size and labeling head field it is inconsistent, then illustrating the buffering area, there are upper spillings
Mistake, if unanimously, illustrating that upper overflow error is not present in the buffering area.
The second situation, if lower spilling occurs for a buffering area, the value of the tail tag field of the buffering area will
Change, due in buffer information size field and tail tag field be all by buffer size encrypt generate,
All have recorded buffering area, thus in buffer information size field and tail tag field decrypt that obtain buffering area big respectively
It is small, if the buffer size decrypted of size field and the buffer size that tail tag field is decrypted are inconsistent, say
Overflow error in the presence of the bright buffering area, if unanimously, illustrating overflow error in the absence of the buffering area.
When monitoring thread detects the corresponding buffering area of buffer information, there are upper overflow error and/or lower overflow errors
When, it is determined that the corresponding buffering area of the buffer information is to overflow buffering area, and carry out fault alarm, and the spilling is prompted to buffer
The overflow error that area occurs.In addition, if data warehouse is not empty, the traversal that monitoring thread will recycle.
6th step, when user thread no longer needs the buffering area using distribution, which becomes failure buffering area, uses
Family thread needs that memory release function application is called to discharge the failure buffering area, and the function of memory release in this application is free letters
Number.When the buffering area that fails is released, monitoring thread traverses that the failure buffering area is stored in data warehouse is corresponding slow
When rushing the node of area's information, compared with being gone with the value in corresponding memory headroom, since failure buffering area is released, memory
In value and node value it is significantly different, then monitoring thread just will be considered that the buffering area there are overflow error and report an error, this is aobvious
It is so wrong report, therefore in order to avoid the appearance of such case, when the buffering area that fails is released, storage should in data warehouse
The node of the corresponding buffer information of failure buffering area should all be deleted.These nodes are deleted in the inside of free function calls
The expense of user program will obviously be increased, solve the problems, such as this using two methods in this application:
First method is a simple two steps Memory recycle algorithm, first, when a memory discharges function call quilt
When intercepting and capturing, meaning that buffering area needs to discharge, memory release function marks the failure buffering area with a failure mark, this
A invalid markers are typically that labeling head field in the corresponding buffer information of buffering area and a release key encryption generate,
The release key is that random initializtion generates.Memory release function is returned to after only marking failure buffering area without deleting the mistake
Imitate buffering area.Then, it when monitoring thread ergodic data warehouse traverses the corresponding buffer information of the failure buffering area, can examine
It measures including invalid markers, then discharge this failure buffering area and the corresponding buffer information of failure buffering area is deleted
It removes, this method can remove expired buffer information and will not bring wrong report.
Second method will not bring Memory recycle to postpone, it require that in the buffer information of failure buffering area
Some changes are made in labeling head field and tail tag field, and need the help of recovery tool, have one in labeling head field
A random number, and tail tag field is the value of labeling head field and the encryption of key that one generates at random generates as a result, this
The address of random number and buffering area can all be collected by the node in data warehouse.In memory discharges function call, it can examine
It looks into the failure corresponding buffer information of buffering area and whether there is overflow error come the buffering area that judges to fail, specifically decrypt labeling head
Field and tail tag field judge whether the two is identical, if it is not the same, then there are overflow error, prisons for this failure buffering area
Fault alarm can be carried out when control corresponding to the failure buffering area node of thread traverses;If identical, this failure buffering area
There is no overflow errors, then the labeling head field in the buffer information of memory release function modification failure buffering area, usually will
Labeling head field is revised as 0, then discharges the failure buffering area and memory release function returns.When monitoring thread ergodic data
When warehouse traverses the failure buffering area corresponding buffer information, it is found that the value sum number of the actual labeling head field of buffering area
Different according to the labeling head field in the buffer information stored in warehouse, then monitor can assume that this buffering area is released
It puts, and deletes corresponding buffer information in data warehouse.
In addition, due to the application be based on without lock data structure, and without lock data structure common fault be node deletion with
There is competition between insertion:If when first node be judged as it is expired invalid, it should be directly deleted, otherwise can
Chained list collapse and node loss are caused, but there is a special case, due to using without lock data structure, being saved when there are one new
When point is being inserted into, if first node is just deleted, chained list just collapses, because the node being newly inserted into can quilt
As soon as being linked on deleted node, the child list is disconnected in this way;Another situation is exactly when first node is true
Fixed to be deleted, a new node is ready for insertion into chained list, if monitoring thread just calls traversal thread traverses to this node
Place, traversal thread do not know which node first accessed, and final result is exactly that first node is deleted, and sentinel node is connected to
On the next node of sentinel node, the new node to be inserted into loss is allowed in this way.Therefore monitoring thread is deleting data
When node in warehouse, need to consider race problem, in non blocking algorithm, a side for commonly solving such race problem
Method is:CAS insertions or deletion of node are used in a cycle, and still, comparatively run-time overhead is relatively high by CAS, this master
If repeatedly calling CAS instruction since concurrent contention operation may repeatedly fail, such case will delay entire thread
Progress.The application solves the problems, such as that the method competed without using CAS is:Only when new node is already inserted into, head is saved
Point can just be deleted, such new node can safety be inserted between sentinel node and first node, the insertion of node with delete
Except being not above section at the same time, to which also just there is no compete.Particularly, it is when first node has determined
It needs deleted, just a special labeling function is called to be marked as to be deleted, this labeling function can should
A failure flag bit in the codomain of node is set as the least significant bit of null or the next node of the node,
Because node address always word alignment and next node be previously used not yet, then, when that labeled node not
When being first node again, it will be deleted when traversing next time.
It can thus be seen that in this application, the life cycle of the buffering area of a dynamic allocation can be divided into three ranks
Section:First stage is the front-end detection stage, this stage is happened at the inside of memory allocation function calling, a buffering area by
Three words are constituted, this obviously requires the high of distribution, first, be used to the buffer information of detection at the beginning than user thread
(such as buffer zone address, size) can be admitted to Data buffer, and then memory allocation function calling can return to a user buffering
The address in area.Second stage is the overflow checking stage, and buffer information is transferred to data by transmission thread from Data buffer
In warehouse, this buffer information is monitored thread for detecting whether buffering area overflows, while working as transmission thread by buffering area
When information is transferred to from Data buffer in data warehouse, the front-end detection stage just finishes.Three phases are end point detections
Stage, this stage are happened in memory release function call, need the one special failure mark of failure buffering area discharged
Remember to mark, then when monitoring thread checks buffering area and finds that it has been released, monitoring thread can be by expired buffering area
Information is removed from data warehouse, therefore is monitoring thread rather than user thread clears up expired metadata information.
Above-described is only the preferred embodiment of the application, and present invention is not limited to the above embodiments.It is appreciated that this
The other improvements and change that field technology personnel directly export or associate without departing from the spirit and concept in the present invention
Change, is considered as being included within protection scope of the present invention.
Claims (10)
1. a kind of framework that concurrently detection stacker buffer is overflowed, which is characterized in that the framework includes:Several user threads,
Monitoring thread, Data buffer, data warehouse and transmission thread, the Data buffer and the data warehouse are without lock and institute
It states data warehouse and supports that multi-thread concurrent, the transmission thread are non-obstruction thread;User thread calls memory allocation function Shen
The please allocation buffer in heap memory, the memory allocation function return to the buffer information dynamically distributed, the user thread
The buffer information of the buffering area is dynamically inserted into the Data buffer, the transmission thread is temporary by the data
Buffer information in storage is sent in the data warehouse, buffer information described in the data warehouse storage;The prison
Control thread traverses the data while buffer information is inserted into the Data buffer by each user thread
Each buffer information in warehouse, and searched according to buffer information and overflow buffering area and failure buffering area, by the data
Buffer information corresponding with the spilling buffering area and the failure buffering area is deleted in warehouse, and the spilling buffering area is to deposit
In the buffering area of overflow error, the failure buffering area is the buffering area being released.
2. framework according to claim 1, which is characterized in that the Data buffer uses loop chain data structure, described
Data warehouse uses nesting linked list structure.
3. a kind of method that concurrently detection stacker buffer is overflowed, the method are based on framework as claimed in claim 1 or 2,
It is characterized in that, the method includes:
Default dynamic shared library is inserted into memory allocation function by way of program pitching pile, the user thread calls institute
Memory allocation function application allocation buffer in heap memory is stated, the memory allocation function returns to the buffering area letter dynamically distributed
The buffer information of the buffering area is dynamically inserted into the Data buffer by breath, the user thread, the buffering
The corresponding buffer information in area includes size field, labeling head field, buffer stopper field and tail tag field successively;
Buffer information in the Data buffer is sent in the data warehouse by the transmission thread;
The each buffer information of data warehouse storage;
The monitoring thread traverses institute while buffer information is inserted into the Data buffer by each user thread
Each buffer information in data warehouse is stated, and is searched according to buffer information and overflows buffering area, the spilling buffering area is
There are the buffering areas of overflow error;
The monitoring thread carries out fault alarm, and the fault alarm is used to indicate the overflow error that the spilling buffering area occurs
Accidentally.
4. described according to the method described in claim 3, it is characterized in that, the default dynamic shared library includes constructor
The value of size field is generated by buffer size and first key encryption, and the labeling head field is by buffer size, buffering area
Address and the encryption of the second key generate, and the tail tag field is encrypted by buffer size, buffer zone address and third key and given birth to
At the first key, the second key and third key are generated by the constructor random initializtion.
5. according to the method described in claim 4, it is characterized in that, described search spilling buffering area, packet according to buffer information
It includes:
According to the size field and the corresponding buffering area of the labeling head field detection buffer information in the buffer information
With the presence or absence of upper overflow error;
According to the size field and the corresponding buffering area of the tail tag field detection buffer information in the buffer information
With the presence or absence of lower overflow error;
When the corresponding buffering area of the buffer information is there are when upper overflow error and/or lower overflow error, the buffering is determined
Information corresponding buffering area in area's is to overflow buffering area.
6. according to the method described in claim 5, it is characterized in that, the size field according in the buffer information and
Labeling head field detects the corresponding buffering area of the buffer information and whether there is upper overflow error, including:
Size field in the buffer information is decrypted to obtain buffer size;
Labeling head field in the buffer information is decrypted to obtain buffer size;
Detect the buffer size that the buffer size that the size field is decrypted is decrypted with the labeling head field
It is whether consistent;
If inconsistent, it is determined that there are upper overflow errors for the corresponding buffering area of the buffer information;
If consistent, it is determined that upper overflow error is not present in the corresponding buffering area of the buffer information.
7. according to the method described in claim 5, it is characterized in that, the size field according in the buffer information and
Tail tag field detects the corresponding buffering area of the buffer information and whether there is lower overflow error, including:
Size field in the buffer information is decrypted to obtain buffer size;
Tail tag field in the buffer information is decrypted to obtain buffer size;
Detect the buffer size that the buffer size that the size field is decrypted is decrypted with the tail tag field
It is whether consistent;
If inconsistent, it is determined that overflow error in the presence of the corresponding buffering area of the buffer information;
If consistent, it is determined that overflow error in the absence of the corresponding buffering area of the buffer information.
8. according to any method of claim 3 to 7, which is characterized in that the method further includes:
The user thread calls memory release function application release failure buffering area;
The monitoring thread deletes buffer information corresponding with the failure buffering area in the data warehouse.
9. according to the method described in claim 8, it is characterized in that, the method further includes:
The memory release function is that the failure buffering area adds invalid markers and returns;
The monitoring thread deletes buffer information corresponding with the failure buffering area in the data warehouse, including:
The monitoring thread traverses each buffer information in the data warehouse and finds out the buffering including invalid markers
Area's information, failure buffering area described in the monitoring thread release heap memory are simultaneously deleted slow with the failure in the data warehouse
Rush the corresponding buffer information in area.
10. according to the method described in claim 8, it is characterized in that, the method further includes:
The memory release function judges that the failure buffering area whether there is according to the buffer information of the failure buffering area
Overflow error;
When the failure buffering area is there are when overflow error, the memory release function changes the buffering area of the failure buffering area
Labeling head field in information, the memory release function only mark the failure buffering area and return;
The monitoring thread deletes buffer information corresponding with the failure buffering area in the data warehouse, including:
What is stored in the value of the corresponding actual labeling head of monitoring thread detection buffering area and the data warehouse is described slow
Whether the value for rushing the corresponding labeling head in area is identical;
If differing, it is determined that the buffering area be failure buffering area and delete in the data warehouse with the failure buffering area
Corresponding buffer information, the monitoring thread discharge the failure buffering area in heap memory simultaneously.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810313731.XA CN108614772A (en) | 2018-04-10 | 2018-04-10 | The framework and method of a kind of concurrently detection stacker buffer spilling |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810313731.XA CN108614772A (en) | 2018-04-10 | 2018-04-10 | The framework and method of a kind of concurrently detection stacker buffer spilling |
Publications (1)
Publication Number | Publication Date |
---|---|
CN108614772A true CN108614772A (en) | 2018-10-02 |
Family
ID=63659886
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810313731.XA Pending CN108614772A (en) | 2018-04-10 | 2018-04-10 | The framework and method of a kind of concurrently detection stacker buffer spilling |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108614772A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109361510A (en) * | 2018-11-07 | 2019-02-19 | 西安电子科技大学 | A kind of information processing method that supporting overflow checking and big integer arithmetic and application |
CN109446022A (en) * | 2018-10-12 | 2019-03-08 | 厦门市美亚柏科信息股份有限公司 | A kind of detection method, device and the storage medium of database overflow page exception |
CN109918904A (en) * | 2019-03-07 | 2019-06-21 | 阿莫斯(北京)科技有限公司 | A kind of ether mill data processing method, monitoring device and storage medium |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6829686B2 (en) * | 2001-02-08 | 2004-12-07 | Sun Microsystems, Inc. | Method and apparatus for bag-to-set, buffering remembered set |
CN101599046A (en) * | 2009-06-26 | 2009-12-09 | 深圳市茁壮网络股份有限公司 | A kind of internal-memory detection method and device |
-
2018
- 2018-04-10 CN CN201810313731.XA patent/CN108614772A/en active Pending
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6829686B2 (en) * | 2001-02-08 | 2004-12-07 | Sun Microsystems, Inc. | Method and apparatus for bag-to-set, buffering remembered set |
CN101599046A (en) * | 2009-06-26 | 2009-12-09 | 深圳市茁壮网络股份有限公司 | A kind of internal-memory detection method and device |
Non-Patent Citations (1)
Title |
---|
QIANG ZENG等: "Cruiser: Concurrent Heap Buffer Overflow Monitoring Using Lock-Free Data Structures", 《PROCEEDINGS OF THE 32ND ACM SIGPLAN CONFERENCE ON PROGRAMMING LANGUAGE DESIGN AND IMPLEMENTATION》 * |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109446022A (en) * | 2018-10-12 | 2019-03-08 | 厦门市美亚柏科信息股份有限公司 | A kind of detection method, device and the storage medium of database overflow page exception |
CN109446022B (en) * | 2018-10-12 | 2022-08-12 | 厦门市美亚柏科信息股份有限公司 | Method and device for detecting abnormal overflow page of database and storage medium |
CN109361510A (en) * | 2018-11-07 | 2019-02-19 | 西安电子科技大学 | A kind of information processing method that supporting overflow checking and big integer arithmetic and application |
CN109361510B (en) * | 2018-11-07 | 2021-06-11 | 西安电子科技大学 | Information processing method supporting overflow detection and large integer operation and application |
CN109918904A (en) * | 2019-03-07 | 2019-06-21 | 阿莫斯(北京)科技有限公司 | A kind of ether mill data processing method, monitoring device and storage medium |
CN109918904B (en) * | 2019-03-07 | 2021-08-31 | 阿莫斯(北京)科技有限公司 | Ether house data processing method, monitoring device and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Herlihy et al. | A simple optimistic skiplist algorithm | |
CN109643255B (en) | Automatically detecting distributed concurrency errors in a cloud system | |
CN103455424B (en) | Based on Dram leakage detection method and the device of vxworks operating system | |
CN101553769B (en) | Method and system for tracking and monitoring computer applications | |
US8375062B2 (en) | Simple optimistic skiplist | |
US6009269A (en) | Detecting concurrency errors in multi-threaded programs | |
US7657894B2 (en) | Detecting lock acquisition hierarchy violations in multithreaded programs | |
Holt | On deadlock in computer systems | |
Herlihy et al. | A provably correct scalable concurrent skip list | |
CN108614772A (en) | The framework and method of a kind of concurrently detection stacker buffer spilling | |
US20110107151A1 (en) | Method and System of Deadlock Detection in a Parallel Program | |
JP3611295B2 (en) | Computer system, memory management method, and storage medium | |
US20100042584A1 (en) | Concurrent lock-free skiplist with wait-free contains operator | |
CN104750459A (en) | Processor With Transactional Capability and Logging Circuitry To Report Transactional Operations | |
US8732142B2 (en) | Generation of suggestions to correct data race errors | |
US20080201393A1 (en) | Identifying unnecessary synchronization objects in software applications | |
US8135690B2 (en) | Concurrency object classification | |
Moreno et al. | On the implementation of memory reclamation methods in a lock-free hash trie design | |
US9454556B2 (en) | Indexing using a lockless burst trie | |
Sinha et al. | Predicting serializability violations: SMT-based search vs. DPOR-based search | |
US10521327B2 (en) | Non-coupled software lockstep | |
CN102156631A (en) | Method and system for managing indicator in programming language | |
Wolff | Verifying Non-blocking Data Structures with Manual Memory Management | |
CN106326094A (en) | Method and system for inspecting abnormity of pointer | |
CN102685590A (en) | Method and device for managing set top box memory |
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 | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20181002 |
|
RJ01 | Rejection of invention patent application after publication |