摘要 |
A method, apparatus and a storage medium for dynamically patching a function are provided. The method includes that: N long jump instructions at initial instructions of a modified patched function are restored to original instructions of the patched function according to a pre-tag of a currently running task, wherein N is an integer more than or equal to 3; and when the currently running task quits running, the N original instructions at the start of the initial instructions are modified into the long jump instructions in order to dynamically patch the function. By adopting the method, the N long jump instructions at the initial instructions of the modified patched function are restored as needed to the original instructions of the patched function during task running, and then, when the task quits running, the N original instructions at the start of the initial instructions are modified into the long jump instructions, so that replacement for the patched function is completed, dynamical patching for the function is realized, and the problem that a modified system may be unable to run normally after the initial instructions of the patched function are modified into the long jump instructions is solved. |