summaryrefslogtreecommitdiffhomepage
path: root/test/syscalls
diff options
context:
space:
mode:
authorNicolas Lacasse <nlacasse@google.com>2021-03-09 17:36:02 -0800
committergVisor bot <gvisor-bot@google.com>2021-03-09 17:37:54 -0800
commit6ef5bdab21e1e700a362a38435b57c9a1010aaf4 (patch)
tree7f47110f480aea944d28e558bf913f52dfcdba1d /test/syscalls
parentabbdcebc543242862fad0984db2db0a842021917 (diff)
Allow reading from PTY into bad buffer to return EAGAIN.
Kernels after 3b830a9c return EAGAIN in this case. PiperOrigin-RevId: 361936327
Diffstat (limited to 'test/syscalls')
-rw-r--r--test/syscalls/linux/pty.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/test/syscalls/linux/pty.cc b/test/syscalls/linux/pty.cc
index 294b9f6fd..8d15c491e 100644
--- a/test/syscalls/linux/pty.cc
+++ b/test/syscalls/linux/pty.cc
@@ -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;
}