Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions L/LibCURL/LibCURL@8/build_tarballs.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
include("../common.jl")

build_libcurl(ARGS, "LibCURL", v"8.16.0"; with_zstd=true)
build_libcurl(ARGS, "LibCURL", v"8.11.1"; with_zstd=true)

# Build trigger: 2
# Build trigger: 3
9 changes: 9 additions & 0 deletions L/LibCURL/common.jl
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,12 @@ function build_libcurl(ARGS, name::String, version::VersionNumber; with_zstd=fal
# Disable nss only for CURL < 8.16
without_nss = version < v"8.16.0"

# Apply eventfd patch only for v8+ (USE_EVENTFD doesn't exist in v7)
apply_eventfd_patch = version >= v"8"

config = "THIS_IS_CURL=$(this_is_curl_jll)\n"
config *= "MACOS_USE_OPENSSL=$(macos_use_openssl)\n"
config *= "APPLY_EVENTFD_PATCH=$(apply_eventfd_patch)\n"
if with_zstd
config *= "HAVE_ZSTD=true\n"
end
Expand All @@ -80,6 +84,11 @@ function build_libcurl(ARGS, name::String, version::VersionNumber; with_zstd=fal
# Address <https://github.com/curl/curl/issues/12849>
atomic_patch -p1 $WORKSPACE/srcdir/memdup.patch

# Address <https://github.com/curl/curl/issues/15725> (only for v8+)
if [[ "${APPLY_EVENTFD_PATCH}" == "true" ]]; then
atomic_patch -p1 $WORKSPACE/srcdir/eventfd-double-close.patch
fi

# Holy crow we really configure the bitlets out of this thing
FLAGS=(
# Disable....almost everything
Expand Down
35 changes: 35 additions & 0 deletions L/LibCURL/patches/eventfd-double-close.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
From ff5091aa9f73802e894b1cbdf24ab84e103200e2 Mon Sep 17 00:00:00 2001
From: Andy Pan <[email protected]>
Date: Thu, 12 Dec 2024 12:48:56 +0000
Subject: [PATCH] async-thread: avoid closing eventfd twice

When employing eventfd for socketpair, there is only one file
descriptor. Closing that fd twice might result in fd corruption.
Thus, we should avoid closing the eventfd twice, following the
pattern in lib/multi.c.

Fixes #15725
Closes #15727
Reported-by: Christian Heusel
---
lib/asyn-thread.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/lib/asyn-thread.c b/lib/asyn-thread.c
index a58e4b790494..32d496b107cb 100644
--- a/lib/asyn-thread.c
+++ b/lib/asyn-thread.c
@@ -195,9 +195,11 @@ void destroy_thread_sync_data(struct thread_sync_data *tsd)
* close one end of the socket pair (may be done in resolver thread);
* the other end (for reading) is always closed in the parent thread.
*/
+#ifndef USE_EVENTFD
if(tsd->sock_pair[1] != CURL_SOCKET_BAD) {
wakeup_close(tsd->sock_pair[1]);
}
+#endif
#endif

memset(tsd, 0, sizeof(*tsd));
--
2.47.1