Patching functions in use on a running computer system
First Claim
Patent Images
1. A method comprising:
- receiving a call to an original function;
modifying, by a processing device, the original function to call a hot patch function to transfer execution control from the original function to a replacement function by changing an initial instruction in the original function that specifies no operation to be executed to specifying that the call to the hot patch function is to be executed, wherein the hot patch function is conditionally applied to replace the original function in view of a number of calls to the original function that have been received by applying the hot patch function for a particular call for every defined number of calls that have been received and not applying the hot patch function for remaining calls for every defined number of calls that have been received;
changing, by the processing device, a value of a pointer, in a data structure identifying a plurality of original functions used by an operating system, from an original memory location associated with the original function to a replacement memory location associated with the replacement function;
executing, by the processing device, the replacement function using the pointer to the replacement memory location associated with the replacement function in the data structure identifying the plurality of original functions used by the operating system; and
returning, by the processing device, to a caller of the original function in response to executing the replacement function.
1 Assignment
0 Petitions
Accused Products
Abstract
A mechanism for patching functions in use on a running computer system. A method includes modifying an original function to call a hot patch function. The hot patch function transfers execution control from the original function to a replacement function.
-
Citations
17 Claims
-
1. A method comprising:
-
receiving a call to an original function; modifying, by a processing device, the original function to call a hot patch function to transfer execution control from the original function to a replacement function by changing an initial instruction in the original function that specifies no operation to be executed to specifying that the call to the hot patch function is to be executed, wherein the hot patch function is conditionally applied to replace the original function in view of a number of calls to the original function that have been received by applying the hot patch function for a particular call for every defined number of calls that have been received and not applying the hot patch function for remaining calls for every defined number of calls that have been received; changing, by the processing device, a value of a pointer, in a data structure identifying a plurality of original functions used by an operating system, from an original memory location associated with the original function to a replacement memory location associated with the replacement function; executing, by the processing device, the replacement function using the pointer to the replacement memory location associated with the replacement function in the data structure identifying the plurality of original functions used by the operating system; and returning, by the processing device, to a caller of the original function in response to executing the replacement function. - View Dependent Claims (2, 3, 4, 5, 6)
-
-
7. A system comprising:
-
a memory; a processing device, operatively coupled with the memory, to; receive a call to an original function; modify the original function to call a hot patch function to transfer execution control from the original function to a replacement function by changing an initial instruction in the original function that specifies no operation to be executed to specifying that the call to the hot patch function is to be executed, wherein the hot patch function is conditionally applied to replace the original function in view of a number of calls to the original function that have been received by applying the hot patch function for a particular call for every defined number of calls that have been received and not applying the hot patch function for remaining calls for every defined number of calls that have been received; change a value of a pointer, in a data structure identifying a plurality of original functions used by an operating system, from an original memory location associated with the original function to a replacement memory location associated with the replacement function; execute the replacement function using the pointer to the replacement memory location associated with the replacement function in the data structure identifying the plurality of original functions used by the operating system; and return to a caller of the original function in response to executing the replacement function. - View Dependent Claims (8, 9, 10, 11, 12)
-
-
13. A non-transitory machine-readable storage medium comprising data, when accessed by a processing device, cause the processing device to:
-
receive a call to an original function; modify, by the processing device, the original function to call a hot patch function to transfer execution control from the original function to a replacement function by changing an initial instruction in the original function that specifies no operation to be executed to specifying that the call to the hot patch function is to be executed, wherein the hot patch function is conditionally applied to replace the original function in view of a number of calls to the original function that have been received by applying the hot patch function for a particular call for every defined number of calls that have been received and not applying the hot patch function for remaining calls for every defined number of calls that have been received; change, by the processing device, a value of a pointer, in a data structure identifying a plurality of original functions used by an operating system, from an original memory location associated with the original function to a replacement memory location associated with the replacement function; execute, by the processing device, the replacement function using the pointer to the replacement memory location associated with the replacement function in the data structure identifying the plurality of original functions used by the operating system; and return, by the processing device, to a caller of the original function in response to executing the replacement function. - View Dependent Claims (14, 15, 16, 17)
-
Specification