摘要 |
A method, apparatus and storage medium for dynamically patching function. The method comprises: restoring N long jump instructions at initial instructions of a modified patched function to original instructions of the patched function on the basis of 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, modifying the N original instructions at the start of the initial instructions into the long jump instructions, in order to dynamically patch the function. By adopting this method, firstly, 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 the 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 as to complete the replacement for the patched function, realize the dynamical patching for the function, and solve the problem that after the initial instructions of the patched function are modified into the long jump instructions, the modified system may be unable to operate normally. |