From 2338035c3e34de90e19b356c6904db4e9978ff8e Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Tue, 16 Apr 2024 10:13:38 +0200 Subject: executor: ignore EBADF when reading tun Fuzzer managed to do: executing program 0: ... close_range(r5, 0xffffffffffffffff, 0x0) ... SYZFATAL: executor 0 failed 11 times: executor 0: exit status 67 SYZFAIL: tun read failed (errno 9: Bad file descriptor) --- executor/common_linux.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'executor') diff --git a/executor/common_linux.h b/executor/common_linux.h index f53a0e781..93ecef654 100644 --- a/executor/common_linux.h +++ b/executor/common_linux.h @@ -1749,8 +1749,9 @@ static int read_tun(char* data, int size) int rv = read(tunfd, data, size); if (rv < 0) { + // EBADF can be returned if the test closes tunfd with close_range syscall. // Tun sometimes returns EBADFD, unclear if it's a kernel bug or not. - if (errno == EAGAIN || errno == EBADFD) + if (errno == EAGAIN || errno == EBADF || errno == EBADFD) return -1; fail("tun read failed"); } -- cgit mrf-deployment