Allow reading from PTY into bad buffer to return EAGAIN.

Kernels after 3b830a9c return EAGAIN in this case.

PiperOrigin-RevId: 361936327
This commit is contained in:
Nicolas Lacasse 2021-03-09 17:36:02 -08:00 committed by gVisor bot
parent abbdcebc54
commit 6ef5bdab21
1 changed files with 5 additions and 2 deletions

View File

@ -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;
}