File tree Expand file tree Collapse file tree 2 files changed +40
-1
lines changed Expand file tree Collapse file tree 2 files changed +40
-1
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,10 @@ $(SRCCACHE)/curl-$(CURL_VER)/source-extracted: $(SRCCACHE)/curl-$(CURL_VER).tar.
3434 cd $(dir $< ) && $(TAR ) jxf $(notdir $< )
3535 echo 1 > $@
3636
37+ $(SRCCACHE ) /curl-$(CURL_VER ) /curl-eventfd-double-close.patch-applied : $(SRCCACHE ) /curl-$(CURL_VER ) /source-extracted
38+ cd $(SRCCACHE ) /curl-$(CURL_VER ) && patch -p1 -f -u -l < $(SRCDIR ) /patches/curl-eventfd-double-close.patch
39+ echo 1 > $@
40+
3741checksum-curl : $(SRCCACHE ) /curl-$(CURL_VER ) .tar.bz2
3842 $(JLCHECKSUM ) $<
3943
@@ -65,7 +69,7 @@ CURL_TLS_CONFIGURE_FLAGS := --with-openssl
6569endif
6670CURL_CONFIGURE_FLAGS += $(CURL_TLS_CONFIGURE_FLAGS )
6771
68- $(BUILDDIR ) /curl-$(CURL_VER ) /build-configured : $(SRCCACHE ) /curl-$(CURL_VER ) /source-extracted
72+ $(BUILDDIR ) /curl-$(CURL_VER ) /build-configured : $(SRCCACHE ) /curl-$(CURL_VER ) /source-extracted $( SRCCACHE ) /curl- $( CURL_VER ) /curl-eventfd-double-close.patch-applied
6973 mkdir -p $(dir $@ )
7074 cd $(dir $@ ) && \
7175 $(dir $< ) /configure $(CURL_CONFIGURE_FLAGS ) \
Original file line number Diff line number Diff line change 1+ From ff5091aa9f73802e894b1cbdf24ab84e103200e2 Mon Sep 17 00:00:00 2001
2+ From: Andy Pan <
[email protected] >
3+ Date: Thu, 12 Dec 2024 12:48:56 +0000
4+ Subject: [PATCH] async-thread: avoid closing eventfd twice
5+
6+ When employing eventfd for socketpair, there is only one file
7+ descriptor. Closing that fd twice might result in fd corruption.
8+ Thus, we should avoid closing the eventfd twice, following the
9+ pattern in lib/multi.c.
10+
11+ Fixes #15725
12+ Closes #15727
13+ Reported-by: Christian Heusel
14+ ---
15+ lib/asyn-thread.c | 2 ++
16+ 1 file changed, 2 insertions(+)
17+
18+ diff --git a/lib/asyn-thread.c b/lib/asyn-thread.c
19+ index a58e4b790494..32d496b107cb 100644
20+ --- a/lib/asyn-thread.c
21+ +++ b/lib/asyn-thread.c
22+ @@ -195,9 +195,11 @@ void destroy_thread_sync_data(struct thread_sync_data *tsd)
23+ * close one end of the socket pair (may be done in resolver thread);
24+ * the other end (for reading) is always closed in the parent thread.
25+ */
26+ + #ifndef USE_EVENTFD
27+ if(tsd->sock_pair[1] != CURL_SOCKET_BAD) {
28+ wakeup_close(tsd->sock_pair[1]);
29+ }
30+ + #endif
31+ #endif
32+
33+ memset(tsd, 0, sizeof(*tsd));
34+ - -
35+ 2.47.1
You can’t perform that action at this time.
0 commit comments