summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--pkg/sentry/platform/kvm/machine_amd64.go9
1 files changed, 4 insertions, 5 deletions
diff --git a/pkg/sentry/platform/kvm/machine_amd64.go b/pkg/sentry/platform/kvm/machine_amd64.go
index dfa691e88..fe4d31702 100644
--- a/pkg/sentry/platform/kvm/machine_amd64.go
+++ b/pkg/sentry/platform/kvm/machine_amd64.go
@@ -111,8 +111,11 @@ func (c *vCPU) SwitchToUser(regs *syscall.PtraceRegs, fpState *byte, pt *pagetab
vector = c.CPU.SwitchToUser(regs, fpState, pt, flags)
exitsyscall()
- // Free and clear.
switch vector {
+ case ring0.Syscall, ring0.SyscallInt80:
+ // Fast path: system call executed.
+ return nil, usermem.NoAccess, nil
+
case ring0.Debug, ring0.Breakpoint:
info := &arch.SignalInfo{Signo: int32(syscall.SIGTRAP)}
return info, usermem.AccessType{}, platform.ErrContextSignal
@@ -158,10 +161,6 @@ func (c *vCPU) SwitchToUser(regs *syscall.PtraceRegs, fpState *byte, pt *pagetab
redpill() // Bail and reacqire.
return nil, usermem.NoAccess, platform.ErrContextInterrupt
- case ring0.Syscall, ring0.SyscallInt80:
- // System call executed.
- return nil, usermem.NoAccess, nil
-
default:
panic(fmt.Sprintf("unexpected vector: 0x%x", vector))
}