Skip to content

Commit

Permalink
Allow reading from PTY into bad buffer to return EAGAIN.
Browse files Browse the repository at this point in the history
Kernels after 3b830a9c return EAGAIN in this case.

PiperOrigin-RevId: 361936327
  • Loading branch information
nlacasse authored and gvisor-bot committed Mar 10, 2021
1 parent abbdceb commit 6ef5bda
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions test/syscalls/linux/pty.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1255,8 +1255,11 @@ TEST_F(PtyTest, PartialBadBuffer) {

// Read from the replica into bad_buffer.
ASSERT_NO_ERRNO(WaitUntilReceived(replica_.get(), size));
EXPECT_THAT(ReadFd(replica_.get(), bad_buffer, size),
SyscallFailsWithErrno(EFAULT));
// Before Linux 3b830a9c this returned EFAULT, but after that commit it
// returns EAGAIN.
EXPECT_THAT(
ReadFd(replica_.get(), bad_buffer, size),
AnyOf(SyscallFailsWithErrno(EFAULT), SyscallFailsWithErrno(EAGAIN)));

EXPECT_THAT(munmap(addr, 2 * kPageSize), SyscallSucceeds()) << addr;
}
Expand Down

0 comments on commit 6ef5bda

Please sign in to comment.