From 65de33a77676eb60075fd2a439b8a76e21a136d7 Mon Sep 17 00:00:00 2001 From: gVisor bot Date: Thu, 18 Sep 2025 16:15:47 -0700 Subject: [PATCH] Internal change. PiperOrigin-RevId: 808779990 --- test/syscalls/linux/epoll.cc | 4 ++-- test/syscalls/linux/exec.cc | 6 +++--- test/syscalls/linux/inotify.cc | 18 +++++++++--------- test/syscalls/linux/keys.cc | 12 ++++++------ test/syscalls/linux/kill.cc | 6 +++--- test/syscalls/linux/pause.cc | 8 ++++---- test/syscalls/linux/proc.cc | 6 +++--- test/syscalls/linux/semaphore.cc | 8 ++++---- test/syscalls/linux/signalfd.cc | 10 +++++----- test/syscalls/linux/unshare.cc | 8 ++++---- test/syscalls/linux/wait.cc | 8 ++++---- 11 files changed, 47 insertions(+), 47 deletions(-) diff --git a/test/syscalls/linux/epoll.cc b/test/syscalls/linux/epoll.cc index 9a4c0ed290..5d2a591287 100644 --- a/test/syscalls/linux/epoll.cc +++ b/test/syscalls/linux/epoll.cc @@ -411,7 +411,7 @@ TEST(EpollTest, DoubleEpollOneShot) { // Make request. { - absl::MutexLock lock(&m); + absl::MutexLock lock(m); ASSERT_EQ(WriteFd(sockets[1], msg1, sizeof(msg1)), sizeof(msg1)); } @@ -425,7 +425,7 @@ TEST(EpollTest, DoubleEpollOneShot) { // Read response. { - absl::MutexLock lock(&m); + absl::MutexLock lock(m); ASSERT_THAT(ReadFd(sockets[1], &tmp, sizeof(tmp)), SyscallSucceedsWithValue(sizeof(tmp))); } diff --git a/test/syscalls/linux/exec.cc b/test/syscalls/linux/exec.cc index f12c8e6761..701a9e6c19 100644 --- a/test/syscalls/linux/exec.cc +++ b/test/syscalls/linux/exec.cc @@ -1231,9 +1231,9 @@ void ExecWithThread() { bool started = false; ScopedThread t([&] { - mu.Lock(); + mu.lock(); started = true; - mu.Unlock(); + mu.unlock(); while (true) { pause(); @@ -1241,7 +1241,7 @@ void ExecWithThread() { }); mu.LockWhen(absl::Condition(&started)); - mu.Unlock(); + mu.unlock(); const ExecveArray argv = {"/proc/self/exe", kExit42}; const ExecveArray envv; diff --git a/test/syscalls/linux/inotify.cc b/test/syscalls/linux/inotify.cc index b0bc0e8672..3b3f894345 100644 --- a/test/syscalls/linux/inotify.cc +++ b/test/syscalls/linux/inotify.cc @@ -2322,7 +2322,7 @@ TEST(InotifyTest, InotifyAndTargetDestructionDoNotDeadlock) { for (auto& afd : fds) { int new_fd; ASSERT_THAT(new_fd = inotify_init1(IN_NONBLOCK), SyscallSucceeds()); - absl::MutexLock l(&afd.mu); + absl::MutexLock l(afd.mu); ASSERT_THAT(close(afd.fd), SyscallSucceeds()); afd.fd = new_fd; for (auto& p : paths) { @@ -2429,7 +2429,7 @@ TEST(InotifyTest, NotifyNoDeadlock) { InotifyAddWatch(ifd.get(), dir, IN_ALL_EVENTS)); int file_wd; { - absl::ReaderMutexLock l(&mu); + absl::ReaderMutexLock l(mu); file_wd = ASSERT_NO_ERRNO_AND_VALUE( InotifyAddWatch(ifd.get(), file, IN_ALL_EVENTS)); } @@ -2439,7 +2439,7 @@ TEST(InotifyTest, NotifyNoDeadlock) { dir_wd = ASSERT_NO_ERRNO_AND_VALUE( InotifyAddWatch(ifd.get(), dir, IN_ALL_EVENTS)); { - absl::ReaderMutexLock l(&mu); + absl::ReaderMutexLock l(mu); file_wd = ASSERT_NO_ERRNO_AND_VALUE( InotifyAddWatch(ifd.get(), file, IN_ALL_EVENTS)); } @@ -2451,7 +2451,7 @@ TEST(InotifyTest, NotifyNoDeadlock) { ScopedThread stats([&] { int fd, dir_fd; { - absl::ReaderMutexLock l(&mu); + absl::ReaderMutexLock l(mu); ASSERT_THAT(fd = open(file.c_str(), O_RDONLY), SyscallSucceeds()); } ASSERT_THAT(dir_fd = open(dir.c_str(), O_RDONLY | O_DIRECTORY), @@ -2460,7 +2460,7 @@ TEST(InotifyTest, NotifyNoDeadlock) { for (auto start = absl::Now(); absl::Now() - start < runtime;) { { - absl::ReaderMutexLock l(&mu); + absl::ReaderMutexLock l(mu); EXPECT_THAT(utimes(file.c_str(), times), SyscallSucceeds()); } EXPECT_THAT(futimes(fd, times), SyscallSucceeds()); @@ -2476,7 +2476,7 @@ TEST(InotifyTest, NotifyNoDeadlock) { if (!IsRunningOnGvisor()) { int fd; { - absl::ReaderMutexLock l(&mu); + absl::ReaderMutexLock l(mu); ASSERT_THAT(fd = open(file.c_str(), O_RDONLY), SyscallSucceeds()); } @@ -2484,7 +2484,7 @@ TEST(InotifyTest, NotifyNoDeadlock) { int val = 123; for (auto start = absl::Now(); absl::Now() - start < runtime;) { { - absl::ReaderMutexLock l(&mu); + absl::ReaderMutexLock l(mu); ASSERT_THAT( setxattr(file.c_str(), name, &val, sizeof(val), /*flags=*/0), SyscallSucceeds()); @@ -2503,7 +2503,7 @@ TEST(InotifyTest, NotifyNoDeadlock) { ScopedThread read_write([&] { int fd; { - absl::ReaderMutexLock l(&mu); + absl::ReaderMutexLock l(mu); ASSERT_THAT(fd = open(file.c_str(), O_RDWR), SyscallSucceeds()); } for (auto start = absl::Now(); absl::Now() - start < runtime;) { @@ -2522,7 +2522,7 @@ TEST(InotifyTest, NotifyNoDeadlock) { for (auto start = absl::Now(); absl::Now() - start < runtime;) { const std::string new_path = NewTempAbsPathInDir(dir); { - absl::WriterMutexLock l(&mu); + absl::WriterMutexLock l(mu); ASSERT_THAT(rename(file.c_str(), new_path.c_str()), SyscallSucceeds()); file = new_path; } diff --git a/test/syscalls/linux/keys.cc b/test/syscalls/linux/keys.cc index 2579ae8f05..5f9b360f67 100644 --- a/test/syscalls/linux/keys.cc +++ b/test/syscalls/linux/keys.cc @@ -332,7 +332,7 @@ TEST(KeysTest, ChildThreadInheritsSessionKeyringCreatedAfterChildIsBorn) { bool child_ready = false; bool parent_keyring_created = false; ScopedThread child([&] { - absl::MutexLock child_ml(&mu); + absl::MutexLock child_ml(mu); child_ready = true; std::cerr << "Child is spawned and waiting for parent." << std::endl; mu.Await(absl::Condition(&parent_keyring_created)); @@ -342,7 +342,7 @@ TEST(KeysTest, ChildThreadInheritsSessionKeyringCreatedAfterChildIsBorn) { << std::endl; }); [&] { - absl::MutexLock parent_ml(&mu); + absl::MutexLock parent_ml(mu); mu.Await(absl::Condition(&child_ready)); int64_t session_keyring_id = ASSERT_NO_ERRNO_AND_VALUE(keyctl(KEYCTL_JOIN_SESSION_KEYRING)); @@ -419,7 +419,7 @@ TEST(KeysTest, ExistingNamedSessionKeyringIsNew) { absl::Mutex mu; bool first_child_created_keyring = false; ScopedThread first_child([&] { - absl::MutexLock ml(&mu); + absl::MutexLock ml(mu); ASSERT_NO_ERRNO( keyctl(KEYCTL_JOIN_SESSION_KEYRING, (uint64_t)(kKeyringName.data()))); first_child_key = @@ -429,7 +429,7 @@ TEST(KeysTest, ExistingNamedSessionKeyringIsNew) { first_child_created_keyring = true; }); ScopedThread([&] { - absl::MutexLock ml(&mu); + absl::MutexLock ml(mu); second_child_initial_key = ASSERT_NO_ERRNO_AND_VALUE(DescribeKey(KEY_SPEC_SESSION_KEYRING)); std::cerr << "Session child's initial session keyring: " @@ -713,7 +713,7 @@ TEST(KeysTest, SearchableKeyringIsSharedAcrossThreads) { // flipped. ScopedThread first_child([&] { - absl::MutexLock ml(&mu); + absl::MutexLock ml(mu); first_child_ready = true; mu.Await(absl::Condition(&second_child_ready)); ASSERT_NO_ERRNO( @@ -746,7 +746,7 @@ TEST(KeysTest, SearchableKeyringIsSharedAcrossThreads) { first_child_modified_keyring = true; }); ScopedThread second_child([&] { - absl::MutexLock ml(&mu); + absl::MutexLock ml(mu); second_child_ready = true; mu.Await(absl::Condition(&first_child_ready)); mu.Await(absl::Condition(&first_child_created_keyring)); diff --git a/test/syscalls/linux/kill.cc b/test/syscalls/linux/kill.cc index 5d1735853f..b97e937b28 100644 --- a/test/syscalls/linux/kill.cc +++ b/test/syscalls/linux/kill.cc @@ -165,16 +165,16 @@ TEST(KillTest, CannotKillTid) { bool finished = false; absl::Mutex mu; ScopedThread t([&] { - mu.Lock(); + mu.lock(); tid = gettid(); tid_available = true; mu.Await(absl::Condition(&finished)); - mu.Unlock(); + mu.unlock(); }); mu.LockWhen(absl::Condition(&tid_available)); EXPECT_THAT(kill(tid, 0), SyscallSucceeds()); finished = true; - mu.Unlock(); + mu.unlock(); } TEST(KillTest, SetPgid) { diff --git a/test/syscalls/linux/pause.cc b/test/syscalls/linux/pause.cc index 8c05efd6f1..9ef583069b 100644 --- a/test/syscalls/linux/pause.cc +++ b/test/syscalls/linux/pause.cc @@ -57,16 +57,16 @@ TEST(PauseTest, OnlyReturnsWhenSignalHandled) { std::atomic sent_signal{0}; std::atomic waking_signal{0}; ScopedThread t([&] { - mu.Lock(); + mu.lock(); child_tid = gettid(); child_tid_available = true; - mu.Unlock(); + mu.unlock(); EXPECT_THAT(pause(), SyscallFailsWithErrno(EINTR)); waking_signal.store(sent_signal.load()); }); - mu.Lock(); + mu.lock(); mu.Await(absl::Condition(&child_tid_available)); - mu.Unlock(); + mu.unlock(); // Wait a bit to let the child enter pause(). absl::SleepFor(absl::Seconds(3)); diff --git a/test/syscalls/linux/proc.cc b/test/syscalls/linux/proc.cc index b6d73828ae..2665d7db3c 100644 --- a/test/syscalls/linux/proc.cc +++ b/test/syscalls/linux/proc.cc @@ -2406,14 +2406,14 @@ class BlockingChild { ~BlockingChild() { Join(); } pid_t Tid() const { - absl::MutexLock ml(&mu_); + absl::MutexLock ml(mu_); mu_.Await(absl::Condition(&tid_ready_)); return tid_; } void Join() { { - absl::MutexLock ml(&mu_); + absl::MutexLock ml(mu_); stop_ = true; } thread_.Join(); @@ -2421,7 +2421,7 @@ class BlockingChild { private: void Start() { - absl::MutexLock ml(&mu_); + absl::MutexLock ml(mu_); tid_ = syscall(__NR_gettid); tid_ready_ = true; mu_.Await(absl::Condition(&stop_)); diff --git a/test/syscalls/linux/semaphore.cc b/test/syscalls/linux/semaphore.cc index 0cb28492e0..2ac857c0fa 100644 --- a/test/syscalls/linux/semaphore.cc +++ b/test/syscalls/linux/semaphore.cc @@ -376,7 +376,7 @@ TEST(SemaphoreTest, SemOpRandom) { for (size_t i = 0; i < 500; ++i) { int16_t val; { - absl::MutexLock l(&mutex); + absl::MutexLock l(mutex); if (done) { return; } @@ -397,7 +397,7 @@ TEST(SemaphoreTest, SemOpRandom) { zero = std::make_unique([&sem, &mutex, &done] { for (size_t i = 0; i < 500; ++i) { { - absl::MutexLock l(&mutex); + absl::MutexLock l(mutex); if (done) { return; } @@ -417,7 +417,7 @@ TEST(SemaphoreTest, SemOpRandom) { for (size_t i = 0; i < 500; ++i) { int16_t val; { - absl::MutexLock l(&mutex); + absl::MutexLock l(mutex); val = (rand_r(&seed) % 10 + 1); // Rand between 1 and 10. count += val; } @@ -437,7 +437,7 @@ TEST(SemaphoreTest, SemOpRandom) { // Now there could be waiters blocked (remember operations are random). // Notify waiters that we're done and signal semaphore just the right amount. { - absl::MutexLock l(&mutex); + absl::MutexLock l(mutex); done = true; struct sembuf buf = {}; buf.sem_op = -count; diff --git a/test/syscalls/linux/signalfd.cc b/test/syscalls/linux/signalfd.cc index 0af733ba26..b3df6d4c36 100644 --- a/test/syscalls/linux/signalfd.cc +++ b/test/syscalls/linux/signalfd.cc @@ -123,7 +123,7 @@ TEST_P(SignalfdTest, Blocking) { ScopedThread t([&] { // Copy the tid and notify the caller. { - absl::MutexLock ml(&mu); + absl::MutexLock ml(mu); tid = gettid(); has_tid = true; } @@ -136,7 +136,7 @@ TEST_P(SignalfdTest, Blocking) { }); // Wait until blocked. - absl::MutexLock ml(&mu); + absl::MutexLock ml(mu); mu.Await(absl::Condition(&has_tid)); // Deliver the signal to either the waiting thread, or @@ -176,7 +176,7 @@ TEST_P(SignalfdTest, ThreadGroup) { EXPECT_EQ(rbuf.ssi_signo, signo); // Wait for the other thread. - absl::MutexLock ml(&mu); + absl::MutexLock ml(mu); first = true; mu.Await(absl::Condition(&second)); }); @@ -186,7 +186,7 @@ TEST_P(SignalfdTest, ThreadGroup) { // Wait for the first thread to process. { - absl::MutexLock ml(&mu); + absl::MutexLock ml(mu); mu.Await(absl::Condition(&first)); } @@ -201,7 +201,7 @@ TEST_P(SignalfdTest, ThreadGroup) { // Mark the test as done. { - absl::MutexLock ml(&mu); + absl::MutexLock ml(mu); second = true; } diff --git a/test/syscalls/linux/unshare.cc b/test/syscalls/linux/unshare.cc index e32619efeb..ef5fb1b785 100644 --- a/test/syscalls/linux/unshare.cc +++ b/test/syscalls/linux/unshare.cc @@ -34,14 +34,14 @@ TEST(UnshareTest, ThreadFlagFailsIfMultithreaded) { absl::Mutex mu; bool finished = false; ScopedThread t([&] { - mu.Lock(); + mu.lock(); mu.Await(absl::Condition(&finished)); - mu.Unlock(); + mu.unlock(); }); ASSERT_THAT(unshare(CLONE_THREAD), SyscallFailsWithErrno(EINVAL)); - mu.Lock(); + mu.lock(); finished = true; - mu.Unlock(); + mu.unlock(); } } // namespace diff --git a/test/syscalls/linux/wait.cc b/test/syscalls/linux/wait.cc index 944149d5e6..5e0e88184c 100644 --- a/test/syscalls/linux/wait.cc +++ b/test/syscalls/linux/wait.cc @@ -447,7 +447,7 @@ TEST_P(WaitSpecificChildTest, SiblingChildren) { bool stop = false; ScopedThread t([&] { - absl::MutexLock ml(&mu); + absl::MutexLock ml(mu); EXPECT_THAT(child = ForkAndExit(0, 0), SyscallSucceeds()); ready = true; mu.Await(absl::Condition(&stop)); @@ -455,7 +455,7 @@ TEST_P(WaitSpecificChildTest, SiblingChildren) { // N.B. This must be declared after ScopedThread, so it is destructed first, // thus waking the thread. - absl::MutexLock ml(&mu); + absl::MutexLock ml(mu); mu.Await(absl::Condition(&ready)); EXPECT_NO_ERRNO(WaitFor(child, 0)); @@ -483,7 +483,7 @@ TEST_P(WaitSpecificChildTest, SiblingChildrenWNOTHREAD) { bool stop = false; ScopedThread t([&] { - absl::MutexLock ml(&mu); + absl::MutexLock ml(mu); EXPECT_THAT(child = ForkAndExit(0, 0), SyscallSucceeds()); ready = true; mu.Await(absl::Condition(&stop)); @@ -494,7 +494,7 @@ TEST_P(WaitSpecificChildTest, SiblingChildrenWNOTHREAD) { // N.B. This must be declared after ScopedThread, so it is destructed first, // thus waking the thread. - absl::MutexLock ml(&mu); + absl::MutexLock ml(mu); mu.Await(absl::Condition(&ready)); // This thread can't wait on child.