Skip to content

Commit 3b5ae67

Browse files
committed
[virt/cpu] Set proper return value on sched_setaffinity syscall.
1 parent 3e9fc37 commit 3b5ae67

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/virt/cpu.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ PostPatchFn PatchSchedSetaffinity(PrePatchArgs args) {
9999
warn("SYS_sched_getaffinity cannot find thread with OS id %u, ignored!", linuxTid);
100100
PIN_SetSyscallNumber(args.ctxt, args.std, (ADDRINT) SYS_getpid); // squash
101101
return [](PostPatchArgs args) {
102+
PIN_SetSyscallNumber(args.ctxt, args.std, (ADDRINT)-EPERM);
102103
return PPA_NOTHING;
103104
};
104105
}
@@ -114,6 +115,7 @@ PostPatchFn PatchSchedSetaffinity(PrePatchArgs args) {
114115
}
115116
PIN_SetSyscallNumber(args.ctxt, args.std, (ADDRINT) SYS_getpid); // squash
116117
return [](PostPatchArgs args) {
118+
PIN_SetSyscallNumber(args.ctxt, args.std, (ADDRINT)0); // return 0 on success
117119
return PPA_USE_JOIN_PTRS;
118120
};
119121
}

0 commit comments

Comments
 (0)