Skip to content

Commit

Permalink
Fix for VMENTER to unrestricted guest mode.
Browse files Browse the repository at this point in the history
According to SDM:
SS.DPL is always loaded from the SS access-rights field. This will be the current privilege level (CPL) after the VM entry completes.

Fixes "VirtualBox crash with nested paging enabled #477"
  • Loading branch information
Stanislav Shwartsman committed Feb 8, 2025
1 parent c605542 commit c7d08c9
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions bochs/cpu/vmx.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2157,6 +2157,9 @@ Bit32u BX_CPU_C::VMenterLoadCheckGuestState(Bit64u *qualification)
for(unsigned segreg=0; segreg<6; segreg++)
BX_CPU_THIS_PTR sregs[segreg] = guest.sregs[segreg];

// SS.DPL is always loaded from the SS access-rights field. This will be the current privilege level (CPL) after the VM entry completes.
CPL = guest.sregs[BX_SEG_REG_SS].cache.dpl;

BX_CPU_THIS_PTR gdtr.base = gdtr_base;
BX_CPU_THIS_PTR gdtr.limit = gdtr_limit;
BX_CPU_THIS_PTR idtr.base = idtr_base;
Expand Down

0 comments on commit c7d08c9

Please sign in to comment.