aboutsummaryrefslogtreecommitdiffstats
path: root/executor
diff options
context:
space:
mode:
authorAndrei Vagin <avagin@google.com>2024-11-15 21:35:00 +0000
committerDmitry Vyukov <dvyukov@google.com>2024-11-18 10:07:10 +0000
commite0aa7963ba56a926d1a741e7f580d24ce94c4e65 (patch)
tree6bfe42b766735a1a126001982ec38c3ed28c80ce /executor
parente7bb5d6eaa12da79db8e670ea78af25fb5a49e02 (diff)
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)<<runner.procs)-1 { avoid = 0 } ``` Signed-off-by: Andrei Vagin <avagin@google.com>
Diffstat (limited to 'executor')
-rw-r--r--executor/executor_runner.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/executor/executor_runner.h b/executor/executor_runner.h
index 5680f8fc2..c24886b10 100644
--- a/executor/executor_runner.h
+++ b/executor/executor_runner.h
@@ -52,21 +52,31 @@ public:
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<int> ids_;
+ uint64 mask_;
ProcIDPool(const ProcIDPool&) = delete;
ProcIDPool& operator=(const ProcIDPool&) = delete;
@@ -103,6 +113,8 @@ public:
{
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_)