From 8c3d8b59407901090aa2263dc52e9936ba81cafe Mon Sep 17 00:00:00 2001 From: Nayana Bidari Date: Fri, 6 Dec 2024 13:10:16 -0800 Subject: [PATCH] Enable netstack save/restore in cloud/gvisor by default. PiperOrigin-RevId: 703593364 --- test/syscalls/linux/partial_bad_buffer.cc | 3 -- test/syscalls/linux/tcp_socket.cc | 41 ++++++++++------------- 2 files changed, 18 insertions(+), 26 deletions(-) diff --git a/test/syscalls/linux/partial_bad_buffer.cc b/test/syscalls/linux/partial_bad_buffer.cc index 1bdfcbbe32..8a74afa2ec 100644 --- a/test/syscalls/linux/partial_bad_buffer.cc +++ b/test/syscalls/linux/partial_bad_buffer.cc @@ -321,9 +321,6 @@ PosixErrorOr InetLoopbackAddr(int family) { // pages one valid and one guard page succeeds as long as the write is // for exactly the size of 1 page. TEST_F(PartialBadBufferTest, SendMsgTCP) { - // FIXME(b/171436815): Netstack save/restore is broken. - const DisableSave ds; - auto listen_socket = ASSERT_NO_ERRNO_AND_VALUE(Socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)); diff --git a/test/syscalls/linux/tcp_socket.cc b/test/syscalls/linux/tcp_socket.cc index c8a23b0b78..0590aaa708 100644 --- a/test/syscalls/linux/tcp_socket.cc +++ b/test/syscalls/linux/tcp_socket.cc @@ -14,6 +14,8 @@ #include +#include + #ifdef __linux__ #include #include @@ -1317,23 +1319,22 @@ TEST_P(SimpleTcpSocketTest, ListenConnectParallel) { std::vector> threads; threads.reserve(num_threads); for (int i = 0; i < num_threads; i++) { - threads.push_back( - std::make_unique([&addr, &addrlen, family]() { - const FileDescriptor c = ASSERT_NO_ERRNO_AND_VALUE( - Socket(family, SOCK_STREAM | SOCK_NONBLOCK, IPPROTO_TCP)); - - // Now connect to the bound address and this should fail as nothing - // is listening on the bound address. - EXPECT_THAT(RetryEINTR(connect)(c.get(), AsSockAddr(&addr), addrlen), - SyscallFailsWithErrno(EINPROGRESS)); - // Wait for the connect to fail or succeed as it can race with the - // socket listening. - struct pollfd poll_fd = {c.get(), POLLERR | POLLOUT, 0}; - const int timeout = - GvisorPlatform() == Platform::kFuchsia ? -1 : 1000; - EXPECT_THAT(RetryEINTR(poll)(&poll_fd, 1, timeout), - SyscallSucceedsWithValue(1)); - })); + threads.push_back(std::make_unique([&addr, &addrlen, + family]() { + const FileDescriptor c = ASSERT_NO_ERRNO_AND_VALUE( + Socket(family, SOCK_STREAM | SOCK_NONBLOCK, IPPROTO_TCP)); + + // Now connect to the bound address and this should fail as nothing + // is listening on the bound address. + EXPECT_THAT(RetryEINTR(connect)(c.get(), AsSockAddr(&addr), addrlen), + SyscallFailsWithErrno(EINPROGRESS)); + // Wait for the connect to fail or succeed as it can race with the + // socket listening. + struct pollfd poll_fd = {c.get(), POLLERR | POLLOUT, 0}; + const int timeout = GvisorPlatform() == Platform::kFuchsia ? -1 : 1000; + EXPECT_THAT(RetryEINTR(poll)(&poll_fd, 1, timeout), + SyscallSucceedsWithValue(1)); + })); } } @@ -2458,24 +2459,18 @@ void ShutdownConnectingSocket(int domain, int shutdown_mode) { } TEST_P(SimpleTcpSocketTest, ShutdownReadConnectingSocket) { - // TODO(b/171436815): Re-enable when S/R is fixed. - const DisableSave disable_save; // TODO(b/175409607): Fix this test for hostinet. SKIP_IF(IsRunningWithHostinet()); ShutdownConnectingSocket(GetParam(), SHUT_RD); } TEST_P(SimpleTcpSocketTest, ShutdownWriteConnectingSocket) { - // TODO(b/171436815): Re-enable when S/R is fixed. - const DisableSave disable_save; // TODO(b/175409607): Fix this test for hostinet. SKIP_IF(IsRunningWithHostinet()); ShutdownConnectingSocket(GetParam(), SHUT_WR); } TEST_P(SimpleTcpSocketTest, ShutdownReadWriteConnectingSocket) { - // TODO(b/171436815): Re-enable when S/R is fixed. - const DisableSave disable_save; // TODO(b/175409607): Fix this test for hostinet. SKIP_IF(IsRunningWithHostinet()); ShutdownConnectingSocket(GetParam(), SHUT_RDWR);