mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Make KVM system call first check.
PiperOrigin-RevId: 196613447 Change-Id: Ib76902896798f072c3031b0c5cf7b433718928b7
This commit is contained in:
@@ -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))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user