diff options
Diffstat (limited to 'pkg/sentry/platform/ptrace/ptrace.go')
-rw-r--r-- | pkg/sentry/platform/ptrace/ptrace.go | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/pkg/sentry/platform/ptrace/ptrace.go b/pkg/sentry/platform/ptrace/ptrace.go index 05f8b1d05..a44f549a2 100644 --- a/pkg/sentry/platform/ptrace/ptrace.go +++ b/pkg/sentry/platform/ptrace/ptrace.go @@ -101,9 +101,11 @@ func (c *context) Switch(as platform.AddressSpace, ac arch.Context, cpu int32) ( s := as.(*subprocess) isSyscall := s.switchToApp(c, ac) - var faultSP *subprocess - var faultAddr usermem.Addr - var faultIP usermem.Addr + var ( + faultSP *subprocess + faultAddr usermem.Addr + faultIP usermem.Addr + ) if !isSyscall && linux.Signal(c.signalInfo.Signo) == linux.SIGSEGV { faultSP = s faultAddr = usermem.Addr(c.signalInfo.Addr()) @@ -161,7 +163,12 @@ func (c *context) Switch(as platform.AddressSpace, ac arch.Context, cpu int32) ( lastFaultIP == faultIP { at.Write = true } - return &c.signalInfo, at, platform.ErrContextSignal + + // Unfortunately, we have to unilaterally return ErrContextSignalCPUID + // here, in case this fault was generated by a CPUID exception. There + // is no way to distinguish between CPUID-generated faults and regular + // page faults. + return &c.signalInfo, at, platform.ErrContextSignalCPUID } // Interrupt interrupts the running guest application associated with this context. |