From ee64538c9ffd9061beed35146e37813a1e26a152 Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Thu, 15 Jun 2023 00:13:50 -0700 Subject: executor: use exitf instead of fail outside of setup sequence (#3959) We have a long history of executor managing to corrupt itself in various interesting ways (e.g. using read with a pointer pointing to some global/stack variable and then kernel overwrites it). Or rt_sigreturn can corrupt other registers which won't cause immediate SIGSEGV, but rather some random behavior later. This is the race we can't win. We can't rely on memory consistency when the test already started, so we should use exitf instead of fail outside of setup sequence (and relying more on unit testing to ensure that executor works as expected for sane programs). Suggested-by: Dmitry Vyukov Signed-off-by: Andrei Vagin --- executor/executor.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'executor/executor.cc') diff --git a/executor/executor.cc b/executor/executor.cc index f6b09f30a..b2e24f46b 100644 --- a/executor/executor.cc +++ b/executor/executor.cc @@ -980,8 +980,8 @@ thread_t* schedule_call(int call_index, int call_num, uint64 copyout_index, uint exitf("out of threads"); thread_t* th = &threads[i]; if (event_isset(&th->ready) || !event_isset(&th->done) || th->executing) - failmsg("bad thread state in schedule", "ready=%d done=%d executing=%d", - event_isset(&th->ready), event_isset(&th->done), th->executing); + exitf("bad thread state in schedule: ready=%d done=%d executing=%d", + event_isset(&th->ready), event_isset(&th->done), th->executing); last_scheduled = th; th->copyout_pos = pos; th->copyout_index = copyout_index; @@ -1054,8 +1054,8 @@ void write_coverage_signal(cover_t* cov, uint32* signal_count_pos, uint32* cover void handle_completion(thread_t* th) { if (event_isset(&th->ready) || !event_isset(&th->done) || !th->executing) - failmsg("bad thread state in completion", "ready=%d done=%d executing=%d", - event_isset(&th->ready), event_isset(&th->done), th->executing); + exitf("bad thread state in completion: ready=%d done=%d executing=%d", + event_isset(&th->ready), event_isset(&th->done), th->executing); if (th->res != (intptr_t)-1) copyout_call_results(th); -- cgit mrf-deployment