mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Fix async-signal-unsafety in socket test.
PiperOrigin-RevId: 383689096
This commit is contained in:
@@ -119,6 +119,9 @@ TEST(SocketTest, UnixSCMRightsOnlyPassedOnce) {
|
||||
// Send more than what will fit inside the send/receive buffers, so that it is
|
||||
// split into multiple messages.
|
||||
constexpr int kBufSize = 0x100000;
|
||||
// Heap allocation is async-signal-unsafe and thus cannot occur between fork()
|
||||
// and execve().
|
||||
std::vector<char> buf(kBufSize);
|
||||
|
||||
pid_t pid = fork();
|
||||
if (pid == 0) {
|
||||
@@ -127,7 +130,6 @@ TEST(SocketTest, UnixSCMRightsOnlyPassedOnce) {
|
||||
// Construct a message with some control message.
|
||||
struct msghdr msg = {};
|
||||
char control[CMSG_SPACE(sizeof(int))] = {};
|
||||
std::vector<char> buf(kBufSize);
|
||||
struct iovec iov = {};
|
||||
msg.msg_control = control;
|
||||
msg.msg_controllen = sizeof(control);
|
||||
@@ -154,7 +156,6 @@ TEST(SocketTest, UnixSCMRightsOnlyPassedOnce) {
|
||||
|
||||
struct msghdr msg = {};
|
||||
char control[CMSG_SPACE(sizeof(int))] = {};
|
||||
std::vector<char> buf(kBufSize);
|
||||
struct iovec iov = {};
|
||||
msg.msg_control = &control;
|
||||
msg.msg_controllen = sizeof(control);
|
||||
|
||||
Reference in New Issue
Block a user