• Nadav Amit's avatar
    KVM: x86: Perform limit checks when assigning EIP · d50eaa18
    Nadav Amit authored
    If branch (e.g., jmp, ret) causes limit violations, since the target IP >
    limit, the #GP exception occurs before the branch.  In other words, the RIP
    pushed on the stack should be that of the branch and not that of the target.
    
    To do so, we can call __linearize, with new EIP, which also saves us the code
    which performs the canonical address checks. On the case of assigning an EIP >=
    2^32 (when switching cs.l), we also safe, as __linearize will check the new EIP
    does not exceed the limit and would trigger #GP(0) otherwise.
    Signed-off-by: default avatarNadav Amit <namit@cs.technion.ac.il>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    d50eaa18
emulate.c 130 KB