diff options
author | gVisor bot <gvisor-bot@google.com> | 2021-03-24 01:53:34 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-03-24 01:53:34 +0000 |
commit | 6d6d1361a87d19477c9f035405065fc9b714ef73 (patch) | |
tree | 72689e458f56eeb2268d4c02f7a64fdad4443cc3 /pkg/ring0 | |
parent | 8e2958434d9fb2d8dc75cd3942be4c90b5c9d7d3 (diff) | |
parent | 56a9a13976ad800a8a34b194d35f0169d0a0bb23 (diff) |
Merge release-20210315.0-18-g56a9a1397 (automated)
Diffstat (limited to 'pkg/ring0')
-rw-r--r-- | pkg/ring0/defs_impl_amd64.go | 3 | ||||
-rw-r--r-- | pkg/ring0/defs_impl_arm64.go | 3 | ||||
-rw-r--r-- | pkg/ring0/kernel_amd64.go | 12 | ||||
-rw-r--r-- | pkg/ring0/kernel_arm64.go | 4 |
4 files changed, 12 insertions, 10 deletions
diff --git a/pkg/ring0/defs_impl_amd64.go b/pkg/ring0/defs_impl_amd64.go index 933018c52..411ea9126 100644 --- a/pkg/ring0/defs_impl_amd64.go +++ b/pkg/ring0/defs_impl_amd64.go @@ -9,6 +9,7 @@ import ( "gvisor.dev/gvisor/pkg/cpuid" "gvisor.dev/gvisor/pkg/ring0/pagetables" "gvisor.dev/gvisor/pkg/sentry/arch" + "gvisor.dev/gvisor/pkg/sentry/arch/fpu" "gvisor.dev/gvisor/pkg/usermem" "io" "reflect" @@ -91,7 +92,7 @@ type SwitchOpts struct { // FloatingPointState is a byte pointer where floating point state is // saved and restored. - FloatingPointState *byte + FloatingPointState *fpu.State // PageTables are the application page tables. PageTables *pagetables.PageTables diff --git a/pkg/ring0/defs_impl_arm64.go b/pkg/ring0/defs_impl_arm64.go index 34d687611..578c6b822 100644 --- a/pkg/ring0/defs_impl_arm64.go +++ b/pkg/ring0/defs_impl_arm64.go @@ -8,6 +8,7 @@ import ( "fmt" "gvisor.dev/gvisor/pkg/ring0/pagetables" "gvisor.dev/gvisor/pkg/sentry/arch" + "gvisor.dev/gvisor/pkg/sentry/arch/fpu" "gvisor.dev/gvisor/pkg/usermem" "io" "reflect" @@ -195,7 +196,7 @@ type SwitchOpts struct { // FloatingPointState is a byte pointer where floating point state is // saved and restored. - FloatingPointState *byte + FloatingPointState *fpu.State // PageTables are the application page tables. PageTables *pagetables.PageTables diff --git a/pkg/ring0/kernel_amd64.go b/pkg/ring0/kernel_amd64.go index 36a60700e..33c259757 100644 --- a/pkg/ring0/kernel_amd64.go +++ b/pkg/ring0/kernel_amd64.go @@ -239,17 +239,17 @@ func (c *CPU) SwitchToUser(switchOpts SwitchOpts) (vector Vector) { regs.Ss = uint64(Udata) // Ditto. // Perform the switch. - swapgs() // GS will be swapped on return. - WriteFS(uintptr(regs.Fs_base)) // escapes: no. Set application FS. - WriteGS(uintptr(regs.Gs_base)) // escapes: no. Set application GS. - LoadFloatingPoint(switchOpts.FloatingPointState) // escapes: no. Copy in floating point. + swapgs() // GS will be swapped on return. + WriteFS(uintptr(regs.Fs_base)) // escapes: no. Set application FS. + WriteGS(uintptr(regs.Gs_base)) // escapes: no. Set application GS. + LoadFloatingPoint(switchOpts.FloatingPointState.BytePointer()) // escapes: no. Copy in floating point. if switchOpts.FullRestore { vector = iret(c, regs, uintptr(userCR3)) } else { vector = sysret(c, regs, uintptr(userCR3)) } - SaveFloatingPoint(switchOpts.FloatingPointState) // escapes: no. Copy out floating point. - WriteFS(uintptr(c.registers.Fs_base)) // escapes: no. Restore kernel FS. + SaveFloatingPoint(switchOpts.FloatingPointState.BytePointer()) // escapes: no. Copy out floating point. + WriteFS(uintptr(c.registers.Fs_base)) // escapes: no. Restore kernel FS. return } diff --git a/pkg/ring0/kernel_arm64.go b/pkg/ring0/kernel_arm64.go index 41909b3a0..7975e5f92 100644 --- a/pkg/ring0/kernel_arm64.go +++ b/pkg/ring0/kernel_arm64.go @@ -62,7 +62,7 @@ func IsCanonical(addr uint64) bool { //go:nosplit func (c *CPU) SwitchToUser(switchOpts SwitchOpts) (vector Vector) { storeAppASID(uintptr(switchOpts.UserASID)) - storeEl0Fpstate(switchOpts.FloatingPointState) + storeEl0Fpstate(switchOpts.FloatingPointState.BytePointer()) if switchOpts.Flush { FlushTlbByASID(uintptr(switchOpts.UserASID)) @@ -82,7 +82,7 @@ func (c *CPU) SwitchToUser(switchOpts SwitchOpts) (vector Vector) { fpDisableTrap = CPACREL1() if fpDisableTrap != 0 { - SaveFloatingPoint(switchOpts.FloatingPointState) + SaveFloatingPoint(switchOpts.FloatingPointState.BytePointer()) } vector = c.vecCode |