Open wangziqi2013 opened 5 years ago
This bug won't affect anything on x86 systems. In x86-64, syscall number and syscall return value use the same register. So when you get the syscall number after the syscall, you will automatically get the syscall return value. See http://man7.org/linux/man-pages/man2/syscall.2.html. However, I think use PIN_GetSyscallReturn will be more standard and readable.
I found a possible typo in virt/timeout.cpp, line 131:
int res = (int)PIN_GetSyscallNumber(ctxt, std);
I suspect the correct PIN interface to call should be
PIN_GetSyscallReturn
, because later on in line 134 to 139 the value of res is used as if it were a return value of the system call:A similar typo can be found in line 200 - 203:
Again the value of res is compared with zero as if it were the return value of SYS_futex system call.
I can submit a simple pull request to fix this, if this is indeed a typo.