No public description PiperOrigin-RevId: 856925740
diff --git a/centipede/centipede.cc b/centipede/centipede.cc index 2c20702..d288b04 100644 --- a/centipede/centipede.cc +++ b/centipede/centipede.cc
@@ -529,7 +529,7 @@ const std::string features_path = wd.FeaturesFilePaths().Shard(shard_index); if (env_.serialize_shard_loads) { ABSL_CONST_INIT static absl::Mutex load_shard_mu{absl::kConstInit}; - absl::MutexLock lock(&load_shard_mu); + absl::MutexLock lock(load_shard_mu); ReadShard(corpus_path, features_path, input_features_callback); } else { ReadShard(corpus_path, features_path, input_features_callback); @@ -914,7 +914,7 @@ const size_t suspect_input_idx = std::clamp<size_t>( batch_result.num_outputs_read(), 0, input_vec.size() - 1); auto log_execution_failure = [&](std::string_view log_prefix) { - absl::MutexLock lock(&GetExecutionLoggingMutex()); + absl::MutexLock lock(GetExecutionLoggingMutex()); FUZZTEST_LOG(INFO) << log_prefix << "Batch execution failed:" << "\nBinary : " << binary
diff --git a/centipede/centipede_callbacks.cc b/centipede/centipede_callbacks.cc index 522a594..a9e0d7d 100644 --- a/centipede/centipede_callbacks.cc +++ b/centipede/centipede_callbacks.cc
@@ -784,7 +784,7 @@ } std::string log_text; ReadFromLocalFile(execute_log_path_, log_text); - absl::MutexLock lock(&GetExecutionLoggingMutex()); + absl::MutexLock lock(GetExecutionLoggingMutex()); for (const auto& log_line : absl::StrSplit(absl::StripAsciiWhitespace(log_text), '\n')) { FUZZTEST_LOG(INFO).NoPrefix() << "LOG: " << log_line;
diff --git a/centipede/command.cc b/centipede/command.cc index 904c1af..50d26ff 100644 --- a/centipede/command.cc +++ b/centipede/command.cc
@@ -518,7 +518,7 @@ } void Command::LogProblemInfo(std::string_view message) const { - absl::MutexLock lock(&GetExecutionLoggingMutex()); + absl::MutexLock lock(GetExecutionLoggingMutex()); FUZZTEST_LOG(ERROR) << message; FUZZTEST_LOG(ERROR).NoPrefix() << "=== COMMAND ===";
diff --git a/centipede/coverage.cc b/centipede/coverage.cc index a5a96e2..2ab42a3 100644 --- a/centipede/coverage.cc +++ b/centipede/coverage.cc
@@ -142,7 +142,7 @@ std::string CoverageLogger::ObserveAndDescribeIfNew(PCIndex pc_index) { if (pc_table_.empty()) return ""; // Fast-path return (symbolization is off). - absl::MutexLock l(&mu_); + absl::MutexLock l(mu_); if (!observed_indices_.insert(pc_index).second) return ""; std::ostringstream os; if (pc_index >= pc_table_.size()) {
diff --git a/centipede/distill.cc b/centipede/distill.cc index 49eb193..d3d9f7f 100644 --- a/centipede/distill.cc +++ b/centipede/distill.cc
@@ -178,12 +178,12 @@ virtual ~CorpusShardWriter() = default; void WriteElt(CorpusElt elt) { - absl::MutexLock lock(&mu_); + absl::MutexLock lock(mu_); WriteEltImpl(std::move(elt)); } void WriteBatch(CorpusEltVec elts) { - absl::MutexLock lock(&mu_); + absl::MutexLock lock(mu_); FUZZTEST_VLOG(1) << log_prefix_ << "writing " << elts.size() << " elements to output shard:\n" << VV(corpus_path_) << "\n" @@ -195,7 +195,7 @@ } Stats GetStats() const { - absl::MutexLock lock(&mu_); + absl::MutexLock lock(mu_); return stats_; } @@ -268,7 +268,7 @@ } {} std::optional<CorpusElt> FilterElt(CorpusElt elt) { - absl::MutexLock lock{&mu_}; + absl::MutexLock lock{mu_}; ++stats_.num_total_elts; @@ -289,7 +289,7 @@ } Stats GetStats() { - absl::MutexLock lock{&mu_}; + absl::MutexLock lock{mu_}; std::stringstream ss; ss << seen_features_; stats_.coverage_str = std::move(ss).str();
diff --git a/centipede/minimize_crash.cc b/centipede/minimize_crash.cc index 66d417a..d9fa681 100644 --- a/centipede/minimize_crash.cc +++ b/centipede/minimize_crash.cc
@@ -53,7 +53,7 @@ // Returns up to `max_num_crashers` most recently added crashers. std::vector<ByteArray> GetRecentCrashers(size_t max_num_crashers) { - absl::MutexLock lock(&mutex_); + absl::MutexLock lock(mutex_); size_t num_crashers_to_return = std::min(crashers_.size(), max_num_crashers); return {crashers_.end() - num_crashers_to_return, crashers_.end()}; @@ -62,7 +62,7 @@ // Adds `crasher` to the queue, writes it to `crash_dir_path_/Hash(crasher)`. // The crasher must be smaller than the original one. void AddCrasher(ByteArray crasher) { - absl::MutexLock lock(&mutex_); + absl::MutexLock lock(mutex_); FUZZTEST_CHECK_LT(crasher.size(), crashers_.front().size()); crashers_.emplace_back(crasher); // Write the crasher to disk. @@ -74,7 +74,7 @@ // Returns true if new smaller crashes were found. bool SmallerCrashesFound() const { - absl::MutexLock lock(&mutex_); + absl::MutexLock lock(mutex_); return crashers_.size() > 1; }
diff --git a/centipede/periodic_action.cc b/centipede/periodic_action.cc index 9835496..d1f42fe 100644 --- a/centipede/periodic_action.cc +++ b/centipede/periodic_action.cc
@@ -45,12 +45,12 @@ } void StopAsync() { - absl::MutexLock lock{&mu_}; + absl::MutexLock lock{mu_}; stop_ = true; } void Nudge() { - absl::MutexLock lock{&mu_}; + absl::MutexLock lock{mu_}; nudge_ = true; } @@ -62,7 +62,7 @@ const bool schedule = !nudge_ && !stop_; const bool nudge = nudge_; const bool stop = stop_; - mu_.Unlock(); + mu_.unlock(); // NOTE: The caller might call `Stop()` immediately after one final // `Nudge()`: in that case we still should run the action, and only then // terminate the loop. This is in contrast to waking after sleeping the @@ -80,12 +80,12 @@ void SleepOrWakeEarly(absl::Duration duration) ABSL_EXCLUSIVE_LOCK_FUNCTION(mu_) { - mu_.Lock(); + mu_.lock(); // NOTE: Reset only `nudge_`, but not `stop_`: nudging is transient and // can be activated repeatedly, the latter is persistent and can be // activated only once (repeated calls to `Stop()` are no-ops). nudge_ = false; - mu_.Unlock(); + mu_.unlock(); const auto wake_early = [this]() { mu_.AssertReaderHeld(); return nudge_ || stop_;
diff --git a/centipede/periodic_action_test.cc b/centipede/periodic_action_test.cc index d858e0d..70bb51c 100644 --- a/centipede/periodic_action_test.cc +++ b/centipede/periodic_action_test.cc
@@ -144,20 +144,20 @@ absl::Mutex count_mu; PeriodicAction action{ [&count, &count_mu]() { - absl::MutexLock lock{&count_mu}; + absl::MutexLock lock{count_mu}; ++count; }, PeriodicAction::ZeroDelayConstInterval(absl::InfiniteDuration()), }; absl::SleepFor(absl::Seconds(1)); { - absl::MutexLock lock{&count_mu}; + absl::MutexLock lock{count_mu}; EXPECT_EQ(count, 1); } action.Nudge(); action.Stop(); { - absl::MutexLock lock{&count_mu}; + absl::MutexLock lock{count_mu}; EXPECT_EQ(count, 2); } } @@ -170,21 +170,21 @@ { PeriodicAction action{ [&count, &count_mu]() { - absl::MutexLock lock{&count_mu}; + absl::MutexLock lock{count_mu}; ++count; }, PeriodicAction::ZeroDelayConstInterval(absl::InfiniteDuration()), }; absl::SleepFor(absl::Seconds(1)); { - absl::MutexLock lock{&count_mu}; + absl::MutexLock lock{count_mu}; EXPECT_EQ(count, 1); } EXPECT_EQ(count, 1); action.Nudge(); } { - absl::MutexLock lock{&count_mu}; + absl::MutexLock lock{count_mu}; EXPECT_EQ(count, 2); } } @@ -198,7 +198,7 @@ { PeriodicAction moved_from{ [&mu, &thread_ids]() { - absl::WriterMutexLock lock{&mu}; + absl::WriterMutexLock lock{mu}; thread_ids.push_back(std::this_thread::get_id()); }, PeriodicAction::ZeroDelayConstInterval(absl::Milliseconds(10)),
diff --git a/centipede/resource_pool.cc b/centipede/resource_pool.cc index a499a8f..a864fbf 100644 --- a/centipede/resource_pool.cc +++ b/centipede/resource_pool.cc
@@ -94,7 +94,7 @@ typename ResourcePool<ResourceT>::LeaseToken ResourcePool<ResourceT>::AcquireLeaseBlocking(LeaseRequest&& request) { if (FUZZTEST_VLOG_IS_ON(1)) { - absl::ReaderMutexLock lock{&pool_mu_}; + absl::ReaderMutexLock lock{pool_mu_}; FUZZTEST_VLOG(1) << "Received lease request " << request.id // << "\nrequested: " << request.amount.FormattedStr() // << "\nquota: " << quota_.FormattedStr() // @@ -144,7 +144,7 @@ << "\nleased : " << (-request.amount).FormattedStr() // << "\nafter : " << (pool_ - request.amount).FormattedStr(); pool_ = pool_ - request.amount; - pool_mu_.Unlock(); + pool_mu_.unlock(); return LeaseToken{*this, std::move(request)}; } else { absl::Status error = // @@ -152,14 +152,14 @@ "Lease request ", request.id, " timed out; timeout: ", request.timeout, " requested: [", request.amount.ShortStr(), "] current pool: [", pool_.ShortStr(), "]")); - pool_mu_.Unlock(); + pool_mu_.unlock(); return LeaseToken{*this, std::move(request), std::move(error)}; } } template <typename ResourceT> void ResourcePool<ResourceT>::ReturnLease(const LeaseToken& lease) { - absl::WriterMutexLock lock{&pool_mu_}; + absl::WriterMutexLock lock{pool_mu_}; FUZZTEST_VLOG(1) // << "Returning lease " << lease.request().id // << "\nreq age : " << lease.request().age() //
diff --git a/centipede/rusage_profiler.cc b/centipede/rusage_profiler.cc index a8b2ec4..5e41de5 100644 --- a/centipede/rusage_profiler.cc +++ b/centipede/rusage_profiler.cc
@@ -372,7 +372,7 @@ return kEmpty; } - absl::WriterMutexLock lock{&mutex_}; + absl::WriterMutexLock lock{mutex_}; RUsageTiming snap_timing = RUsageTiming::Zero(); RUsageTiming delta_timing = RUsageTiming::Zero(); @@ -420,7 +420,7 @@ absl::Duration interval, // bool also_log, // std::string title) { - absl::WriterMutexLock lock{&mutex_}; + absl::WriterMutexLock lock{mutex_}; FUZZTEST_CHECK(!timelapse_recorder_) << "StopTimelapse() wasn't called"; timelapse_recorder_ = std::make_unique<PeriodicAction>( [this, loc = std::move(loc), title = std::move(title), also_log]() { @@ -431,7 +431,7 @@ } void RUsageProfiler::StopTimelapse() { - absl::WriterMutexLock lock{&mutex_}; + absl::WriterMutexLock lock{mutex_}; FUZZTEST_CHECK(timelapse_recorder_) << "StartTimelapse() wasn't called"; timelapse_recorder_.reset(); } @@ -483,10 +483,10 @@ void RUsageProfiler::GenerateReport( ReportSink* absl_nonnull report_sink) const { - absl::ReaderMutexLock lock{&mutex_}; + absl::ReaderMutexLock lock{mutex_}; // Prevent interleaved reports from multiple concurrent RUsageProfilers. ABSL_CONST_INIT static absl::Mutex report_generation_mutex_{absl::kConstInit}; - absl::WriterMutexLock logging_lock{&report_generation_mutex_}; + absl::WriterMutexLock logging_lock{report_generation_mutex_}; ProfileReportGenerator gen{snapshots_, report_sink};
diff --git a/centipede/rusage_stats_test.cc b/centipede/rusage_stats_test.cc index 69d1a76..7f5e058 100644 --- a/centipede/rusage_stats_test.cc +++ b/centipede/rusage_stats_test.cc
@@ -91,7 +91,7 @@ } // Let one of the hogs notify the caller that the hogging is over. { - absl::MutexLock lock{&mu_}; + absl::MutexLock lock{mu_}; if (!hogging_stopped->HasBeenNotified()) { hogging_stopped->Notify(); }
diff --git a/centipede/util.cc b/centipede/util.cc index c483f52..376d7b4 100644 --- a/centipede/util.cc +++ b/centipede/util.cc
@@ -176,7 +176,7 @@ // Atexit handler added by CreateLocalDirRemovedAtExit(). // Deletes all dirs in dirs_to_delete_at_exit. static void RemoveDirsAtExit() { - absl::MutexLock lock(&dirs_to_delete_at_exit_mutex); + absl::MutexLock lock(dirs_to_delete_at_exit_mutex); for (auto &dir : *dirs_to_delete_at_exit) { std::error_code error; std::filesystem::remove_all(dir, error); @@ -195,7 +195,7 @@ << "Unable to clean up existing dir " << path << ": " << error.message(); std::filesystem::create_directories(path); // Add to dirs_to_delete_at_exit. - absl::MutexLock lock(&dirs_to_delete_at_exit_mutex); + absl::MutexLock lock(dirs_to_delete_at_exit_mutex); if (!dirs_to_delete_at_exit) { dirs_to_delete_at_exit = new std::vector<std::string>(); atexit(&RemoveDirsAtExit);