Search code examples
assemblyvirtualizationvirtual-machineintelprocessor

Can Intel VT-x and AMD-V be used in user mode?


Modern CPUs x86 support 'hooking' for certain CPU instructions. Is it possible to utilize these features from ring 3?


Solution

  • I managed to RTFM:

    At least on Intel CPUs VT-x can only be used from ring 0. From the VMLAUNCH instruction documentation (Vol. 3C Chapter 30):

    Operation:
    
    IF (not in VMX operation) or (CR0.PE = 0) or (RFLAGS.VM = 1) or (IA32_EFER.LMA = 1 and CS.L = 0)
        THEN #UD;
    ELSIF in VMX non-root operation
        THEN VMexit;
    ELSIF CPL > 0
        THEN #GP(0); 
    [...]