diff options
Diffstat (limited to 'executor/common_linux.h')
| -rw-r--r-- | executor/common_linux.h | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/executor/common_linux.h b/executor/common_linux.h index 98339194f..6b96d8cea 100644 --- a/executor/common_linux.h +++ b/executor/common_linux.h @@ -2479,8 +2479,11 @@ static long syz_init_net_socket(volatile long domain, volatile long type, volati return -1; int sock = syscall(__NR_socket, domain, type, proto); int err = errno; - if (setns(netns, 0)) - fail("setns(netns) failed"); + if (setns(netns, 0)) { + // The operation may fail if the fd is closed by + // a syscall from another thread. + exitf("setns(netns) failed"); + } close(netns); errno = err; return sock; @@ -2514,8 +2517,11 @@ static long syz_socket_connect_nvme_tcp() return -1; int sock = syscall(__NR_socket, AF_INET, SOCK_STREAM, 0x0); int err = errno; - if (setns(netns, 0)) - fail("setns(netns) failed"); + if (setns(netns, 0)) { + // The operation may fail if the fd is closed by + // a syscall from another thread. + exitf("setns(netns) failed"); + } close(netns); errno = err; // We only connect to an NVMe-oF/TCP server on 127.0.0.1:4420 |
