diff options
author | gVisor bot <gvisor-bot@google.com> | 2020-05-12 17:36:52 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-05-12 17:36:52 +0000 |
commit | 8c219c77bd0b8a1460a99d7ac004b400a053b7c9 (patch) | |
tree | 51c59256e05f68b25d48715a032dc1458b456fa2 /pkg/sentry/arch | |
parent | a19a20e0bb109f3e0cac4752ff7c5ef912c76532 (diff) | |
parent | 06ded1c4372d4871f0581c7090957935d93cd50e (diff) |
Merge release-20200422.0-71-g06ded1c (automated)
Diffstat (limited to 'pkg/sentry/arch')
-rwxr-xr-x | pkg/sentry/arch/signal_arm64.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/pkg/sentry/arch/signal_arm64.go b/pkg/sentry/arch/signal_arm64.go index 1cb1adf8c..642c79dda 100755 --- a/pkg/sentry/arch/signal_arm64.go +++ b/pkg/sentry/arch/signal_arm64.go @@ -19,6 +19,7 @@ import ( "syscall" "gvisor.dev/gvisor/pkg/abi/linux" + "gvisor.dev/gvisor/pkg/log" "gvisor.dev/gvisor/pkg/usermem" ) @@ -134,6 +135,11 @@ func (c *context64) SignalSetup(st *Stack, act *SignalAct, info *SignalInfo, alt c.Regs.Regs[1] = uint64(infoAddr) c.Regs.Regs[2] = uint64(ucAddr) c.Regs.Regs[30] = uint64(act.Restorer) + + // Save the thread's floating point state. + c.sigFPState = append(c.sigFPState, c.aarch64FPState) + // Signal handler gets a clean floating point state. + c.aarch64FPState = newAarch64FPState() return nil } @@ -155,5 +161,21 @@ func (c *context64) SignalRestore(st *Stack, rt bool) (linux.SignalSet, SignalSt c.Regs.Sp = uc.MContext.Sp c.Regs.Pstate = uc.MContext.Pstate + // Restore floating point state. + l := len(c.sigFPState) + if l > 0 { + c.aarch64FPState = c.sigFPState[l-1] + // NOTE(cl/133042258): State save requires that any slice + // elements from '[len:cap]' to be zero value. + c.sigFPState[l-1] = nil + c.sigFPState = c.sigFPState[0 : l-1] + } else { + // This might happen if sigreturn(2) calls are unbalanced with + // respect to signal handler entries. This is not expected so + // don't bother to do anything fancy with the floating point + // state. + log.Warningf("sigreturn unable to restore application fpstate") + } + return uc.Sigset, uc.Stack, nil } |