mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Check for EINTR from KVM_CREATE_VM
The kernel may return EINTR from:
kvm_create_vm
kvm_init_mmu_notifier
mmu_notifier_register
do_mmu_notifier_register
mm_take_all_locks
Go 1.14's preemptive scheduling signals make hitting this much more likely.
PiperOrigin-RevId: 291212669
This commit is contained in:
committed by
gVisor bot
parent
98e83c444f
commit
7a79715504
@@ -62,9 +62,19 @@ func New(deviceFile *os.File) (*KVM, error) {
|
||||
}
|
||||
|
||||
// Create a new VM fd.
|
||||
vm, _, errno := syscall.RawSyscall(syscall.SYS_IOCTL, fd, _KVM_CREATE_VM, 0)
|
||||
if errno != 0 {
|
||||
return nil, fmt.Errorf("creating VM: %v", errno)
|
||||
var (
|
||||
vm uintptr
|
||||
errno syscall.Errno
|
||||
)
|
||||
for {
|
||||
vm, _, errno = syscall.Syscall(syscall.SYS_IOCTL, fd, _KVM_CREATE_VM, 0)
|
||||
if errno == syscall.EINTR {
|
||||
continue
|
||||
}
|
||||
if errno != 0 {
|
||||
return nil, fmt.Errorf("creating VM: %v", errno)
|
||||
}
|
||||
break
|
||||
}
|
||||
// We are done with the device file.
|
||||
deviceFile.Close()
|
||||
|
||||
Reference in New Issue
Block a user