aboutsummaryrefslogtreecommitdiffstats
path: root/executor/executor.cc
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2020-12-05 09:00:06 +0100
committerDmitry Vyukov <dvyukov@google.com>2020-12-05 09:38:46 +0100
commit4ce69996ec362f8dd9762dcc1643d13cebaab44a (patch)
tree11cc9114f8821ff71d53360dd83401ff59926f35 /executor/executor.cc
parent0ef84591d219e3142621dc31dcec970300f7ec0c (diff)
sys/linux, sys/freebsd: apply more ignore_return attributes
1. Apply ignore_return to semctl$GETVAL which produces random errno values on linux and freebsd. 2. Apply ignore_return to prctl and remove the custom code in executor. 3. Remove the custom errno ignoring code in fuchsia executor. The calls are already marked as ignore_return, so this is just a leftover. 4. Only reset errno for ignore_return. The syscall can still return a resource (maybe). We only need to reset errno for fallback coverage.
Diffstat (limited to 'executor/executor.cc')
-rw-r--r--executor/executor.cc9
1 files changed, 3 insertions, 6 deletions
diff --git a/executor/executor.cc b/executor/executor.cc
index b221c2070..2f90e4092 100644
--- a/executor/executor.cc
+++ b/executor/executor.cc
@@ -1112,12 +1112,9 @@ void execute_call(thread_t* th)
errno = EFAULT;
NONFAILING(th->res = execute_syscall(call, th->args));
th->reserrno = errno;
- if (th->res == -1 && th->reserrno == 0)
- th->reserrno = EINVAL; // our syz syscalls may misbehave
- if (call->attrs.ignore_return) {
- th->res = 0;
- th->reserrno = 0;
- }
+ // Our pseudo-syscalls may misbehave.
+ if ((th->res == -1 && th->reserrno == 0) || call->attrs.ignore_return)
+ th->reserrno = EINVAL;
// Reset the flag before the first possible fail().
th->soft_fail_state = false;