Browse Prior Art Database

Method To Hot-patch A Function Disclosure Number: IPCOM000236360D
Publication Date: 2014-Apr-22
Document File: 3 page(s) / 33K

Publishing Venue

The Prior Art Database


Disclosed is a technique to hot-patch a function using architecture supported out-of-line instructions. General hot-patching techniques insert unconditional jump instructions at the beginning of the old function to jump to the new function. Hence, whenever the old function is called, the execution or control flow is transferred to the new function, effectively performing the new functionality. Proposed is two different techniques which uses architecture supported "execute" instructions, to perform hot-patching. The core idea of the invention is to use execute instruction instead of jump/branch, which executes the instructions in the new/changed function out-of-line instead of directly branching to the new/changed function.

This text was extracted from a PDF file.
This is the abbreviated version, containing approximately 48% of the total text.

Page 01 of 3

Method To Hot-patch A Function

Software bugs are unavoidable due to the complex nature of software engineering. Most commercial software distributors come up with patches which fix bugs in the current/released version of the software. This activity would necessitate a reboot of the kernel or restart of the application, leading to downtimes that may be beyond acceptable durations. Hence it is desirable to perform hot-patching, where the patch is applied to the running instance of the software without a reboot/restart.

Hot-patching is a technique that requires lot of complex steps to properly apply on the running instance of a software. One of the steps involved in typical hot-patching is to insert a jump instruction at the beginning of the function to jump to the new/patched code of that function. This is the method followed by ksplice and other known technologies. Proposed in this invention are alternative techniques which does not insert/use jump instruction to branch to the new-code for hot-patching.

The approach is to use special instructions provided by architectures that support execution of instructions (single or multiple) 'out of line' from the existing code flow stream. One such embodiment is the execute instruction (ex and exrl) available in the IBM* s/390* architecture, which executes a single instruction at the address specified by the operand.

Proposed are two different techniques to hot-patch a function using the architecture supported execute instruction. In first technique, all the functions in the program will have an execute instruction at the beginning whose operand points to a location with a "nop" instruction. At the time of hot-patching the "nop" is replaced by a jump/branch to transfer the control to new function.

In second technique, the instructions of the old function are replaced with "ex" instruction, where the operand is the instruction of the new function. Even though the old code in this case is being modified, the control flow to new code is not being transferred. As execute instruction will not transfer the control flow instead executes a single instructions specified by the operand out-of-line. This approach has a limitation depending on the size of the new function.


Existing techniques for hot-patch includes replacing few bytes of instruction at the beginning of the old function with jump/branch instructions dynamically at the time of hot-patching to transfer the control to the new function. Proposed are two different techniques where first technique will not modify/replace any instructions in the old function. However first technique transfers control to the new function. Second technique will not transfer control to the new function, however, modifies few bytes of instruction of the old function.

Technique 1: ------------------

In this technique compiler is enhanced to emit additional "ex" instructions at the beginning of the function as shown. Initially the operand of the execute ins...