From e0aa7963ba56a926d1a741e7f580d24ce94c4e65 Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Fri, 15 Nov 2024 21:35:00 +0000 Subject: [PATCH] executor: use any executor if the avoid mask included all of them After 9fc8fe026baa ("executor: better handling for hanged test processes"), yz-executor's responses may reference procids outside of the [0;procs] range. If procids are no longer dense on the syz-executor side, we cannot rely on this check in pkg/rpcserver: ``` if avoid == (uint64(1)< --- executor/executor_runner.h | 14 +++++++++++++- pkg/rpcserver/runner.go | 3 --- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/executor/executor_runner.h b/executor/executor_runner.h index 5680f8fc2632..c24886b10cc4 100644 --- a/executor/executor_runner.h +++ b/executor/executor_runner.h @@ -52,21 +52,31 @@ class ProcIDPool constexpr int kNumGoodProcs = 10; for (int i = 0; i < std::max(num_procs, kNumGoodProcs); i++) ids_.push_back(i); + mask_ = 0; } int Alloc(int old = -1) { - if (old >= 0) + if (old >= 0) { + mask_ &= ~(1UL << old); ids_.push_back(old); + } if (ids_.empty()) fail("out of proc ids"); int id = ids_.front(); ids_.pop_front(); + mask_ |= 1UL << id; return id; } + uint64 Mask() + { + return mask_; + } + private: std::deque ids_; + uint64 mask_; ProcIDPool(const ProcIDPool&) = delete; ProcIDPool& operator=(const ProcIDPool&) = delete; @@ -103,6 +113,8 @@ class Proc { if (state_ != State::Started && state_ != State::Idle) return false; + if (((~msg.avoid) & proc_id_pool_.Mask()) == 0) + msg.avoid = 0; if (msg.avoid & (1ull << id_)) return false; if (msg_) diff --git a/pkg/rpcserver/runner.go b/pkg/rpcserver/runner.go index 1af35b6d28d9..29e79bad579e 100644 --- a/pkg/rpcserver/runner.go +++ b/pkg/rpcserver/runner.go @@ -321,9 +321,6 @@ func (runner *Runner) sendRequest(req *queue.Request) error { avoid |= uint64(1 << id.Proc) } } - if avoid == (uint64(1)<