Fix improper use of RawSyscall in KVM

futex wait needs to be called surrounded by syscall.Entersyscall() and
syscall.Exitsyscall(), which RawSyscall does not do. It was a mistake
to substitute it.

PiperOrigin-RevId: 681629844
This commit is contained in:
Konstantin Bogomolov
2024-10-02 16:18:06 -07:00
committed by gVisor bot
parent ca8d05a657
commit d3ce23c224
+3 -2
View File
@@ -138,11 +138,12 @@ func (c *vCPU) notify() {
//
// This panics on error.
func (c *vCPU) waitUntilNot(state uint32) {
errno := hostsyscall.RawSyscallErrno(
_, _, errno := unix.Syscall6(
unix.SYS_FUTEX,
uintptr(unsafe.Pointer(&c.state)),
linux.FUTEX_WAIT|linux.FUTEX_PRIVATE_FLAG,
uintptr(state))
uintptr(state),
0, 0, 0)
if errno != 0 && errno != unix.EINTR && errno != unix.EAGAIN {
panic("futex wait error")
}