diff --git a/pkg/ring0/kernel_amd64.go b/pkg/ring0/kernel_amd64.go index 4a07d453c..e2e9f88c0 100644 --- a/pkg/ring0/kernel_amd64.go +++ b/pkg/ring0/kernel_amd64.go @@ -21,6 +21,7 @@ import ( "encoding/binary" "reflect" + "gvisor.dev/gvisor/pkg/cpuid" "gvisor.dev/gvisor/pkg/hostarch" "gvisor.dev/gvisor/pkg/sentry/arch" ) @@ -293,7 +294,10 @@ func startGo(c *CPU) { // Need to sync XCR0 with the host, because xsave and xrstor can be // called from different contexts. if hasXSAVE { - xsetbv(0, localXCR0) + // Exclude MPX bits. MPX has been deprecated and we have seen + // cases when it isn't supported in VM. + xcr0 := localXCR0 &^ (cpuid.XSAVEFeatureBNDCSR | cpuid.XSAVEFeatureBNDREGS) + xsetbv(0, xcr0) } // Set the syscall target.