aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2020-01-15 17:08:25 +0100
committerDmitry Vyukov <dvyukov@google.com>2020-01-15 17:35:31 +0100
commitba92288dcf9d20a05400b79fe74e1af585eebcdc (patch)
treea9dc3189c88096737a5e787cbf2bde6e0ebc70fd
parent069a5a4486fb7cae0cb63d04d4799839a497a70b (diff)
executor: ignore prctl in fallback coverage
Some prctl commands don't respect the normal convention for return values (e.g. PR_GET_TIMERSLACK, but there are more) and may produce all possible errno values. This conflicts with fallback coverage.
-rw-r--r--executor/executor_linux.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/executor/executor_linux.h b/executor/executor_linux.h
index 73005877d..63c900c5a 100644
--- a/executor/executor_linux.h
+++ b/executor/executor_linux.h
@@ -73,7 +73,13 @@ static intptr_t execute_syscall(const call_t* c, intptr_t a[kMaxArgs])
{
if (c->call)
return c->call(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8]);
- return syscall(c->sys_nr, a[0], a[1], a[2], a[3], a[4], a[5]);
+ intptr_t res = syscall(c->sys_nr, a[0], a[1], a[2], a[3], a[4], a[5]);
+ // Some prctl commands don't respect the normal convention for return values
+ // (e.g. PR_GET_TIMERSLACK, but there are more) and may produce all possible
+ // errno values. This conflicts with fallback coverage.
+ if (!flag_coverage && res == -1 && !strcmp(c->name, "prctl"))
+ errno = EINVAL;
+ return res;
}
static void cover_open(cover_t* cov, bool extra)