summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/arch
diff options
context:
space:
mode:
authorAndrei Vagin <avagin@gmail.com>2021-03-30 21:40:07 -0700
committerAndrei Vagin <avagin@gmail.com>2021-04-01 13:28:15 -0700
commiteb9b8e53a3ef7bb96dcb59a0121fa9ed22f01bfd (patch)
treed01a7b7aae854e5b2a89c156d809e1b6aafc4640 /pkg/sentry/arch
parent6c10c772e46ffe8d27cffe77aed24f0d334d611c (diff)
platform/kvm/x86: restore mxcsr when switching from guest to sentry
Goruntime sets mxcsr once and never changes it. Reported-by: syzbot+ec55cea6e57ec083b7a6@syzkaller.appspotmail.com Fixes: #5754
Diffstat (limited to 'pkg/sentry/arch')
-rw-r--r--pkg/sentry/arch/fpu/fpu_amd64.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/pkg/sentry/arch/fpu/fpu_amd64.go b/pkg/sentry/arch/fpu/fpu_amd64.go
index 1e9625bee..f0ba26736 100644
--- a/pkg/sentry/arch/fpu/fpu_amd64.go
+++ b/pkg/sentry/arch/fpu/fpu_amd64.go
@@ -219,6 +219,11 @@ func (s *State) PtraceSetXstateRegs(src io.Reader, maxlen int, featureSet *cpuid
return copy(*s, f), nil
}
+// SetMXCSR sets the MXCSR control/status register in the state.
+func (s *State) SetMXCSR(mxcsr uint32) {
+ hostarch.ByteOrder.PutUint32((*s)[mxcsrOffset:], mxcsr)
+}
+
// BytePointer returns a pointer to the first byte of the state.
//
//go:nosplit