CN106775671A - A kind of hot patch restorative procedure in the linux environment for communication system - Google Patents
A kind of hot patch restorative procedure in the linux environment for communication system Download PDFInfo
- Publication number
- CN106775671A CN106775671A CN201611082458.1A CN201611082458A CN106775671A CN 106775671 A CN106775671 A CN 106775671A CN 201611082458 A CN201611082458 A CN 201611082458A CN 106775671 A CN106775671 A CN 106775671A
- Authority
- CN
- China
- Prior art keywords
- patch
- service routine
- function
- program
- service
- 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
- G06F8/00—Arrangements for software engineering
- G06F8/60—Software deployment
- G06F8/65—Updates
- G06F8/658—Incremental updates; Differential updates
Abstract
The present invention provides the hot patch restorative procedure in a kind of linux environment for communication system, including it is so files for being capable of dynamic load to be provided for the hot patch of revision program bug, and hot patch operation is carried out after service routine loading hot patch file;Loading hot patch file processes have run including service routine, are sent to service routine and ordered, and after service routine receives order, so files of patch are loaded into memory headroom;Performing hot patch operation includes starting patch installing program, and patch installing program calls service routine on carry by system;The function in patch and the address by function to be replaced are searched in the memory headroom of service routine, the difference write-in jmp orders according to address so that when accessing this function, jump to patch function.The present invention can complete patch file parsing in the case of non-service affecting, the complexity of parsing patch file be simplified, while reducing the time of service disruption.
Description
Technical field
The present invention relates to communication technical field, more particularly, to entering that a kind of reparation based on linux system is currently running
The method of the bug of journey.
Background technology
In a communications system, to ensure the coherent of communication service, there is provided the program of communication service will less restart and not interrupt
Service, accomplishes the operation of 7*24 hours as far as possible.But there is bug (mistake) when service routine, it is necessary to when reparation, pass
The method of system is to replace original program file to perform with the program file for repairing, so inevitably occur restarting and
Service disruption.
Service disruption can be avoided using hot patch technology.The code compilation of bug will be corrected into a small patch file,
Linux system be compiled into can dynamic load a kind of so (file format) file, then continual service is by service routine
Loading patch file, the code of bug is replaced with the code of patch file.
Hot patch technology main at present is realized as follows:
Service routine starts, and normally provides service;When needing to beat hot patch, patch text is read by a patch installing program
Part, parses the symbol table of patch file, then service routine on attach (carry), by the service of writing of the patch file after parsing
In the internal memory of program, the bug of service routine is finally repaired.
Using the method for this patch installing, patch file is parsed by patch installing program, operation can be cumbersome, while
Easily error.Further, since attach service routines can cause service to suspend, therefore patch installing program parsing patch file can lead
Cause the time of service pause long.
The content of the invention
For prior art defect, the invention provides a kind of new for the hot patch in communication system linux environment
Restorative procedure.
The technical scheme is that a kind of hot patch method in linux environment for communication system, is provided for repairing
The hot patch of positive program bug is so files for being capable of dynamic load;After the service routine loading hot patch file having been turned on, carry out
Hot patch is operated,
Loading hot patch file processes include following sub-step,
Step 1.1, service routine has run;
Step 1.2, sends to service routine and orders, and after service routine receives order, so files of patch is loaded into interior
Deposit in space;
Hot patch operation is performed afterwards, and the process of patch installing includes following sub-step,
Step 2.1, starts patch installing program, and patch installing program calls service routine on carry by system;
Step 2.2, the function in patch and the ground by function to be replaced are searched in the memory headroom of service routine
Location;
Step 2.3, calculates the function in patch and the difference by the address of function to be replaced, will be to be replaced
Function address at write jmp orders so that when accessing this function, jump to patch function.
And, there is an independent thread inside service routine, it is responsible for the order for receiving and handling implement program sends;This
Thread is not involved in nor affecting on the normal Business Processing of program.
And, on patch installing program carry after service routine, it is capable of the memory headroom of direct access service program.
The method can be realized beating the process being currently running hot patch, the bug of revision program in Linux system;Simultaneously
Patch file can be more easily parsed, is reduced because of out of service time caused by attach service routines.
Present invention contrast prior art has following innovative point:
1st, service routine parses patch file, can reduce the time that attach service routines cause service to suspend, and reduces
The influence that patch installing is caused to normal service.
2nd, further, service routine receives the order of user input with independent task, so allows service routine
Load patch files, reduce the complexity of load and parsing patch file.
Technical solution of the present invention will play a significant role in augmentative communication systems, with great market value.
Brief description of the drawings
Fig. 1 is the conventional method schematic diagram of existing hot patch technology;
Fig. 2 is the hot patch scheme schematic diagram of the embodiment of the present invention.
Fig. 3 is the intershell task functional schematics of service routine in the present invention.
Specific embodiment
Technical solution of the present invention is described in detail below in conjunction with drawings and Examples, there is provided to the comprehensive understanding of the embodiment
Detail.
For hot patch technology, the code compilation for repairing bug will be used for first into so files, traditional method is by beating benefit
Fourth program parses patch file, and writes in the memory headroom of service routine, as shown in Figure 1:
Patch installing program Attach service routines, afterwards service routine pause is performed;
Parsing patch file;
Patch file after parsing is write the memory headroom of service routine;
The address of bug functions and patch function is searched in the memory headroom of service routine;
Jmp orders are write in the position of bug functions;
Patch installing terminates, and service routine recovers to perform.
So parsing patch file is more complicated, while the time that program out of service is performed also can be long;The present invention
Proposition is parsed patch file by service routine, reduces the complexity of parsing, while reducing the time of service pause.
The hot patch that the embodiment of the present invention is provided for revision program bug (mistake) be can dynamic load a kind of so (texts
Part form) file;Need the program (service routine) of patch installing to have been turned on, after service routine loading hot patch file, carry out
Hot patch is operated.
Loading hot patch file processes include following sub-step,
Step 1,1, service routine has run;
Step 1.2, sends to service routine and orders, and after service routine receives order, is not influenceing the situation of own service
Under, so files of patch are loaded into the memory headroom of this process;
The operation of patch installing is performed afterwards, and the process of patch installing includes following sub-step,
Step 2.1, starts patch installing program, and patch installing program takes by ptrace (system is called) attach (carry)
Business program;
Step 2.2, the function in patch and the ground by function to be replaced are searched in the memory headroom of service routine
Location;
Step 2.3, calculates 2 differences of address, jmp orders will be being write at the address of function to be replaced, makes
When must access this function, patch function is jumped to.
As shown in Fig. 2 embodiment specific implementation process is as follows:
1. first by the code compilation for repairing service routine bug into so files, it should be noted herein that repairing the code of bug
If in global variable extern (c language keywords), ability after the internal memory of such load (loading) to service routine
The original global variable of access service program has been an otherwise newly-built global variable of the same name.
2. implementing procedure is started, and sending loaddllfile (loading living document) to service routine orders, and command parameter is
The filename of patch so files.After service routine receives order, patch so files load (loading) is arrived into the memory headroom of oneself
In and parse.
During specific implementation, loading hot patch file processes can include operation service program, sent to service routine and ordered,
After service routine receives order, in the case where own service is not influenceed, so files of patch are loaded into the internal memory of this process
In space.
Here service routine will be supported to receive the order of user.Present invention further propose that, there is one inside service routine
Independent thread, is responsible for the order for receiving and handling implement program sends;This thread is not involved in nor affecting on the normal industry of program
Business is processed.
Have in embodiment, inside service routine a task (the Intershell task in Fig. 3) be responsible for specially receive and
The order that handling implement program sends, this task communicates with implementing procedure, the command messages for waiting user to send.User passes through work
Tool program sends order.Each order one command processing function of correspondence.After Intershell task receive order, if branch
This order is held, then performs the command processing function of this order.
Wherein, Intershell is the thread name for receiving implementing procedure order, and task represents thread, Intershell
Task is responsible for receiving the order that implementing procedure sends, and corresponding function is performed after receiving order.Used in embodiment
Loaddllfile orders, the command functions function of loaddllfile orders is to memory headroom and to solve specified file load
Analysis.After Intershell task receive the loaddllfile orders of implementing procedure transmission, so files specified can will be ordered
It is loaded into the memory headroom of service routine.
Referring to Fig. 3, the Intershell task of service routine perform procedure below:
The command messages for waiting user to send;
Resolve command message, the corresponding order of look-up command name performs function;
The order for performing correspondence order performs function;
To user program return command implementing result.
Further, embodiment calls dlopen (system is called) load so files to the internal memory text of process using system
Part, using RTLD_NOW (parameter of dlopen) pattern, so under the premise of the function of not influenceing service routine, completes to mend
The parsing of fourth file.
3. service routine on patch installing program attach, the execution of program out of service, in the memory headroom of service routine
In search the address of bug functions and patch function, calculate both relative addresses, going out to write jmp in the address of bug functions (jumps
Turn) order, jump to the address of patch function.
On patch installing program attach after service routine, can direct access service program memory headroom.
In embodiment, patch installing program using ptrace (system is called) the upper service routines of attach, attach into
After work(, service routine can be suspended, and patch installing program can be with the memory headroom of access service program.Afterwards, patch installing program exists
The address of bug functions and patch function is searched in the memory headroom of service routine:
If 3.1. not finding address, patch installing failure;
If 3.2. finding address, the address of bug functions is subtracted with the address of patch function, calculate relative address
Addr, then in the first address writing commands jmp addr-5 of bug functions, subtracts 5 because to subtract the jmp orders length of itself
Degree.So when bug functions are gone to, patch function is jumped to by jmp orders.
4. patch installing program detach (stopping carry) service routine, hot patch process terminates.Now service routine recovers
Perform, bug functions are replaced by patch function, and bug is repaired.
In embodiment, patch installing uses ptrace detach service routines, and service routine recovers business execution afterwards.And
And, bug functions are replaced by patch function.Patch installing is completed.
During specific implementation, method provided by the present invention can realize automatic running using software engineering.
Specific embodiment described herein is only to the spiritual explanation for example of the present invention.Technology neck belonging to of the invention
The technical staff in domain can be made various modifications or supplement to described specific embodiment or be replaced using similar mode
Generation, but without departing from spirit of the invention or surmount scope defined in appended claims.
Claims (3)
1. the hot patch restorative procedure in a kind of linux environment for communication system, it is characterised in that:It is provided for revision program
The hot patch of bug is so files for being capable of dynamic load;After the service routine loading hot patch file having been turned on, hot patch is carried out
Operation,
Loading hot patch file processes include following sub-step,
Step 1.1, service routine has run;
Step 1.2, sends to service routine and orders, and after service routine receives order, so files of patch is loaded into internal memory empty
It is interior;
Hot patch operation is performed afterwards, and the process of patch installing includes following sub-step,
Step 2.1, starts patch installing program, and patch installing program calls service routine on carry by system;
Step 2.2, the function in patch and the address by function to be replaced are searched in the memory headroom of service routine;
Step 2.3, calculates the function in patch and the difference by the address of function to be replaced, by letter to be replaced
Jmp orders are write at several addresses so that when accessing this function, jump to patch function.
2. the hot patch restorative procedure being used in communication system linux environment according to claim 1, it is characterised in that:Clothes
There is an independent thread inside business program, be responsible for the order for receiving and handling implement program sends;This thread is not involved in also not
The normal Business Processing of influence program.
3. the hot patch restorative procedure in the linux environment for communication system according to claim 1 or claim 2, it is characterised in that:
On patch installing program carry after service routine, it is capable of the memory headroom of direct access service program.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201611082458.1A CN106775671A (en) | 2016-11-30 | 2016-11-30 | A kind of hot patch restorative procedure in the linux environment for communication system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201611082458.1A CN106775671A (en) | 2016-11-30 | 2016-11-30 | A kind of hot patch restorative procedure in the linux environment for communication system |
Publications (1)
Publication Number | Publication Date |
---|---|
CN106775671A true CN106775671A (en) | 2017-05-31 |
Family
ID=58898370
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201611082458.1A Pending CN106775671A (en) | 2016-11-30 | 2016-11-30 | A kind of hot patch restorative procedure in the linux environment for communication system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106775671A (en) |
Cited By (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107357622A (en) * | 2017-07-17 | 2017-11-17 | 迈普通信技术股份有限公司 | Hot patch implementation method and communication equipment |
CN107844306A (en) * | 2017-08-09 | 2018-03-27 | 平安壹钱包电子商务有限公司 | Restorative procedure, device, storage medium and the terminal of application program |
CN110543322A (en) * | 2019-07-19 | 2019-12-06 | 浪潮思科网络科技有限公司 | hot patching method and device for Loongson platform |
CN111399892A (en) * | 2020-03-18 | 2020-07-10 | 深圳Tcl数字技术有限公司 | Middleware program repairing method and device and computer readable storage medium |
CN111782302A (en) * | 2020-07-13 | 2020-10-16 | 腾讯科技(深圳)有限公司 | Process updating method and device, storage medium and electronic equipment |
CN112650519A (en) * | 2020-12-28 | 2021-04-13 | 深圳大普微电子科技有限公司 | Firmware repair method, solid state disk controller and solid state disk |
WO2022188516A1 (en) * | 2021-03-11 | 2022-09-15 | 深圳市汇顶科技股份有限公司 | Patching method and apparatus |
CN115756563A (en) * | 2022-11-23 | 2023-03-07 | 广州海量数据库技术有限公司 | Method for hot patching OpenGauss database |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102156661A (en) * | 2010-02-11 | 2011-08-17 | 华为技术有限公司 | Method, device and system for online activating patches |
CN105159738A (en) * | 2015-08-20 | 2015-12-16 | 上海斐讯数据通信技术有限公司 | Hot patch implementation method and system |
CN105677550A (en) * | 2015-12-29 | 2016-06-15 | 广州华多网络科技有限公司 | Performance acquisition-analysis method, device and system based on Linux system |
-
2016
- 2016-11-30 CN CN201611082458.1A patent/CN106775671A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102156661A (en) * | 2010-02-11 | 2011-08-17 | 华为技术有限公司 | Method, device and system for online activating patches |
CN105159738A (en) * | 2015-08-20 | 2015-12-16 | 上海斐讯数据通信技术有限公司 | Hot patch implementation method and system |
CN105677550A (en) * | 2015-12-29 | 2016-06-15 | 广州华多网络科技有限公司 | Performance acquisition-analysis method, device and system based on Linux system |
Cited By (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107357622A (en) * | 2017-07-17 | 2017-11-17 | 迈普通信技术股份有限公司 | Hot patch implementation method and communication equipment |
CN107844306A (en) * | 2017-08-09 | 2018-03-27 | 平安壹钱包电子商务有限公司 | Restorative procedure, device, storage medium and the terminal of application program |
CN107844306B (en) * | 2017-08-09 | 2020-04-03 | 平安壹钱包电子商务有限公司 | Application program repairing method and device, storage medium and terminal |
CN110543322A (en) * | 2019-07-19 | 2019-12-06 | 浪潮思科网络科技有限公司 | hot patching method and device for Loongson platform |
CN111399892A (en) * | 2020-03-18 | 2020-07-10 | 深圳Tcl数字技术有限公司 | Middleware program repairing method and device and computer readable storage medium |
CN111782302A (en) * | 2020-07-13 | 2020-10-16 | 腾讯科技(深圳)有限公司 | Process updating method and device, storage medium and electronic equipment |
CN111782302B (en) * | 2020-07-13 | 2021-05-14 | 腾讯科技(深圳)有限公司 | Process updating method and device, storage medium and electronic equipment |
CN112650519A (en) * | 2020-12-28 | 2021-04-13 | 深圳大普微电子科技有限公司 | Firmware repair method, solid state disk controller and solid state disk |
WO2022188516A1 (en) * | 2021-03-11 | 2022-09-15 | 深圳市汇顶科技股份有限公司 | Patching method and apparatus |
CN115756563A (en) * | 2022-11-23 | 2023-03-07 | 广州海量数据库技术有限公司 | Method for hot patching OpenGauss database |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106775671A (en) | A kind of hot patch restorative procedure in the linux environment for communication system | |
KR102341388B1 (en) | Method, apparatus, device and storage medium for upgrading application | |
US9158538B2 (en) | User-extensible rule-based source code modification | |
CN101799763B (en) | Method, device and system for patching kernel on line | |
CN105446712B (en) | Application program defect repairing method and device | |
US10684846B2 (en) | Using semantic annotations to control compatibility behaviors | |
US10248409B1 (en) | Limiting the effects of source code patches on corresponding native-code patches | |
CN103995712A (en) | Boot loader device capable of updating automatically and updating method thereof | |
CN101826026A (en) | Embedded equipment and on-line updating system and method of firmware in embedded equipment | |
US20110126179A1 (en) | Method and System for Dynamic Patching Software Using Source Code | |
CN109840105A (en) | A kind of hot update method that do not withdraw | |
JP2009157533A (en) | Programmable controller system | |
US9841982B2 (en) | Locating import class files at alternate locations than specified in classpath information | |
US9921857B1 (en) | Compiler extension for correcting error messages | |
CN102270174A (en) | Automatic test method and device | |
CN107902507B (en) | Control software field debugging system and debugging method | |
CN110659210A (en) | Information acquisition method and device, electronic equipment and storage medium | |
CN103442077A (en) | Method and system for updating software client through network | |
CN110209396B (en) | One-to-many software version control system and method | |
CN112052039A (en) | Method and device for synchronously constructing multiple projects and electronic equipment | |
CN112231221A (en) | Debugging method and system for application program of embedded Linux system | |
CN112416459B (en) | System for solving version strong dependence among micro services | |
CN101546268B (en) | Method for loading executable file for digital signal processor and device thereof | |
JP2020009035A (en) | Production system, management device, program | |
CN111722866B (en) | OpenStack code repairing method, device, equipment and storage medium |
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 | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20170531 |