lavapipe: replace dup() with os_dupfd_cloexec()

dup() will leak the new FD into any child process after fork().

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26203>
This commit is contained in:
Simon Ser
2023-11-15 10:52:53 +01:00
committed by Marge Bot
parent 0be6b65f41
commit d951ca056a
+2 -1
View File
@@ -37,6 +37,7 @@
#include "frontend/drisw_api.h"
#include "util/u_inlines.h"
#include "util/os_file.h"
#include "util/os_memory.h"
#include "util/os_time.h"
#include "util/u_thread.h"
@@ -2400,7 +2401,7 @@ lvp_GetMemoryFdKHR(VkDevice _device, const VkMemoryGetFdInfoKHR *pGetFdInfo, int
assert(pGetFdInfo->sType == VK_STRUCTURE_TYPE_MEMORY_GET_FD_INFO_KHR);
assert_memhandle_type(pGetFdInfo->handleType);
*pFD = dup(memory->backed_fd);
*pFD = os_dupfd_cloexec(memory->backed_fd);
assert(*pFD >= 0);
return VK_SUCCESS;
}