For the processing method of abnormal process end operation, device and electronic device
Technical field
The present invention relates to protection field is applied, in particular to a kind of processing side for abnormal process end operation
Method, device and electronic device.
Background technique
There are certain collapse probabilities for the software application run in systems, in the prior art, apply and are being abnormal
When leading to collapse, common processing method is the compulsory end application process of system, or first pops up one for illustrating to occur
Then abnormal dialog box forces end process, can not restore normal application state, this processing mode can be brought to user
Hostile user's experience.
For the above problem present in the relevant technologies, at present it is not yet found that the solution of effect.
Summary of the invention
The embodiment of the invention provides a kind of for the processing method of abnormal process end operation, device and electronic device,
Processing method when at least solving the problems, such as that application is abnormal in the prior art can not restore application state.
According to one embodiment of present invention, a kind of processing method for abnormal process end operation is provided, comprising:
The data for the specified task stack applied of backing up in realtime, obtain mirror stacks data, wherein task stack is used to be stored with the structure of stack and be lived
Dynamic module data;Whether abnormal process end operation is called in snoop-operations system;If called, judge to the end of into
Whether journey is specified application;If it is specified application, the movable component data that stack top is located in mirror stacks data are popped up, are obtained
Restore stack data;According to stack data are restored, restore the task stack of specified application, and starts the task stack for being currently at specified application
Stack top movable component.
Further, the data for the specified task stack applied of backing up in realtime, obtain mirror stacks data, comprising: snoop-operations
Whether the object run in system for task stack is called, wherein object run includes the bullet to the stack top data of task stack
The operation of data is operated and is pressed into task stack out;Listen to object run it is called when, obtain what object run was directed to
Task stack data;Judge whether the movable component object that object run is directed to is the specified activity group applied according to task stack data
Part;If it is, updating the mirror stacks data for specified application according to the task stack data of object run.
Further, the data for the specified task stack applied of backing up in realtime, obtain mirror stacks data, comprising: with default week
In phase read operation system there is currently task stack data;Using the name character string of the movable component of specified application,
The matching of canonical formula is executed in the data of the task stack read;Determine that the corresponding task stack of matched data is appointing for specified application
Business stack, and mirror stacks data are updated according to the data of the task stack of specified application.
Further, according to stack data are restored, restore the task stack of specified application, comprising: allow to execute abnormal process knot
Beam operation, to delete the task stack of specified application;Utilize the task stack for restoring the specified application of stack data reconstruction.
Further, according to stack data are restored, restore the task stack of specified application, comprising: forbid executing abnormal process knot
Beam operation, to retain the task stack of specified application;The stack top movable component data of the task stack of the specified application of pop-up;Stack will be popped up
The task stack for serving as a fill-in the specified application after is compared with stack data are restored;If compared unanimously, execution is currently at finger
Surely the movable component of the stack top for the task stack applied;It is if comparison is inconsistent, the data in the task stack of specified application are clear
It removes, and is pressed into and restores stack data.
Further, abnormal process end operation is used to terminate to occur the process of specified loophole.
According to another embodiment of the invention, a kind of processing unit for abnormal process end operation is provided, it should
Device includes: backup module, and the data of the task stack for specified application of backing up in realtime obtain mirror stacks data, wherein task
Stack is used to store movable component data with the structure of stack;Module is monitored, for abnormal process end operation in snoop-operations system
Whether it is called;Judgment module, if judging whether the process to the end of is specified application for called;Execution module is used
In if it is specified application, the movable component data that stack top is located in mirror stacks data are popped up, be restored stack data;Restore
Module for restoring the task stack of specified application according to stack data are restored, and starts the task stack for being currently at specified application
The movable component of stack top.
Further, backup module includes: monitoring unit, for being directed to the object run of task stack in snoop-operations system
Whether it is called, wherein object run includes that data are pressed into the ejection operation of the stack top data of task stack and into task stack
Operation;Acquiring unit, for listen to object run it is called when, obtain the task stack data that object run is directed to;Sentence
Disconnected unit, for judging whether the movable component object that object run is directed to is the specified activity group applied according to task stack data
Part;First updating unit, for if it is, updating the mirror stacks for specified application according to the task stack data of object run
Data.
Further, backup module includes: reading unit, for in predetermined period read operation system there is currently
The data of task stack;Matching unit, for the name character string of the movable component using specified application, in the task stack read
Data in execute canonical formula matching;Second updating unit, for determining that the corresponding task stack of matched data is specified application
Task stack, and according to the data of the task stack of specified application update mirror stacks data.
Further, recovery module includes: the first logic unit, for allowing to execute abnormal process end operation, to delete
Except the task stack of specified application;Reconstruction unit, for utilizing the task stack for restoring the specified application of stack data reconstruction.
Further, recovery module includes: the second logic unit, abnormal process end operation is executed for forbidding, to protect
Stay the task stack of specified application;Unit is popped up, the stack top movable component data of the task stack of specified application are used for ejecting;It compares single
Member, for the task stack of the specified application after pop-up stack top data to be compared with stack data are restored;First execution unit is used
If consistent in comparing, the movable component for being currently at the stack top of task stack of specified application is executed;Second execution unit is used
If inconsistent in comparison, by the data dump in the task stack of specified application, and it is pressed into and restores stack data.
Further, abnormal process end operation is used to terminate to occur the process of specified loophole.
According to still another embodiment of the invention, a kind of storage medium is additionally provided, meter is stored in the storage medium
Calculation machine program, wherein the computer program is arranged to execute the step in any of the above-described embodiment of the method when operation.
According to still another embodiment of the invention, a kind of electronic device, including memory and processor are additionally provided, it is described
Computer program is stored in memory, the processor is arranged to run the computer program to execute any of the above-described
Step in embodiment of the method.
Through the invention, abnormal in listening to operating system by the data of the task stack for specified application of backing up in realtime
Process end operation is called and whether the process to the end of is specified in application, restoring specified application according to the data of backup
Task stack, and start the movable component for being currently at the stack top of task stack of specified application, reached reduction application state
Technical effect solves the problems, such as that processing method when application is abnormal in the prior art can not restore application state.
Detailed description of the invention
The drawings described herein are used to provide a further understanding of the present invention, constitutes part of this application, this hair
Bright illustrative embodiments and their description are used to explain the present invention, and are not constituted improper limitations of the present invention.In the accompanying drawings:
Fig. 1 is the flow chart of the processing method according to an embodiment of the present invention for abnormal process end operation;
Fig. 2 is the schematic diagram of the processing unit according to an embodiment of the present invention for abnormal process end operation.
Specific embodiment
In order to make those skilled in the art more fully understand application scheme, below in conjunction in the embodiment of the present application
Attached drawing, the technical scheme in the embodiment of the application is clearly and completely described, it is clear that described embodiment is only
The embodiment of the application a part, instead of all the embodiments, in the absence of conflict, embodiment and reality in the application
The feature applied in example can be combined with each other.Based on the embodiment in the application, those of ordinary skill in the art are not making wound
Every other embodiment obtained under the premise of the property made labour, shall fall within the protection scope of the present application.
It should be noted that the description and claims of this application and term " first " in above-mentioned attached drawing, "
Two " etc. be to be used to distinguish similar objects, without being used to describe a particular order or precedence order.It should be understood that using in this way
Data be interchangeable under appropriate circumstances, so as to embodiments herein described herein can in addition to illustrating herein or
Sequence other than those of description is implemented.In addition, term " includes " and " having " and their any deformation, it is intended that cover
Cover it is non-exclusive include, for example, the process, method, system, product or equipment for containing a series of steps or units are not necessarily limited to
Step or unit those of is clearly listed, but may include be not clearly listed or for these process, methods, product
Or other step or units that equipment is intrinsic.
Embodiment 1
A kind of processing method for abnormal process end operation is present embodiments provided, can be applied to client-side,
Wherein, client can run among PC, mobile terminal, handheld terminal or other arithmetic facility.It operates in not
Same arithmetic facility is only difference of the scheme in executing subject, and those skilled in the art, which are contemplated that, runs energy in nonidentity operation equipment
Enough generate identical technical effect.
As shown in Figure 1, the processing method provided in this embodiment for abnormal process end operation includes the following steps:
Step 101, the data for the specified task stack applied of backing up in realtime, obtain mirror stacks data.
Task stack (activitystack) is used to store movable component (activity) data with the structure of stack.It is applying
When responding the change of user's operation generating state, pass through the operation that movable component data are popped up or be pressed into task stack, Lai Shixian
It retracts to the movable component data of previous state or reservation previous state.
Specified application is to need application to be protected, and application is terminated to grasp since collapse etc. is abnormal by abnormal process in order to prevent
Make, or determine application terminated by abnormal process end operation after by specified application recovery before normal state, need
The task stack data of the specified application of backup in real time, to occur to restore task stack data when collapse etc. is abnormal.
Mirror stacks data are the mirror image datas for backing up specified application task stack.Optionally, it can be protected using stack architecture
Mirror stacks data are deposited, that is, the task in mirror stacks data and task stack by mirror stacks come backup tasks stack, in mirror stacks
Stack data are synchronous;It is saved alternatively, can also have sequential data store organisation using other.
A kind of method of the data of the task stack for specified application of optionally backing up in realtime includes:
Step 11, whether the object run in snoop-operations system for task stack is called.That is, snoop-operations system
In whether there is object run, object run is the operation for any one task stack in operating system, and object run includes
Ejection operation to the stack top data of task stack and the operation that data are pressed into task stack.If object run is called,
The event that this calling can be listened to occurs.Specifically, can realize prison by way of the corresponding object run of Hook
It listens.
Step 12, listen to object run it is called when, obtain the task stack data that object run is directed to.Object run
When called, need to be instructed to the object that operation executes, for example, which task stack which movable component data be pressed into, alternatively,
Which task stack which movable component data popped up from.
Step 13, judge whether the movable component object that object run is directed to is the specified work applied according to task stack data
Dynamic component.After getting the task stack data that object run is directed to, the targeted movable component of object run can be determined
Whether object is the specified movable component applied.Since the different movable components of different application have different titles, it can
To be matched based on title, to judge whether the targeted object of object run is the specified movable component applied.
Step 14, if it is, updating the mirror stacks data for specified application according to the task stack data of object run.
That is, according to the mode of operation of object run (being pop-up or indentation) and targeted object (which movable component data) is more
Data in new mirror stacks.
The method of the data of the task stack of another specified application of optionally backing up in realtime includes:
Step 21, in predetermined period read operation system there is currently task stack data.It is peace in operating system
In the case where tall and erect system, which can be executed by an order of Linux, which being capable of read operation
In system there is currently all task stacks data.
Step 22, it using the name character string of the movable component of specified application, is held in the data of the task stack read
The matching of row canonical formula.Since the different movable components of different application have different titles, it can use specified application
The character string of movable component title carries out canonical formula matching in the data read.
Step 23, determine that the corresponding task stack of matched data is the task stack of specified application, and according to specified application
The data of task stack update mirror stacks data.
Step 102, whether abnormal process end operation is called in snoop-operations system.
Abnormal process end operation described in the embodiment of the present invention is to occur to terminate when collapse etc. is abnormal for process
The operation of process can be monitored for example, the operation can be Killprocess method by Hook this method
Whether Killprocess is called.Process when specified loophole (such as local refusal service) occurs, may by abnormal ending into
Journey operates end process, and in an application scenarios, the embodiment of the present invention can be applied to carry out the loophole of local refusal service
It is protected.
It should be noted that monitoring abnormal process end operation for step 101 backup image stack data and step 102
Step, execution sequence can in no particular order, execution independently.
Step 103, if it is called, judge whether the process to the end of is specified application.
If it is called to listen to abnormal process end operation, judge whether the process to the end of is specified application.For example,
The unique identifier (such as PID) that can be distributed in creation by operating system by each process, to identify the process to the end of
It whether is the specified process applied.
Step 104, if it is specified application, the movable component data that stack top is located in mirror stacks data is popped up, are obtained
Restore stack data.
It is usually that process is triggered when being abnormal by being abnormal process end operation, it is therefore intended that application
The movable component data of the stack top of task stack are the reason of being abnormal.Again since mirror stacks data are the specified task stacks applied
Backup, therefore, the stack top data in mirror stacks data is abnormal cause, the movable component data of stack top is popped up, so that mirror
As the stack top of stack data reverts to normal movable component data, be restored stack data.
Step 105, according to stack data are restored, restore the task stack of specified application, and start and be currently at specified application
The movable component of the stack top of task stack.
After the stack data that are restored, restore the specified task stack applied using stack data are restored.It can specifically use
Different reset modes.
A kind of optional reset mode includes the following steps:
Step 31, allow to execute abnormal process end operation, to delete the task stack of specified application;
Step 32, the task stack for restoring the specified application of stack data reconstruction is utilized.
That is, the task stack that will be deleted specified application needs in turn after abnormal process end operation allows execution
It rebuilds a task stack, when reconstruction, is rebuild using stack data are restored.For example, it can will restore stack data sequentially bullet
It out and is pressed into another intermediate stack, then intermediate stack data is sequentially popped up to and are pressed into the task stack of specified application, realize and rebuild
The purpose of the task stack of specified application.
Another optional reset mode includes the following steps:
Step 41, forbid executing abnormal process end operation, to retain the task stack of specified application.The mode forbidden can be with
It is so that it is executed other processes after Hook intercepts abnormal process end operation.
Step 42, the stack top movable component data of the task stack of the specified application of pop-up.Terminate due to being not carried out abnormal process
Operation is retained it is therefore intended that the task stack of application is not deleted, but since stack top data is to lead to abnormal original
Cause pops up the movable component data of stack top, so that stack top data reverts to normal movable component data.
Step 43, the task stack of the specified application after pop-up stack top data is compared with stack data are restored.
Step 44, if comparing the movable component for unanimously executing the stack top for the task stack for being currently at specified application.
Step 45, it if comparison is inconsistent, by the data dump in the task stack of specified application, and is pressed into and restores stack number
According to.
The embodiment of the present invention passes through the execution for dynamically capturing abnormal process end operation, to monitor the operation of specified application
State, and when being abnormal causes application process to be moved to end, cooperation activitystack realizes the reduction of application state,
Particularly, it is monitored if being directed to the abnormal process end operation that some particular vulnerabilities cause, can have leakage in application
Hole causes to restore application state when collapse, has achieved the effect that carry out protective treatment to loophole.
It should be noted that step shown in the flowchart of the accompanying drawings can be in such as a group of computer-executable instructions
It is executed in computer system, although also, logical order is shown in flow charts, and it in some cases, can be with not
The sequence being same as herein executes shown or described step.
Through the above description of the embodiments, those skilled in the art can be understood that according to above-mentioned implementation
The method of example can be realized by means of software and necessary general hardware platform, naturally it is also possible to by hardware, but it is very much
In the case of the former be more preferably embodiment.Based on this understanding, technical solution of the present invention is substantially in other words to existing
The part that technology contributes can be embodied in the form of software products, which is stored in a storage
In medium (such as ROM/RAM, magnetic disk, CD), including some instructions are used so that a terminal device (can be mobile phone, calculate
Machine, server or network equipment etc.) execute method described in each embodiment of the present invention.
Embodiment 2
Additionally provide a kind of processing unit for abnormal process end operation in the present embodiment, the device for realizing
Above-described embodiment 1 and its preferred embodiment, to the term or implementation not being described in detail in this present embodiment, reference can be made to embodiment
Related description in 1, the descriptions that have already been made will not be repeated.
Term " module " as used below, can be achieved on the combination of the software and/or hardware of predetermined function.Although
Device described in following embodiment is preferably realized with software, but the combined realization of hardware or software and hardware
And can be contemplated.
Fig. 2 is the schematic diagram of the processing unit according to an embodiment of the present invention for abnormal process end operation, such as Fig. 2 institute
Show, which includes: backup module 10, monitors module 20, judgment module 30, execution module 40 and recovery module 50.
Wherein, backup module, which is used to back up in realtime, specifies the data of the task stack of application, obtains mirror stacks data, wherein
Task stack is used to store movable component data with the structure of stack;Monitor module terminates to grasp for abnormal process in snoop-operations system
Whether it is called;If judgment module judges whether the process to the end of is specified application for being called;Execution module is used
In if it is specified application, the movable component data that stack top is located in mirror stacks data are popped up, be restored stack data;Restore
Module is used to restore according to stack data are restored the task stack of specified application, and starts the task stack for being currently at specified application
The movable component of stack top.
Optionally, backup module includes: monitoring unit, and the object run for being directed to task stack in snoop-operations system is
It is no called, wherein object run includes that data are pressed into the ejection operation of the stack top data of task stack and into task stack
Operation;Acquiring unit, for listen to object run it is called when, obtain the task stack data that object run is directed to;Judgement
Unit, for judging whether the movable component object that object run is directed to is the specified activity group applied according to task stack data
Part;First updating unit, for if it is, updating the mirror stacks for specified application according to the task stack data of object run
Data.
Optionally, backup module includes: reading unit, for in predetermined period read operation system there is currently appoint
The data of business stack;Matching unit, for the name character string of the movable component using specified application, in the task stack read
The matching of canonical formula is executed in data;Second updating unit, for determining that the corresponding task stack of matched data is specified application
Task stack, and mirror stacks data are updated according to the data of the task stack of specified application.
Optionally, recovery module includes: the first logic unit, for allowing to execute abnormal process end operation, to delete
The task stack of specified application;Reconstruction unit, for utilizing the task stack for restoring the specified application of stack data reconstruction.
Optionally, recovery module includes: the second logic unit, abnormal process end operation is executed for forbidding, to retain
The task stack of specified application;Unit is popped up, the stack top movable component data of the task stack of specified application are used for ejecting;It compares single
Member, for the task stack of the specified application after pop-up stack top data to be compared with stack data are restored;First execution unit is used
If consistent in comparing, the movable component for being currently at the stack top of task stack of specified application is executed;Second execution unit is used
If inconsistent in comparison, by the data dump in the task stack of specified application, and it is pressed into and restores stack data.
Optionally, abnormal process end operation is used to terminate to occur the process of specified loophole.
Data of the embodiment of the present invention by the task stack for specified application of backing up in realtime, the exception in listening to operating system
Process end operation is called and whether the process to the end of is specified in application, restoring specified application according to the data of backup
Task stack, and start the movable component for being currently at the stack top of task stack of specified application, reached reduction application state
Technical effect solves the problems, such as that processing method when application is abnormal in the prior art can not restore application state.
It should be noted that above-mentioned modules can be realized by software or hardware, for the latter, Ke Yitong
Following manner realization is crossed, but not limited to this: above-mentioned module is respectively positioned in same processor;Alternatively, above-mentioned modules are with any
Combined form is located in different processors.
Obviously, those skilled in the art should be understood that each module of the above invention or each step can be with general
Computing device realize that they can be concentrated on a single computing device, or be distributed in multiple computing devices and formed
Network on, optionally, they can be realized with the program code that computing device can perform, it is thus possible to which they are stored
It is performed by computing device in the storage device, and in some cases, it can be to be different from shown in sequence execution herein
Out or description the step of, perhaps they are fabricated to each integrated circuit modules or by them multiple modules or
Step is fabricated to single integrated circuit module to realize.In this way, the present invention is not limited to any specific hardware and softwares to combine.
Embodiment 3
The embodiments of the present invention also provide a kind of storage medium, computer program is stored in the storage medium, wherein
The computer program is arranged to execute the step in any of the above-described embodiment of the method when operation.
Optionally, in the present embodiment, above-mentioned storage medium can include but is not limited to: USB flash disk, read-only memory (Read-
Only Memory, referred to as ROM), it is random access memory (Random Access Memory, referred to as RAM), mobile hard
The various media that can store computer program such as disk, magnetic or disk.
Embodiment 4
The embodiments of the present invention also provide a kind of electronic devices, and optionally, electronic device can be PC, movement
Terminal, handheld terminal or other arithmetic facilities.
Include memory and processor in electronic device, is stored with computer program in the memory, which is set
Operation computer program is set to execute the step in any of the above-described embodiment of the method.
Optionally, above-mentioned electronic device can also include transmission device and input-output equipment, wherein the transmission device
It is connected with above-mentioned processor, which connects with above-mentioned processor.
The foregoing is only a preferred embodiment of the present invention, is not intended to restrict the invention, for the skill of this field
For art personnel, the invention may be variously modified and varied.It is all within principle of the invention, it is made it is any modification, etc.
With replacement, improvement etc., should all be included in the protection scope of the present invention.