Skip to content

Commit

Permalink
Deflake process_vm_read_write test.
Browse files Browse the repository at this point in the history
Passing an uninitialized iovec can cause process_vm_readv/writev to fail for
reasons other than the intended one.

PiperOrigin-RevId: 708414541
  • Loading branch information
nixprime authored and gvisor-bot committed Dec 20, 2024
1 parent 0fb4cc7 commit 0f8db9f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions test/syscalls/linux/process_vm_read_write.cc
Original file line number Diff line number Diff line change
Expand Up @@ -350,11 +350,15 @@ TEST(ProcessVMInvalidTest, NULLRemoteIovec) {
}

TEST(ProcessVMInvalidTest, ProcessNoExist) {
std::string contents = "3263827";
struct iovec iov;
iov.iov_base = contents.data();
iov.iov_len = contents.size();

EXPECT_THAT(process_vm_readv(-1, &iov, 1, &iov, 1, 0),
SyscallFailsWithErrno(::testing::AnyOf(ESRCH, EFAULT)));
SyscallFailsWithErrno(ESRCH));
EXPECT_THAT(process_vm_writev(-1, &iov, 1, &iov, 1, 0),
SyscallFailsWithErrno(::testing::AnyOf(ESRCH, EFAULT)));
SyscallFailsWithErrno(ESRCH));
}

TEST(ProcessVMInvalidTest, GreaterThanIOV_MAX) {
Expand Down

0 comments on commit 0f8db9f

Please sign in to comment.