CN102609241B - hot patch method and device - Google Patents
hot patch method and device Download PDFInfo
- Publication number
- CN102609241B CN102609241B CN201210018144.0A CN201210018144A CN102609241B CN 102609241 B CN102609241 B CN 102609241B CN 201210018144 A CN201210018144 A CN 201210018144A CN 102609241 B CN102609241 B CN 102609241B
- Authority
- CN
- China
- Prior art keywords
- instruction
- patch
- function
- index value
- patch function
- 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.)
- Active
Links
Abstract
The invention discloses a kind of hot patch method and device, this method includes:Determine that the distance between call instruction and patch function exceed the scope that short jump instruction can redirect;Call instruction is replaced with to the illegal instruction of tape index value, wherein index value corresponds to patch function.The present invention utilizes instruction exception mechanism; call instruction is substituted for the illegal instruction of tape index value; and the index value is corresponded into patch function; so; patch function can be directly performed when target machine execution illegally instructs corresponding abnormality processing function with this and returns; so as to the problem of being realized long jump function with individual instructions, avoided program interrupt.
Description
Technical field
The present invention relates to the communications field, in particular to a kind of hot patch method and device.
Background technology
The basic principle of patching technology is that the function that will be currently running in existing system is substituted for patch function, so as to change
The function of original function, to reach modification systemic-function, or corrects the purpose of existing system failure.Presently disclosed patching technology
There is kinds of schemes, have than more typical technical solution following two:
Patch scheme 1
1. patch function funcA is recompilated, the file destination fileB of relocatable is generated.
2. in target machine parse file destination fileB, extract code segment, data sections, bss sections into memory.
3. analyzing the memory symbol table in target machine, parse by the address of patch function funcC.
4. modification is jump instruction by the first instruction of patch function funcC, patch function funcA is jumped to.
So, it is assumed that when being called by patch function funcC, since the initial order of funcC is a jump instruction,
Then jump directly to go to perform in patch function funcA, when return is returned directly to by the next finger of patch function funcC
Place is made, so as to achieve the purpose that patch function funcA substitutions by patch function funcC.
Patch scheme 2
1. patch function funcA will be needed to recompilate, the file destination fileB of relocatable is generated.
2. parsing file destination fileB, parse the information such as position, the size of patch function funcA and funcB is quoted
The information of external symbol, generation patch information infoE.
3. the file destination fileB of patch information infoE and relocatable are combined the new patch text of generation one
Part fileF.
4. parse patch file fileF in target machine, the text sections of extraction file destination fileB, data sections, bss sections
Into memory.
5. parsing patch file fileF in target machine, patch information infoE is extracted, is remembered according to patch information infoE
Being retrieved by patch function funcD titles in memory symbol table for record, finds by the address of patch function funcD.
6. modification is jump instruction by the first instructions of patch function funcD, patch function funcA is jumped to.
The specific implementation procedure and patch scheme 1 of patch function are just the same, repeat no more.
At present above-mentioned two scheme can not be supported to need the function for carrying out long jump, at least needed there are following defect
Want two instructions to realize long jump, program interrupt, or even the system failure may be caused.
The content of the invention
The present invention provides a kind of hot patch method and device, at least to solve in correlation technique, patching technology realize from
The long jump of patch function is reoriented to by patch function at least needs two instructions, may cause program interrupt, or even system
The problem of failure.
According to an aspect of the invention, there is provided a kind of hot patch method, including:Determine call instruction and patch function
The distance between exceed the scope that can redirect of short jump instruction;Call instruction is replaced with to the illegal instruction of tape index value, its
Middle index value corresponds to patch function.
Preferably, call instruction is replaced with to the illegal instruction of tape index value to be included:Determine for performing replacement operation
Instruction belongs to long jump instruction;Obtain the finger for being used to control PC Ambulant pointer processes in the instruction for being used for performing replacement operation
Order;The illegal instruction of tape index value will be replaced with for the instruction for controlling PC Ambulant pointer processes.
Preferably, the instruction bag for being used to control PC Ambulant pointer processes in the instruction for being used for performing replacement operation is obtained
Include:Long jump instruction is searched in the instruction for performing replacement operation, obtains the instruction for controlling PC Ambulant pointer processes.
Preferably, before call instruction to be replaced with to the illegal instruction of tape index value, the above method further includes:Determine quilt
Patch function is static function;Determine by the file belonging to patch function.
Preferably, determine to be included by the file belonging to patch function:Searched in the symbol table of image file by patch letter
The symbol of file belonging to number;Travel through symbol table, find with by the identical symbol of patch function title;The symbol that record search arrives
Subscript number in symbol table.
Preferably, after call instruction to be replaced with to the illegal instruction of tape index value, the above method further includes:Target machine
During abnormality processing function corresponding with illegally instructing is performed, the address of patch function is obtained according to index value;Target
Patch function address is revised as in the return address of abnormality processing function by machine.
According to another aspect of the present invention, there is provided a kind of hot patch device, including:First determining module, for determining
The distance between call instruction and patch function exceed the scope that short jump instruction can redirect;Replacement module, for that will call
Instruction replaces with the illegal instruction of tape index value, and wherein index value corresponds to patch function.
Preferably, replacement module includes:Determination sub-module, for determining that the instruction for performing replacement operation belongs to long jump
Turn instruction;Acquisition submodule, for obtain be used to perform in the instruction of replacement operation be used for control PC Ambulant pointer processes
Instruction;Submodule is replaced, for the illegal instruction of tape index value will to be replaced with for the instruction for controlling PC Ambulant pointer processes.
Preferably, acquisition submodule includes:Search unit, for searching for long jump in the instruction for performing replacement operation
Turn instruction, obtain the instruction for controlling PC Ambulant pointer processes.
Preferably, above device further includes:Second determining module, is static function for determining by patch function;3rd
Determining module, for determining by the file belonging to patch function.
The present invention utilizes instruction exception mechanism, it would be desirable to which the long jump instruction of execution is substituted for illegally referring to for tape index value
Order, and the index value is corresponded into patch function, in this way, illegally instructing corresponding abnormality processing function with this when target machine is performed
And patch function can be directly performed when returning, so as to realize long jump function with individual instructions, avoid program interrupt
Problem.
Brief description of the drawings
Attached drawing described herein is used for providing a further understanding of the present invention, forms the part of the application, this hair
Bright schematic description and description is used to explain the present invention, does not form inappropriate limitation of the present invention.In the accompanying drawings:
Fig. 1 is the flow chart of hot patch method according to embodiments of the present invention;
Fig. 2 is the flow chart of the hot patch technology of preferred embodiment one according to the present invention;
Fig. 3 is the flow chart of the hot patch technology of preferred embodiment two according to the present invention;
Fig. 4 is the flow chart that patch is carried out to static function of preferred embodiment three according to the present invention;
Fig. 5 is the structure diagram of hot patch device according to embodiments of the present invention;
Fig. 6 is the structure diagram one of hot patch device according to the preferred embodiment of the invention;
Fig. 7 is the structure diagram two of hot patch device according to the preferred embodiment of the invention;
Fig. 8 is the structure diagram three of hot patch device according to the preferred embodiment of the invention;
Fig. 9 is the structure diagram four of hot patch device according to the preferred embodiment of the invention.
Embodiment
It should be noted that in the case where there is no conflict, the feature in embodiment and embodiment in the application can phase
Mutually combination.Below with reference to the accompanying drawings and the present invention will be described in detail in conjunction with the embodiments.
The present invention provides a kind of hot patch method, Fig. 1 is the flow chart of hot patch method according to embodiments of the present invention,
As shown in Figure 1, including steps S102 to step S104.
Step S102, determines that the distance between call instruction and patch function exceed the model that short jump instruction can redirect
Enclose.
Call instruction, is replaced with the illegal instruction of tape index value, wherein index value corresponds to patch function by step S104.
In correlation technique, patching technology, which is realized from the long jump that patch function is reoriented to by patch function, at least needs two
Bar instructs, and may cause program interrupt, or even the system failure.For example, function B (referred to long jump) is jumped to from function A, it is existing
Have in technology and at least realize the jump procedure using two instructions, wherein, function B addresses are realized in one or one or more instruction
Obtain, an instruction realization redirects.In hot patch technology, so it is likely to cause system crash, concrete reason is as follows:Need
Two instructions are at least changed at by patch function first address, such as instruct INST1 and instruction INST2, and during repairing changes,
Very possible some task TASK has just performed instruction INST1, is also not carried out instruction INST2, is just interrupted by patch task.
If it is jump instruction that patch task, which have modified instruction INST1 and instruction INST2, at this time, when task TASK is continued to run with, by
Changed in instruction INST2, and the instruction INST1 with just performing can not be matched completely, be may result in CPU and calculated data
Mistake, and then cause the system failure.
In the embodiment of the present invention, instruction exception mechanism is utilized, it would be desirable to which the long jump instruction of execution is substituted for tape index value
Illegal instruction, and the index value is corresponded into patch function, in this way, when target machine execution illegally instructs corresponding exception with this
Handle function and can directly perform patch function when returning, so as to realize the long jump work(in patching technology with individual instructions
Can, the problem of avoiding program interrupt.
Generally be made of in view of long jump instruction a plurality of instruction, before several instructions be responsible for obtaining called function
Address, the transfer process of the last item instruction control PC pointers.Therefore, modification belong to long jump instruction be used for perform replacement
During the instruction of operation, it is important to find the last item instruction of a plurality of instruction.This instruction is the instruction for really needing to replace.Institute
To include as a preferred embodiment of the present invention, above-mentioned steps S104:Determine the instruction category for performing replacement operation
Instructed in long jump;Obtain the instruction for being used to control PC Ambulant pointer processes in the instruction for being used for performing replacement operation;It will use
The illegal instruction of tape index value is replaced with the instruction of control PC Ambulant pointer processes.In this preferred embodiment, long jump is obtained
Turn to be used for the instruction for controlling PC Ambulant pointer processes in instruction, i.e., really need the instruction replaced, so can be more targeted
The illegal instruction for being replaced with tape index value.
Further, the instruction bag for being used to control PC Ambulant pointer processes in the instruction for being used for performing replacement operation is obtained
Include:Each instruction in long jump instruction is searched in the instruction for performing replacement operation, obtains being used to control PC pointers to turn
Move past the instruction of journey.Above-mentioned acquisition modes are easy, accurate.
Furthermore, it is contemplated that in the memory symbol table of target machine, static symbol is generally not present, so in the prior art not
Can be to static function patch installing.In this regard, the present invention provides it is a kind of need not be by the hot patch of the memory symbol table of target machine
Method.
Now in embedded systems popular executable file format be mainly Linux ELF.Will in ELF file standards
The file for the ELF format that system uses is divided into four kinds:Relocatable file, executable file, shared file destination and core turn
Store up file.Preferable hot patch method provided by the present invention relates only to relocatable file and executable file, just realizes
The positioning of patch function.Wherein, the information included in relocatable file have text sections, bss sections, data sections, reorientation section,
Character list, symbol table, debug sections etc.;The information included in executable file have text sections, bss sections, data sections, character list, symbol
Number table, debug sections etc..
The basic principle of above-mentioned preferable hot patch method is as follows:Analyze executable file used in target machine, parsing
Go out it is all jump to by the position of patch function, all jump to is adjusted to jump to patch function by the instruction of patch function
Place, so can be achieved the installation process of patch.
In executable file, there are the symbol table segment of an entitled .symtab, with the memory symbol table in target machine not
Together, all overall situation function symbols and local functional symbol are included for .symtab sections.But since there may be multiple static functions
Designation is identical, so when realizing to static function patch function, it is necessary to increase to file where static function
Specify, that is, specify and be located at by patch function in which file.
Based on above-mentioned preferable hot patch method and above-mentioned analysis, the present invention can solve existing skill by following scheme
Cannot be to static function patch installing in art the problem of.
Before the step S104 shown in Fig. 1, it is also necessary to perform following steps:Determine by patch function it is static function;
Determine by the file belonging to patch function.Preferably, determine to be included by the file belonging to patch function:In the symbol of image file
Searched in table by the symbol of the file belonging to patch function;Travel through symbol table, find with by the identical symbol of patch function title
Number;Record search to subscript of the symbol in symbol table.Utilize the file belonging to definite static function, you can uniquely determine one
A static function.
Preferably, after step s 104, the above method further includes:Target machine is performing exception corresponding with illegally instructing
During handling function, the address of patch function is obtained according to index value;Target machine is by the return address of abnormality processing function
It is revised as patch function address.
Process, which is described in detail, to be realized to the embodiment of the present invention below in conjunction with example.
Preferred embodiment one
The hot patch method of the present invention mainly utilizes the instruction exception mechanism of CPU, it would be desirable to which the instruction for performing long jump is replaced
Change the illegal instruction of tape index value into, wherein, index value corresponds to patch function.When CPU performs call instruction (long jump instruction)
When, that is, replaced illegal instruction is performed, Program exceptions are produced, in Program abnormality processings, according to what is illegally instructed
Index value obtains the address (being actually subjected to the position redirected) of patch function, and the PC pointers to be performed when abnormality processing is returned are repaiied
The address of patch function obtained is changed to, so as to fulfill the long jump function of individual instructions in hot patch technology.
Fig. 2 is the flow chart of the hot patch technology of preferred embodiment one according to the present invention, as shown in Fig. 2, including following
Step S202 to step S212.
Step S202, creates the illegal instruction catalogue of tape index value, establishes illegal instruction and the destination address (ground of patch function
Location) mapping relations.
Call instruction, is revised as the illegal instruction of tape index value (mapping relations) by step S204, and each index value corresponds to
One patch function.
Herein it needs to be determined that call instruction belongs to long jump instruction or short jump instruction in itself.Long jump instruction implement compared with
For complexity, this is because long jump instruction is generally made of a plurality of instruction in itself, before several instructions be responsible for obtaining it is called
The address of function, the transfer process of the last item instruction control PC pointers.When changing long jump instruction, it is important to find a plurality of
The last item instruction of long jump instruction.Although this instruction is not present in repositioning instruction list, generally occur in
Above after a plurality of instruction, it is possible to according to this finger of long jump instruction search to the end above in relocation table
Order, this last instruction is the instruction for really needing to replace.If call instruction sheet is as short jump instruction, the instruction
This is appeared in relocation table as the instruction for really needing to replace, it is not necessary to does extra search operation.
Step S206, when CPU performs the illegal instruction of tape index value, it is abnormal to produce Program.
Step S208, in Program abnormality processing functions, corresponding patch function is obtained according to illegal instruction index value
Address.
Step S210, by the abnormal address for returning to PC IAes and being revised as patch function.
Step S212, CPU are back at patch function extremely from Program, directly perform destination address (i.e. patch function
Place) instruction.
After patch function is finished, CPU is returned to and continued to execute at next instruction of patch function.
Preferred embodiment two
Fig. 3 is the flow chart of the hot patch technology of preferred embodiment two according to the present invention, as shown in figure 3, including following
Step S302 to step S320.
Step S302, text editor write patch function A, generate patch source file, after compiler processes, generation
Relocatable file destination B.
Step S304, judges that by patch function D be static function or overall situation function.If it is static by patch function D
Function, then perform step S306.If being overall situation function by patch function D, step S308 is performed.
Step S306, determines that the symbol table of traversal image file C, is searched and file G by the file G where patch function D
Corresponding symbol H, records its subscript symbollndex in symbol table.If finding corresponding symbol H, step is performed
S310.If not finding corresponding symbol H, step S312 is performed.
Step S308, the symbol table of traversal image file C, is searched with by the corresponding symbols of patch function D, recording it and according with
Subscript in number table.
Step S310, travels through all function class symbols after H in the symbol table of image file C.
Step S312, is unsuccessfully exited.
Step S314, judges whether to find the symbol that function name is A.If finding, step S316 is performed.If do not look for
Arrive, then perform step S318.
Step S316, records index i of the symbol in symbol table.
Step S318, if run into next filename symbol.If so, step S312 is then performed, if it is not, then performing step
S310。
Step S320, the relocation table of patch tools traversal image file C, finds all and symbollndex phases
Same reorientation table segment entrance.
Step S322, patch tools will relocate table segment symbol generation patch information E associated with it.Patch is believed
Breath E and relocatable file destination B is combined, and forms patch file F.
Here, suppose that there are the relocation table of static function in image file C, if not provided, can be linked by changing
Script retains the reorientation segment information of static function.By relocating entrance, you can orient in need be relocated
Instruct the offset address that runs in memory, i.e., by patch function D in the IA of " where is cited ", and instruction repaiies
Positive way.These reorientation entrances are extracted from image file C, and patch information E is generated with its associated symbol.
Patch control task processing input, receives the request of loading patch file in target machine, and patch file is placed on
In the reserved patch buffer of target machine.Patch control task parses new patch file, by the code segment sum number of patch file
Specific position in memory is loaded into according to section, and records the address of each patch function in memory.Patch control task parses
Patch file, extracts patch information E, E contain the instruction of reorientation in need address, their value is by current patch letter
The instruction correcting mode specified in number A operation addresses in memory and E determines.In addition, also need to check the finger for needing to change
Make whether the distance of address and patch function address has exceeded the short scope redirected.If be not above, according to reorientation rule
Modification instruction.If more than, then need to change instruction by the method for single instrction long jump.Instruction modification finishes
Afterwards, it is to jump to the function jump instruction of patch function initial address to call the instruction modification at by patch function, when CPU is called
During by patch function, patch function entrance is actually jumped to, performs patch function.Realized with this in not interrupt routine
In the case of modify to program.
Preferred embodiment three
In embedded systems, there are substantial amounts of static function, these static functions can equally deposit as overall situation function
Realizing the demand of patch.But be generally not in have static symbol in the memory symbol table of embedded formula aims of systems machine.
Simultaneously as the static function in different files can take identical name, static letter can not be realized by relying on prior art
Several patch functions.In the present invention, patch function is realized since relocatable file and executable file has been fully utilized
Positioning, no longer by the memory symbol table in target machine so that realize that patch function is possibly realized to static function.
In executable file, there are the symbol table segment of an entitled .symtab, with the memory symbol table in target machine not
Together, all overall situation function symbols and local functional symbol are included for .symtab sections.But since there may be multiple static functions
Designation is identical, so when realizing to static function patch function, it is necessary to increase to file where static function
Specify, that is, specifying by patch function is located in which file.Fig. 4 be according to the present invention preferred embodiment three to static function
The flow chart of patch is carried out, as shown in figure 4, including steps S402 to step S404.
Step S402, determines by the file G where patch function D (in this preferred embodiment, D is static function), patch
Image file C used in operation in tools parsing target machine, searches the symbol H for defining file G, if it is not found,
Then unsuccessfully exit.Here, type is that the title corresponding to the symbol of FILE is filename, and type is corresponding to the symbol of FUNC
Title be function name, traversal symbol table can find the symbol H of entitled G.
Step S404, after symbol H is found in the symbol table of image file C, travels through all function classes symbol occurred afterwards
Number, until there is next file symbol.If found with by the identical symbol of patch function D titles, record the symbol and according with
Subscript symbollndex in number table.Then unsuccessfully exit if it is not found,.
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
Performed in computer system, although also, show logical order in flow charts, in some cases, can be with not
The order being same as herein performs shown or described step.
An embodiment of the present invention provides a kind of hot patch device, which can be used for realizing above-mentioned hot patch side
Method.Fig. 5 is the structure diagram of hot patch device according to embodiments of the present invention, as shown in figure 5, including 52 He of the first determining module
Replacement module 54.Its structure is described in detail below.
First determining module 52, for determining that the distance between call instruction and patch function can more than short jump instruction
The scope redirected;Replacement module 54, is connected to the first determining module 52, for the first determining module 52 to be determined be that long jump refers to
The call instruction of order replaces with the illegal instruction of tape index value, and wherein index value corresponds to patch function.
Above-described embodiment utilizes instruction exception mechanism, by the first determining module 52 determine be long jump instruction call instruction
The illegal instruction of tape index value is substituted for by replacement module 54, and the index value is corresponded into patch function, in this way, working as target machine
Execution illegally instructs corresponding abnormality processing function with this and can directly perform patch function when returning, so as to use individual instructions
The problem of realizing the long jump function in patching technology, avoiding program interrupt.
Generally be made of in view of long jump instruction a plurality of instruction, before several instructions be responsible for obtaining called function
Address, the transfer process of the last item instruction control PC pointers.Therefore, modification belong to long jump instruction be used for perform replacement
, it is necessary to find the last item instruction of a plurality of instruction during the instruction of operation.So the present invention provides following preferred solution, Fig. 6
It is the structure diagram one of hot patch device according to the preferred embodiment of the invention, as shown in fig. 6, replacement module 54 includes:Determine
Submodule 542, for determining that the instruction for performing replacement operation belongs to long jump instruction;Acquisition submodule 544, is connected to really
Stator modules 542, for obtaining the instruction for being used to control PC Ambulant pointer processes in the instruction for being used for performing replacement operation;Replace
Change submodule 546, be connected to acquisition submodule 544, for by acquisition submodule 544 obtain be used for control PC Ambulant pointer mistakes
The instruction of journey replaces with the illegal instruction of tape index value.
Fig. 7 is the structure diagram two of hot patch device according to the preferred embodiment of the invention, as shown in fig. 7, obtaining submodule
Block 544 includes:Search unit 5442, for searching for long jump instruction in the instruction for performing replacement operation, is used for
Control the instruction of PC Ambulant pointer processes.
Fig. 8 is the structure diagram three of hot patch device according to the preferred embodiment of the invention, as shown in figure 8, above device
Further include:Second determining module 56, is static function for determining by patch function;3rd determining module 58, is connected to second
Determining module 56, for determining to determine to be static function by the file belonging to patch function as the second determining module 56.
Fig. 9 is the structure diagram four of hot patch device according to the preferred embodiment of the invention, as shown in figure 9, the 3rd determines
Module 58 includes:Submodule 582 is searched, for being searched in the symbol table of image file by the symbol of the file belonging to patch function
Number;Travel through submodule 584, be connected to search submodule 582, for traveling through symbol table, find with by patch function title phase
Same symbol;Record sub module 586, is connected to traversal submodule 584, is searched for recording after traversal submodule 584 travels through
To with the subscript by the identical symbol of patch function title in symbol table.
It should be noted that the hot patch device described in device embodiment corresponds to above-mentioned embodiment of the method, it has
Body realizes that process had carried out detailed description in embodiment of the method, and details are not described herein.
In conclusion according to the abovementioned embodiments of the present invention, there is provided a kind of hot patch method and device.The present invention utilizes
Call instruction, is substituted for the illegal instruction of tape index value by instruction exception mechanism, and the index value is corresponded to patch function, this
Sample, patch function can be directly performed when target machine execution illegally instructs corresponding abnormality processing function with this and returns, from
And the problem of realizing long jump function with individual instructions, avoiding program interrupt.
Obviously, those skilled in the art should be understood that above-mentioned each module of the invention or each step can be with general
Computing device realize that they can be concentrated on single computing device, or be distributed in multiple computing devices and formed
Network on, alternatively, they can be realized with the program code that computing device can perform, it is thus possible to which they are stored
Performed in the storage device by computing device, either they are fabricated to respectively each integrated circuit modules or by they
In multiple modules or step be fabricated to single integrated circuit module to realize.In this way, the present invention be not restricted to it is any specific
Hardware and software combines.
The foregoing is only a preferred embodiment of the present invention, is not intended to limit the invention, for the skill of this area
For art personnel, the invention may be variously modified and varied.Within the spirit and principles of the invention, that is made any repaiies
Change, equivalent substitution, improvement etc., should all be included in the protection scope of the present invention.
Claims (8)
- A kind of 1. hot patch method, it is characterised in that including:Determine that the distance between call instruction and patch function exceed the scope that short jump instruction can redirect;The call instruction is replaced with to the illegal instruction of tape index value, wherein the index value corresponds to the patch function;The call instruction is replaced with to the illegal instruction of tape index value to be included:Determine the instruction for performing the replacement operation Belong to long jump instruction;Obtain in the instruction for being used to performing the replacement operation be used for control PC Ambulant pointer processes Instruction;By the illegal instruction for being used to control the instruction of PC Ambulant pointer processes to replace with tape index value.
- 2. according to the method described in claim 1, it is characterized in that, obtain in the instruction for performing the replacement operation Be used for control the instruction of PC Ambulant pointer processes to include:Long jump is searched in the instruction for being used to perform the replacement operation Turn instruction, obtain the instruction for being used to control PC Ambulant pointer processes.
- 3. according to the method described in claim 1, it is characterized in that, the call instruction is being replaced with into the illegal of tape index value Before instruction, further include:Determine by patch function it is static function;Determine the file by belonging to patch function;In the file, the operation illegally instructed that the call instruction is replaced with to tape index value is performed.
- 4. according to the method described in claim 3, it is characterized in that, determine that the file by belonging to patch function includes:The symbol of the file by belonging to patch function is searched in the symbol table of image file;The symbol table is traveled through, searches the symbol identical with the title of the symbol;Record search to subscript of the symbol in the symbol table.
- 5. method according to any one of claim 1 to 4, it is characterised in that the call instruction is being replaced with into band After the illegal instruction of index value, further include:Target machine receives the replaced call instruction;The target machine perform with it is described illegally instruct corresponding abnormality processing function during, obtained according to the index value Take the address of the patch function;The patch function address is revised as in the return address of the abnormality processing function by the target machine.
- A kind of 6. hot patch device, it is characterised in that including:First determining module, for determining that the distance between call instruction and patch function exceed what short jump instruction can redirect Scope;Replacement module, for the call instruction to be replaced with to the illegal instruction of tape index value, wherein the index value corresponds to The patch function;The replacement module includes:Determination sub-module, for determining that the instruction for performing the replacement operation belongs to long jump Instruction;Acquisition submodule, for obtain in the instruction for being used to performing the replacement operation be used for control PC Ambulant pointers The instruction of process;Submodule is replaced, for being used to control the instruction of PC Ambulant pointer processes to replace with tape index value by described Illegal instruction.
- 7. device according to claim 6, it is characterised in that the acquisition submodule includes:Search unit, in institute State for perform the replacement operation instruction in search for long jump instruction, obtain described being used to control PC Ambulant pointer processes Instruction.
- 8. device according to claim 6, it is characterised in that described device further includes:Second determining module, is static function for determining by patch function;3rd determining module, for determining the file by belonging to patch function.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210018144.0A CN102609241B (en) | 2012-01-19 | 2012-01-19 | hot patch method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210018144.0A CN102609241B (en) | 2012-01-19 | 2012-01-19 | hot patch method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN102609241A CN102609241A (en) | 2012-07-25 |
CN102609241B true CN102609241B (en) | 2018-04-27 |
Family
ID=46526642
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201210018144.0A Active CN102609241B (en) | 2012-01-19 | 2012-01-19 | hot patch method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN102609241B (en) |
Families Citing this family (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103197942B (en) * | 2013-03-18 | 2016-03-02 | 华为技术有限公司 | A kind of generation method of patch, the method for patch installing and device |
CN103399775A (en) * | 2013-08-05 | 2013-11-20 | 北京华为数字技术有限公司 | Hot patching method and hot patching equipment |
CN106484369B (en) * | 2013-10-24 | 2019-11-29 | 华为技术有限公司 | A kind of method and device of online patch activation |
CN103559449B (en) * | 2013-11-15 | 2016-09-21 | 华为技术有限公司 | The detection method of a kind of code change and device |
CN105740001A (en) * | 2014-12-10 | 2016-07-06 | 中兴通讯股份有限公司 | Method and apparatus for hot patch upgrading in process initialization stage, and terminal device |
CN104809018B (en) * | 2015-05-18 | 2018-01-02 | 烽火通信科技股份有限公司 | A kind of method and system of built-in system software injection hot patch |
CN105159738A (en) * | 2015-08-20 | 2015-12-16 | 上海斐讯数据通信技术有限公司 | Hot patch implementation method and system |
US10860322B2 (en) * | 2015-10-30 | 2020-12-08 | Arm Limited | Modifying behavior of a data processing unit using rewritable behavior mappings of instructions |
CN106874022B (en) * | 2015-12-11 | 2021-06-25 | 中兴通讯股份有限公司 | Hot patch injection method and device |
CN105607937B (en) * | 2015-12-25 | 2019-01-18 | 京信通信系统(中国)有限公司 | A kind of hot patch method and apparatus |
CN107797820B (en) | 2017-11-13 | 2021-03-23 | 北京百度网讯科技有限公司 | Method and device for generating patch |
CN110633090B (en) * | 2019-08-14 | 2022-04-12 | 华为技术有限公司 | Patch method, related device and system |
CN111666096B (en) * | 2020-07-02 | 2021-03-16 | 腾讯科技(深圳)有限公司 | Hot updating method and device for target application, storage medium and electronic equipment |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101246449A (en) * | 2008-02-25 | 2008-08-20 | 华为技术有限公司 | Tracking function invocation track method and device |
CN102156661A (en) * | 2010-02-11 | 2011-08-17 | 华为技术有限公司 | Method, device and system for online activating patches |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1230744C (en) * | 2002-08-16 | 2005-12-07 | 华为技术有限公司 | realization of isertion type system soft ware patch and control method |
US7913243B2 (en) * | 2005-06-21 | 2011-03-22 | International Business Machines Corporation | Method and system for generating and applying patches to a computer program concurrently with its execution |
CN100432931C (en) * | 2006-12-22 | 2008-11-12 | 中兴通讯股份有限公司 | Method for implementing long jumping dynamic patch in embedded system |
-
2012
- 2012-01-19 CN CN201210018144.0A patent/CN102609241B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101246449A (en) * | 2008-02-25 | 2008-08-20 | 华为技术有限公司 | Tracking function invocation track method and device |
CN102156661A (en) * | 2010-02-11 | 2011-08-17 | 华为技术有限公司 | Method, device and system for online activating patches |
Also Published As
Publication number | Publication date |
---|---|
CN102609241A (en) | 2012-07-25 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN102609241B (en) | hot patch method and device | |
US7890941B1 (en) | Binary profile instrumentation framework | |
KR101029160B1 (en) | Method, system and computer-readable recording medium for writing new image and its information onto image database | |
CN106599695B (en) | A kind of bootable semiology analysis leak detection method merged based on path | |
CN106294134A (en) | The collapse localization method of code and device | |
CN102279749A (en) | Method and equipment for merging codes | |
CN103631573A (en) | Method and system for obtaining execution time of transferable functions | |
CN102959538B (en) | Index to document | |
CN102567565B (en) | Cable parameter processing method and system utilizing same | |
CN107480476A (en) | A kind of Android local layer compiling of instruction based on ELF infection virtualizes shell adding method | |
CN103559123A (en) | Function call stack analyzing method and device based on VxWorks operation system | |
CN102004692B (en) | Process debugged method and device | |
US8799716B2 (en) | Heap dump occurrence detection | |
CN106021101A (en) | Method and device for testing mobile terminal | |
CN111124872A (en) | Branch detection method and device based on difference code analysis and storage medium | |
CN106649218A (en) | Quick binary file comparing method based on SimHash algorithm | |
JP2001147837A (en) | Program trace device and storage medium | |
KR102013657B1 (en) | Apparatus for statically analyzing assembly code including assoxiated multi files | |
CN109766273A (en) | Localization method, device, computer equipment and the storage medium of endless loop | |
CN109313639A (en) | The system and method for query execution are carried out in DBMS | |
CN112528193A (en) | Page document processing method, page document management method and device, terminal device, computer device and server | |
US9489451B2 (en) | Visual data definition for identifying data items in loosely-structured data | |
CN110196952A (en) | Search processing method, device, equipment and the storage medium of program code | |
CN105550575A (en) | Method and device for obtaining un-exported function address and data structure offset | |
CN111931161B (en) | RISC-V processor based chip verification method, apparatus and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |