Preventing execution of malicious instructions based on address specified in a branch instruction
In one aspect of the embodiments, malicious instructions executed or to be executed by a processor in a computing device are identified and preventive action is taken in response to that detection, thereby preventing harm to the computing device and the user's data by the malicious instructions. In another aspect of the embodiments, a thread context monitor determines which thread are active within an operating system at any given time, which further enhances the ability to determine which thread contains malicious instructions.
1. A method of detecting malicious code within a computer system comprising a processor coupled to a memory device, the processor comprising a branch prediction unit and a performance monitoring unit, the method comprising:
generating a data structure containing one or more addresses, wherein each of the one or more addresses are within an address range assigned to a known software module;
detecting a failure by the branch prediction unit to predict an address that would be the subject of a branch instruction;
reporting, by the performance monitoring unit, the failure;
determining if the address is contained in the data structure; and
when the address is not contained in the data structure, implementing an action comprising one or more of issuing an alert, freezing a module in which the branch instruction is contained, capturing a snapshot of the memory device, and rebooting the computer system.
2. The method of claim 1 , wherein the action comprises issuing an alert.
3. The method of claim 1 , wherein the action comprises freezing a module in which the branch instruction is contained.
4. The method of claim 1 , wherein the action comprises capturing a snapshot of the memory device.
5. The method of claim 1 , wherein the action rebooting the computer system.