platform/kvm: calll sigtimedwait with zero timeout

sigtimedwait is used to check pending signals and
it should not block.

PiperOrigin-RevId: 277777269
This commit is contained in:
Andrei Vagin 2019-10-31 12:27:46 -07:00 committed by gVisor bot
parent 7dcfcd53e4
commit f7dbddaf77
1 changed files with 7 additions and 3 deletions

View File

@ -80,13 +80,17 @@ func bluepillHandler(context unsafe.Pointer) {
// interrupted KVM. Since we're in a signal handler // interrupted KVM. Since we're in a signal handler
// currently, all signals are masked and the signal // currently, all signals are masked and the signal
// must have been delivered directly to this thread. // must have been delivered directly to this thread.
timeout := syscall.Timespec{}
sig, _, errno := syscall.RawSyscall6( sig, _, errno := syscall.RawSyscall6(
syscall.SYS_RT_SIGTIMEDWAIT, syscall.SYS_RT_SIGTIMEDWAIT,
uintptr(unsafe.Pointer(&bounceSignalMask)), uintptr(unsafe.Pointer(&bounceSignalMask)),
0, // siginfo. 0, // siginfo.
0, // timeout. uintptr(unsafe.Pointer(&timeout)), // timeout.
8, // sigset size. 8, // sigset size.
0, 0) 0, 0)
if errno == syscall.EAGAIN {
continue
}
if errno != 0 { if errno != 0 {
throw("error waiting for pending signal") throw("error waiting for pending signal")
} }