x86: Reload SS when switching to 5-level page tables
PATCH 1/1 x86: Reload SS when switching to 5-level page tables
Load SS with a valid segment when switching to 5-level page tables to avoid taking a #SS due to a NULL segment when making a CALL with paging disabled.
The "access" test calls setup_5level_page_table()/switch_to_5level() after generating and handling usermode exceptions. Per Intel's SDM, SS is nullified on an exception that changes CPL:
The new SS is set to NULL if there is a change in CPL.
Signed-off-by Sean Christopherson <[email protected]>
--- x86/cstart64.S | 3 +++ 1 file changed, 3 insertions(+)
x86/cstart64.S +3 -0
@@ -159,6 +159,9 @@ switch_to_5level: bts $12, %eax mov %eax, %cr4 + mov $0x10, %ax + mov %ax, %ss + call enter_long_mode jmpl $8, $lvl5
Signature · 1 line
2.24.1