WO2016127566A1 - Procédé et dispositif de traitement de correctifs - Google Patents
Procédé et dispositif de traitement de correctifs Download PDFInfo
- Publication number
- WO2016127566A1 WO2016127566A1 PCT/CN2015/083913 CN2015083913W WO2016127566A1 WO 2016127566 A1 WO2016127566 A1 WO 2016127566A1 CN 2015083913 W CN2015083913 W CN 2015083913W WO 2016127566 A1 WO2016127566 A1 WO 2016127566A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- patch
- function
- patched
- instruction
- executed
- Prior art date
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/445—Program loading or initiating
Definitions
- the present invention relates to the field of communications, and in particular to a patch processing method and apparatus.
- the hot patch technology is to replace the defective function with the patch function by the function replacement in the process of running the system, that is, jump to the patch function by the jump instruction at the entrance of the complement function, thereby avoiding executing the patched function.
- the patch function is executed instead to fix the defect. Therefore, the basic problem of the hot patch mechanism can be summarized as:
- Short jumps can be implemented with a single instruction, and the replacement of a single instruction is atomic, so this will bring great convenience to the implementation of problem 2, greatly simplifying the design of the hot patch mechanism, but short jump
- the shortcoming is also obvious, that is, the scope of the jump is very limited, especially in large software systems, this shortcoming is more likely to be highlighted, which will result in the address that is far away from the jump can not be reached, resulting in the patch can not be hit, of course, can take special Tips to circumvent this shortcoming of short jumps.
- the embodiment of the invention provides a patch processing method and device, so as to solve at least the problem of atomicity of the instruction modification process when the long jump instruction mode is adopted in the related art.
- a patch processing method including: detecting whether a pointer of an instruction to be executed corresponding to each thread in a patched process points to a header of a patched function, wherein the patched process The address used to obtain the patched function and the patch function; when it is detected that the pointers of the to-be-executed instructions corresponding to the respective threads do not point to the header of the patched function, the patched function is replaced with The patch function.
- the pointer of the instruction to be executed is a pointer stored in the program counter PC.
- replacing the patched function with a patch function includes: modifying an instruction located in a header of the patched function to an instruction for jumping to the patch function, wherein the pointer is modified by a jump instruction
- the latter patched function is referred to as the first patched function.
- the method before detecting whether the pointers of the to-be-executed instructions corresponding to the respective threads in the patched process point to the header of the patched function, the method includes: receiving a patch activation request; acquiring a name and a version of the patch file according to the patch activation request; The name and version of the patch file determine that the patched process has not played the same patch corresponding to the patch file; parse the patch file, and obtain the address of the patched function according to the parsing result and the The address of the patch function.
- the method before detecting whether the pointers of the to-be-executed instructions corresponding to the respective threads in the patched process point to the header of the patched function, the method includes: stopping the running of the respective threads; and executing a command corresponding to the specified thread in the each thread.
- the pointer points to the head of the patched function
- the specified thread is run until the pointer of the instruction to be executed corresponding to the specified thread does not point to the header of the corresponding patched function.
- the first patched function is replaced when the pointer of the to-be-executed instruction corresponding to the all threads meets the following conditions: the all threads
- the pointers corresponding to the to-be-executed instructions are not directed to the header of the corresponding first patched function, and the pointers of the to-be-executed instructions corresponding to all the threads are not pointed to in any of the patch functions, corresponding to any thread.
- the call chain before the pointer of the instruction to be executed does not fall within the patch function.
- replacing the first patched function includes: restoring the jump instruction in the first patched function to an instruction in a header before the patched function is replaced.
- the method includes: receiving a patch deactivation request.
- a patch processing apparatus including: a detecting module, configured to detect whether a pointer of an instruction to be executed corresponding to each thread in the patched process points to a header of the patched function, The patched process is used to obtain the address of the patched function and the patch function.
- the first replacement module is configured to detect that the pointers of the to-be-executed instructions corresponding to the respective threads do not point to the patched When the header of the function is used, the patched function is replaced with the patch function.
- the pointer of the instruction to be executed is a pointer stored in the program counter PC.
- the first replacement module is further configured to modify an instruction located in a header of the patched function as an instruction for jumping to the patch function, where the modified instruction will be The patched function is called the first patched function.
- the device further includes: a first receiving module, configured to receive a patch activation request; a first obtaining module, configured to acquire a name and a version of the patch file according to the patch activation request; and a determining module, configured to The name and version of the patch file determine that the patched process has not played the same patch corresponding to the patch file; the second obtaining module is configured to parse the patch file, and obtain the patch according to the parsing result.
- the address of the function and the address of the patch function is configured to receive a patch activation request.
- the device further includes: a first running module, configured to stop running the respective threads; and a second running module, configured to point a pointer of the instruction to be executed corresponding to the specified thread in the each thread to the When the header of the function is patched, the specified thread is run until the pointer of the instruction to be executed corresponding to the specified thread does not point to the header of the corresponding patched function.
- the device further includes: a second replacement module, configured to replace the first patched function when the pointer of the to-be-executed instruction corresponding to the all threads meets the following conditions:
- the pointers of the to-be-executed instructions are not directed to the corresponding header of the first patched function, and the pointers of the to-be-executed instructions corresponding to all the threads are not pointed to in any of the patch functions, and any thread corresponding to be executed
- the call chain before the pointer of the instruction does not fall in the patch function.
- the second replacement module is further configured to restore the jump instruction in the first patched function to an instruction in the header before the patched function is replaced.
- the apparatus further includes: a second receiving module configured to receive a patch deactivation request.
- the patched process is an address for obtaining the patched function and the patch function;
- the patch function is replaced with the patch function.
- FIG. 1 is a flowchart of a patch processing method according to an embodiment of the present invention.
- FIG. 2 is a structural block diagram of a patch processing apparatus according to an embodiment of the present invention.
- FIG. 3 is a structural block diagram (1) of a patch processing apparatus according to an embodiment of the present invention.
- FIG. 4 is a structural block diagram (2) of a patch processing apparatus according to an embodiment of the present invention.
- FIG. 5 is a structural block diagram (3) of a patch processing apparatus according to an embodiment of the present invention.
- FIG. 6 is a structural block diagram (4) of a patch processing apparatus according to an embodiment of the present invention.
- FIG. 7 is a flow chart of a hot patch message in accordance with an embodiment of the present invention.
- FIG. 1 is a flowchart of a method for processing a patch according to an embodiment of the present invention. As shown in FIG. 1 , the process includes the following steps:
- Step S102 detecting whether the pointers of the to-be-executed instructions corresponding to the respective threads in the patched process point to the header of the patched function, wherein the patched process is an address for acquiring the patched function and the patch function;
- Step S104 when it is detected that the pointers of the to-be-executed instructions corresponding to the respective threads do not point to the header of the patched function, the patch function is replaced with a patch function.
- the pointer to the instruction to be executed is a pointer stored in the program counter PC.
- step S104 involves replacing the patched function with a patch function.
- the completion will be The patch function is replaced with a patch function, where the patched function modified by the jump instruction is referred to herein as the first patched function.
- the patch file is parsed, and the address of the patched function and the address of the patch function are obtained according to the parsing result.
- the process of replacing the patched function with the patch function further involves a process of deactivation.
- the first patched function is replaced when the pointer of the instruction to be executed of all the threads satisfies the following conditions:
- the pointers of the to-be-executed instructions corresponding to all threads do not point to the header of the corresponding first patched function, and the pointers of the to-be-executed instructions corresponding to all the threads do not point to any of the pending functions in any of the patch functions.
- the call chain before the pointer does not fall in the patch function.
- the first patched function is replaced.
- the jump instruction in the first patched function is restored to the instruction in the header before the patched function is replaced.
- the patch deactivation request is received prior to the replacement of the first patched function.
- a patch processing device is also provided, which is used to implement the above-mentioned embodiments and preferred embodiments, and has not been described again.
- the term “module” may implement a combination of software and/or hardware of a predetermined function.
- the apparatus described in the following embodiments is preferably implemented in software, hardware, or a combination of software and hardware, is also possible and contemplated.
- the pointer of the instruction to be executed is a pointer stored in the program counter PC.
- the first replacement module 24 is further configured to modify an instruction located in the header of the patched function as an instruction for jumping to the patch function, wherein the patched function modified by the jump instruction is called It is the first patched function.
- FIG. 3 is a structural block diagram (1) of a patch processing apparatus according to an embodiment of the present invention.
- the apparatus further includes: a first receiving module 32 configured to receive a patch activation request; and a first obtaining module 34 configured to Obtaining the name and version of the patch file according to the patch activation request; the determining module 36 is configured to determine that the patched process does not play the same patch corresponding to the patch file according to the name and version of the patch file; and the second obtaining module 38 Set to parse the patch file, and obtain the address of the patched function and the address of the patch function according to the parsing result.
- FIG. 4 is a structural block diagram (2) of a patch processing apparatus according to an embodiment of the present invention.
- the apparatus further includes: a first running module 42 configured to stop running the respective threads; and a second running module 44, When the pointer of the instruction to be executed corresponding to the specified thread in the respective threads points to the head of the patched function, the specified thread is run until the pointer of the instruction to be executed corresponding to the specified thread does not point to the corresponding patched function. The head.
- the second replacement module 52 is further configured to restore the jump instruction in the first patched function to an instruction in the header before the patched function is replaced.
- FIG. 6 is a structural block diagram (4) of a patch processing apparatus according to an embodiment of the present invention. As shown in FIG. 6, the apparatus further includes: a second receiving module 62 configured to receive a patch deactivation request.
- each of the above modules may be implemented by software or hardware.
- the foregoing may be implemented by, but not limited to, the foregoing modules are all located in the same processor; or, the above modules are respectively located.
- the first processor, the second processor, and the third processor In the first processor, the second processor, and the third processor.
- This alternative embodiment employs a long jump instruction mode and uses a simple mechanism to guarantee the atomicity of the long jump instruction modification process.
- this jump mode can jump to any address.
- the user interaction process receives user patch requests, including patch activation and deactivation requests. After receiving the activation request, it searches for the corresponding patch according to the name and version of the patch file. If not, records the content of the request, that is, the patch name and version, and then distributes the request content as a message. Give the patched process, then wait for the response of the patched process until it times out. If the same patch is patched by the patch process, it will return directly.
- the patch process After receiving the patch activation message, the patch process unpacks the patch file, verifies the patch header, extracts the patch dynamic library after verification, and then loads the patch dynamic library, locates the patch function and the address of the patched function, and prepares for patch activation. Then, the patch process will send the address of the patch function and the patch function to the patch management process, and the latter completes the final function replacement work.
- the replacement of the patch function is to modify the first few instructions of the patch function to jump to the corresponding patch function. Since the patch process is static at the moment, there is no execution flow, so the instruction modification process will not be interrupted. Thus, the atomicity of the instruction modification process can be guaranteed. It is through this method of letting the patched process be static to achieve the atomicity of the instruction modification process.
- the patch deactivation is to restore the original instruction of the patched function.
- the patched function instruction will be saved for subsequent recovery.
- the deactivation process is consistent with the activation process, requesting a user interaction process to the patched process, and then to the patch management process.
- the criteria are more stringent and require that the PCs of all threads in the patch function be satisfied:
- the patch can be safely uninstalled only if the above three conditions are met, otherwise a fatal error will result.
- FIG. 7 is a hot patch message flow chart according to an embodiment of the present invention. As shown in FIG. 7, the method includes the following steps:
- Step 1 The user interaction process receives an activation/deactivation request from the user. After receiving the request, it checks whether the request has been executed according to the existing record information. If not, the request is recorded, and then the request is packaged into a message. Push to the patched process, otherwise return directly.
- the absolute path name of the patch /home/test.patch and the name of the patched process are sent to the user interaction process.
- the latter searches the patched process patch list according to the patch name test.patch. Check whether there is a patch with the same name. If it is found, the patch has been played and returned directly. Otherwise, the absolute path /home/test.patch is sent to the patched process.
- the patch process After receiving the patch activation message, the patch process first opens the absolute path name /home/test.patch of the patch file contained in the activation message.
- the test.patch file consists of two parts: the patch description part and the patch entity.
- the patch description part includes information such as the list of patched function names, the list of patch function names, and the number of patch functions.
- the patch entity is a dynamic library file compiled by the patch code. The two pieces of information are extracted separately, the latter is stored separately in a new file and opened.
- the patch code is loaded, and then the addresses of the patched function and the patch function are respectively searched, and then the patch function and the patch function are The address list is sent to the patch management process to be activated. If it is deactivated, then it is only necessary to find the patched function list and the patch dynamic library according to the received patch information, and then submit it to the patch management process to activate.
- Step 3 After the patch management process receives the patch message, if it is an activation message, all the threads in the patch process will be stopped, and it is checked whether the command of the patch function can be replaced at this moment, that is, the PC pointer of all threads is not It falls on the head of any of the complemented functions. If it is possible, the command is modified. Otherwise, the criterion is converged, that is, the operation is continuously performed and judged until the maximum number of runs. If the criterion is converged, the command is modified, otherwise the declaration fails; If it is deactivated, the criteria are first converged, but the criteria are more stringent, as described above.
- a storage medium is further provided, wherein the software includes the above-mentioned software, including but not limited to: an optical disk, a floppy disk, a hard disk, an erasable memory, and the like.
- modules or steps of the embodiments of the present invention can be implemented by a general computing device, which can be concentrated on a single computing device or distributed in multiple computing devices. Further, they may be implemented by program code executable by the computing device such that they may be stored in the storage device by the computing device and, in some cases, may be different from The steps shown or described are performed sequentially, or they are separately fabricated into individual integrated circuit modules, or a plurality of modules or steps thereof are fabricated into a single integrated circuit module. Thus, embodiments of the invention are not limited to any specific combination of hardware and software.
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
- Debugging And Monitoring (AREA)
Abstract
L'invention concerne un procédé et un dispositif de traitement de correctifs. Le procédé consiste à : détecter si tous les pointeurs d'instructions à exécuter conformément à différents fils dans un processus corrigé pointent vers l'en-tête d'une fonction corrigée (S102), le processus corrigé permettant d'acquérir les adresses de la fonction corrigée et d'une fonction de correctif; et lorsqu'il est détecté qu'aucun des pointeurs des instructions à exécuter conformément aux différents fils ne pointe vers l'en-tête de la fonction corrigée, remplacer la fonction corrigée par la fonction de correctif (S104). Le procédé et le dispositif permettent de résoudre le problème dans l'état de la technique selon lequel l'atomicité dans une procédure de modification d'instruction ne peut pas être résolue efficacement lorsqu'un mode d'instruction de saut long est adopté, ce qui permet de garantir l'atomicité de la procédure de modification d'instruction lorsqu'un mode d'instruction de saut long est adopté.
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510076617.6A CN105988798B (zh) | 2015-02-12 | 2015-02-12 | 补丁处理方法及装置 |
CN201510076617.6 | 2015-02-12 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2016127566A1 true WO2016127566A1 (fr) | 2016-08-18 |
Family
ID=56614077
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2015/083913 WO2016127566A1 (fr) | 2015-02-12 | 2015-07-13 | Procédé et dispositif de traitement de correctifs |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN105988798B (fr) |
WO (1) | WO2016127566A1 (fr) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107870777A (zh) * | 2016-09-23 | 2018-04-03 | 中兴通讯股份有限公司 | 一种热补丁实现方法及装置、终端 |
Families Citing this family (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107341110B (zh) * | 2017-07-11 | 2020-01-07 | 浪潮软件集团有限公司 | 一种软件测试定位补丁修改及影响范围的工具及实现方法 |
CN107357622B (zh) * | 2017-07-17 | 2020-09-22 | 迈普通信技术股份有限公司 | 热补丁实现方法及通信设备 |
CN110457151B (zh) * | 2019-07-10 | 2022-01-28 | 五八有限公司 | 热修复方法、装置及可读存储介质 |
CN112988182A (zh) | 2019-12-13 | 2021-06-18 | 中兴通讯股份有限公司 | Linux内核热补丁实现方法、电子设备及计算机可读介质 |
CN111694594B (zh) * | 2020-05-18 | 2023-03-03 | 成都盛芯微科技有限公司 | 补丁程序的控制方法和系统 |
CN111949290B (zh) * | 2020-07-14 | 2022-10-14 | 锐捷网络股份有限公司 | 一种热补丁管理方法、装置、电子设备及存储介质 |
CN118295708A (zh) * | 2023-01-04 | 2024-07-05 | 中兴通讯股份有限公司 | Arm架构下热补丁处理方法、装置、存储介质及电子装置 |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101799763A (zh) * | 2009-02-10 | 2010-08-11 | 华为技术有限公司 | 内核在线补丁的方法、装置和系统 |
CN102467394A (zh) * | 2010-11-12 | 2012-05-23 | 中兴通讯股份有限公司 | 多核热补丁的实现方法及系统 |
US8468516B1 (en) * | 2008-12-19 | 2013-06-18 | Juniper Networks, Inc. | Creating hot patches for embedded systems |
CN103885808A (zh) * | 2014-04-08 | 2014-06-25 | 北京奇虎科技有限公司 | 热补丁处理方法及装置 |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6691308B1 (en) * | 1999-12-30 | 2004-02-10 | Stmicroelectronics, Inc. | Method and apparatus for changing microcode to be executed in a processor |
CN100445952C (zh) * | 2007-01-26 | 2008-12-24 | 上海华为技术有限公司 | 通信设备中软件版本升级的方法及装置 |
US20090007096A1 (en) * | 2007-06-28 | 2009-01-01 | Microsoft Corporation | Secure Software Deployments |
CN103744709B (zh) * | 2014-01-23 | 2017-02-15 | 华为技术有限公司 | 补丁加载方法及装置 |
CN104125101B (zh) * | 2014-08-12 | 2017-10-10 | 烽火通信科技股份有限公司 | 通信系统网元使用热补丁批量升级所属业务单盘的方法 |
-
2015
- 2015-02-12 CN CN201510076617.6A patent/CN105988798B/zh active Active
- 2015-07-13 WO PCT/CN2015/083913 patent/WO2016127566A1/fr active Application Filing
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8468516B1 (en) * | 2008-12-19 | 2013-06-18 | Juniper Networks, Inc. | Creating hot patches for embedded systems |
CN101799763A (zh) * | 2009-02-10 | 2010-08-11 | 华为技术有限公司 | 内核在线补丁的方法、装置和系统 |
CN102467394A (zh) * | 2010-11-12 | 2012-05-23 | 中兴通讯股份有限公司 | 多核热补丁的实现方法及系统 |
CN103885808A (zh) * | 2014-04-08 | 2014-06-25 | 北京奇虎科技有限公司 | 热补丁处理方法及装置 |
Non-Patent Citations (2)
Title |
---|
LEI, ZHENYU: "Research and Implementation of Online Thermal Upgrading of Embedded Network Equipment", CHINA MASTER'S THESES FULL-TEXT DATABASE, 15 September 2014 (2014-09-15) * |
SUN, SHENGFANG: "Research and Implementation of Hotfix to Embedded Linux Operating System Kernel", CHWA MASTER' S THESES FULL-TEXT DATABASE, 15 April 2011 (2011-04-15), pages 42 - 49 * |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107870777A (zh) * | 2016-09-23 | 2018-04-03 | 中兴通讯股份有限公司 | 一种热补丁实现方法及装置、终端 |
Also Published As
Publication number | Publication date |
---|---|
CN105988798A (zh) | 2016-10-05 |
CN105988798B (zh) | 2020-07-31 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2016127566A1 (fr) | Procédé et dispositif de traitement de correctifs | |
US10824404B2 (en) | Methods and systems for uploading a program based on a target network platform | |
Leesatapornwongsa et al. | TaxDC: A taxonomy of non-deterministic concurrency bugs in datacenter distributed systems | |
US7958497B1 (en) | State synchronization in recording and replaying computer programs | |
US10394697B2 (en) | Focus area integration test heuristics | |
US7673181B1 (en) | Detecting race conditions in computer programs | |
US9292416B2 (en) | Software development kit testing | |
US10067858B2 (en) | Cloud-based software testing | |
US9519495B2 (en) | Timed API rules for runtime verification | |
US9684587B2 (en) | Test creation with execution | |
CN107479980B (zh) | 一种检测应用中死锁的方法与设备 | |
US20140109058A1 (en) | Test language interpreter | |
US20180173612A1 (en) | Debugging method | |
US8276021B2 (en) | Concurrency test effectiveness via mutation testing and dynamic lock elision | |
US10725889B2 (en) | Testing multi-threaded applications | |
Gotovos et al. | Test-driven development of concurrent programs using concuerror | |
US20180322029A1 (en) | Method and apparatus for automatic cross-system program debugging | |
US20130067439A1 (en) | Injecting faults into program for testing | |
Pina et al. | Tedsuto: A general framework for testing dynamic software updates | |
US10387294B2 (en) | Altering a test | |
WO2012080262A1 (fr) | Injection de code d'erreur de logiciel | |
Dong et al. | Concurrency-related flaky test detection in android apps | |
US8972784B2 (en) | Method and device for testing a system comprising at least a plurality of software units that can be executed simultaneously | |
US9218273B2 (en) | Automatic generation of a resource reconfiguring test | |
US7493528B1 (en) | Resolving conflicts between multiple automation managers in the management of software resources using intention flags |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 15881727 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 15881727 Country of ref document: EP Kind code of ref document: A1 |