ionescu007 / SimpleVisor

SimpleVisor is a simple, portable, Intel VT-x hypervisor with two specific goals: using the least amount of assembly code (10 lines), and having the smallest amount of VMX-related code to support dynamic hyperjacking and unhyperjacking (that is, virtualizing the host state from within the host). It works on Windows and UEFI.
http://ionescu007.github.io/SimpleVisor/
1.69k stars 259 forks source link

ShvVmxMtrrAdjustEffectiveMemoryType: Fixed off-by-one edge case in memory type assignment #37

Closed Gbps closed 5 years ago

Gbps commented 5 years ago

There is a miscalculation in the range of a singular 2MB frame which causes an extraneous frame to be marked as the wrong cache type at the beginning of the range. This is because the code incorrectly checks a range of a given frame to be 0 to 2MB instead of 0 to 2MB-1 inclusive.

Consider the following case:

The fix is simple, just only check the range of 0 to 2MB-1 for every frame.

Gbps commented 5 years ago

Done :)