摘要 |
<p>A patching method and a patching device in a multi-core environment are provided. The patching method includes: sending an inter-core non-maskable interrupt to each target Virtual Central Processing Unit (CPU) (VCPU) in a target VCPU group which share a code segment, so that said each target VCPU enters a patch synchronization state, in response to the inter-core non-maskable interrupt; and monitoring the patch synchronization state of said each target VCPU, and after all the target VCPUs have entered the patch synchronization state, modifying a first instruction of an original function to be patched of said each target VCPU into an abnormal instruction, and outputting a patch synchronization state end notification to all the target VCPUs, so that the original function to be patched is enabled to jump to a new patch function in an exception handling process, which is triggered when the original function to be patched is executed to the abnormal instruction. The method and the device adopt the mode of synchronization of inter-core non-maskable interrupts to realize synchronous activation of patches of the target VCPUs which share the code segment, and realize the complete effectiveness of the patches in the exception handling process.</p> |