Skip to content

deleted#2

Closed
vszakats wants to merge 85 commits intomasterfrom
conversion-extra
Closed

deleted#2
vszakats wants to merge 85 commits intomasterfrom
conversion-extra

Conversation

@vszakats
Copy link
Owner

@vszakats vszakats commented Jun 9, 2024

No description provided.

dfandrich and others added 30 commits May 28, 2024 11:49
Also, simplify patterns with a single glob.
These exclusions came from the AppVeyor CI config, but they do pass now
and they are static tests with no flakiness risk.

Follow-up to 0914d8a curl#13759
Closes curl#13817
This removes unnecessary line wraps when the terminal is wider than 79
columns and it also makes messages look better in narrower terminals.

The get_terminal_columns() function is not split out into its own source
file.

Suggested-by: Elliott Balsley
Fixes curl#13804
Closes curl#13808
Like when we list a series of options and then want to add "normal" text
again afterwards.

Without this, the indentation level wrongly continues even after the
final "##" header, making following text wrongly appear to belong to the
header above.

Adjusted several curldown files to use this.

Fixes curl#13803
Reported-by: Jay Satiro
Closes curl#13806
Refactors canon_query, so it could use the encoding part of the function
to use it in the path.

As the path doesn't encode '/', but encode '=', I had to add some
conditions to know If I was doing the query or path encoding.

Also, instead of adding a `bool in_path` variable, I use `bool
*found_equals` to know if the function was called for the query or path,
as found_equals is used only in query_encoding.

Test 472 verifies.

Reported-by: Alexander Shtuchkin
Fixes curl#13754
Closes curl#13814

Signed-off-by: Matthias Gatto <matthias.gatto@outscale.com>
Take advantage of the Curl_cipher_suite_walk_str() and
Curl_cipher_suite_get_str() functions introduced in commit fba9afe.

Closes curl#13521
- Move the code that updates the SO_SNDBUF size for Windows to
  cf_socket_send.

Prior to this change the code was in readwrite_upload but the socket
filter is the more appropriate place because it applies to all sends.

Background:

For Windows users SO_SNDBUF (the total per-socket buffer size reserved
by Winsock for sends) is updated dynamically by libcurl during the
transfer. This is because Windows does not do it automatically for
non-blocking sockets and without it the performance of large transfers
may suffer.

Closes curl#13763
Following up on previous occurrences showing up as gcc warnings, replace
the remaining `time(&var)` calls with `var = time(NULL)`, though these
aren't specifically causing compiler warnings. These are in the TFTP
client code (`lib/tftp.c`), except one which is in a debug branch in
`lib/http_aws_sigv4.c`.

What's unexplainable is that this patch seems to mitigate TFTP tests
often hanging or going into an infinite loop on GHA windows workflows
with MSYS2, mingw-w64 and MSVC (Cygwin is unaffected):
  curl#13599 (comment)
TFTP hangs did not entirely disappear though, so could be unrelated.

`time()` docs:
https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/time-time32-time64
https://manpages.debian.org/bookworm/manpages-dev/time.2.en.html

Follow-up to 58ca0a2 curl#13800
Follow-up to d0728c9 curl#13643
Closes curl#13815
- determine the actual poll timeout *after* all sockets
  have been collected. Protocols and connection filters may
  install new timeouts during collection.
- add debug logging to test1533 where the mistake was noticed

Reported-by: Matt Jolly
Fixes curl#13782
Closes curl#13825
Make it clearer in the documentation.

Closes curl#13821
Adjusts the `make -j` flag to match the latest GitHub-hosted runner
hardware specs[^1]:

 - `ubuntu-latest` on 4 CPU cores
 - `macos-latest` on 3 CPU cores

The processor count is ideally obtained from `nproc`, but setting env
vars from the current CI yaml files is not possible because they expect
literal strings.

[^1]: https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories

Closes curl#12927
It's the same as ubuntu-22.04.

Also update OmniOS package search link.

Closes curl#13831
- Rename: Curl_sndbufset => Curl_sndbuf_init

- Rename: win_update_buffer_size => win_update_sndbuf_size

- Save the last set SO_SNDBUF size to compare against so that we can
  avoid setsockopt calls every second.

This is a follow-up to 0b520e1 which moved the SO_SNDBUF update check
into cf-socket. This change improves it further by making the function
names easier to understand and reducing the amount of setsockopt calls.

Closes curl#13827
The net effect of the deeper checks is to raise implicit function decls
on modern compilers.

These checks appear to have been added ~20 years ago, relating to an
unverifiable claim about HP-UX. Autoconf support for the platform has
grown in leaps and bounds since.

It didn't cause a real problem here, but when investigating a FP this
came up. No evidence has been identified that this was actually broken
in the past, and there is no evidence that this is necessary now.

`-Werror=implicit-function-declarations` is enabled for both checks;
without a working prototype they will both fail regardless. In the
second case there will in fact never be a working prototype and
therefore it will always fail unconditionally.

`AC_CHECK_FUNCS` does effectively the same thing as the removed checks,
except it actually defines a dummy prototype to see if it links.

If `AC_CHECK_FUNCS` is broken on a given platform we have bigger
problems than trying to build cURL. This should also be faster.

Bug: https://bugs.gentoo.org/932827
Reviewed-By: Eli Schwartz <eschwartz93@gmail.com>
Closes curl#13830
Related to curl#13833

Signed-off-by: Christian Heusel <christian@heusel.eu>
Closes curl#13843
This commit unifies the following http3 workflows into http3-linux.yml:

- ngtcp2-linux.yml
- osslq-linux.yml
- quiche-linux.yml

The idea is better use of the build cache. Previously, they
independently create caches with the same key. Some of the caches
include source code and intermediate object files, which makes cache
quite large. In this commit, only built artifacts are cached, which
drastically reduces the cache size. OpenSSL v3, mod_h2 and quiche caches
still include all stuff, but they are left for the later improvement.
Because the contents of the cache have been changed, the cache keys are
also changed to include the word "http3".

Closes curl#13841
Previously a large table of ciphers was used to determine the default
ciphers and to lookup manually selected ciphers names.

With the lookup of the manually selected cipher names moved to
Curl_cipher_suite_walk_str() the large table is no longer needed for
that purpose.

The list of manually selected cipher can now be intersected with the
ciphers supported by Secure Transport (SSLGetSupportedCiphers()),
instead of using the fixed table for that.

The other use of the table was to filter the list of all supported
ciphers offered by Secure Transport to create a list of ciphers to
use by default, excluding ciphers in the table marked as weak.

Instead of using a complement based approach (exclude weak), switch
to using an intersection with a smaller list of ciphers deemed
appropriate.

Closes curl#13823
or they will not parse correctly.

Mentioned in DEPRECATED since Janurary 2023 (in 7ad8a7b).

Closes curl#13789
DragonFly BSD changed the time unit for TCP keep-alive from milliseconds
to seconds since v5.8, thus setting the keepalive options with
milliseconds with curl/libcurl will result in unexpected behaviors on
DragonFlyBSD 5.8+

Distinguish the DragonFly BSD versions and use the proper time units
accordingly.

Ref:
  https://lists.dragonflybsd.org/pipermail/commits/2019-July/719125.html
  https://github.com/DragonFlyBSD/DragonFlyBSD/blob/965b380e960908836b97aa034fa2753091e0172e/sys/sys/param.h#L207

Fixes curl#13847
Closes curl#13848
As a bonus, add SSLSUPP_CA_CACHE to let TLS backends signal its support
for this so that *setopt() return error if there is no support.

Closes curl#13786
Used for extracting:

- when used asking for a scheme, it will return CURLUE_NO_SCHEME if the
  stored information was a guess

- when used asking for a URL, the URL is returned without a scheme, like
  when previously given to the URL parser when it was asked to guess

- as soon as the scheme is set explicitly, it is no longer internally
  marked as guessed

The idea being:

1. allow a user to figure out if a URL's scheme was set as a result of
  guessing

2. extract the URL without a guessed scheme

3. this makes it work similar to how we already deal with port numbers

Extend test 1560 to verify.

Closes curl#13616
Moved Secure Transport behind OpenSSL, so we can build CURL with both
and prefer using OpenSSL over Secure Transport by default.

Closes curl#13547
CrapsDorian and others added 5 commits June 7, 2024 10:54
Multipath TCP (MPTCP), standardized in RFC8684 [1], is a TCP extension
that enables a TCP connection to use different paths.

Multipath TCP has been used for several use cases. On smartphones, MPTCP
enables seamless handovers between cellular and Wi-Fi networks while
preserving established connections. This use-case is what pushed Apple
to use MPTCP since 2013 in multiple applications [2]. On dual-stack
hosts, Multipath TCP enables the TCP connection to automatically use the
best performing path, either IPv4 or IPv6. If one path fails, MPTCP
automatically uses the other path.

To benefit from MPTCP, both the client and the server have to support
it. Multipath TCP is a backward-compatible TCP extension that is enabled
by default on recent Linux distributions (Debian, Ubuntu, Redhat, ...).
Multipath TCP is included in the Linux kernel since version 5.6 [3]. To
use it on Linux, an application must explicitly enable it when creating
the socket. No need to change anything else in the application.

This attached patch adds an --mptcp option which allows the creation of
an MPTCP socket instead of TCP on Linux. If Multipath TCP is not
supported on the system, an error will be reported. It is important to
note that if the end server doesn't support MPTCP, the connection will
continue after a seamless fallback to TCP.

Link: https://www.rfc-editor.org/rfc/rfc8684.html [1]
Link: https://www.tessares.net/apples-mptcp-story-so-far/ [2]
Link: https://www.mptcp.dev [3]
Co-developed-by: Dorian Craps (@CrapsDorian) <doriancraps@gmail.com>
Co-developed-by: Olivier Bonaventure (@obonaventure) <Olivier.Bonaventure@uclouvain.be>
Co-developed-by: Matthieu Baerts (@matttbe) <matttbe@kernel.org>
Signed-off-by: Dorian Craps <dorian.craps@student.vinci.be>

Closes curl#13278
To make them render nicer in the manpage and minor polish.

Closes curl#13906
Provide an explanation in the CURLOPT_CONNECTTIMEOUT_MS page instead of
just referring to the non-MS version.

Closes curl#13905
@vszakats vszakats closed this Jun 9, 2024
@vszakats vszakats deleted the conversion-extra branch June 9, 2024 08:50
@vszakats vszakats restored the conversion-extra branch June 9, 2024 08:50
@vszakats vszakats deleted the conversion-extra branch June 9, 2024 09:02
@vszakats vszakats changed the title Conversion extra deleted Jun 9, 2024
vszakats added a commit that referenced this pull request Feb 21, 2025
vszakats added a commit that referenced this pull request Feb 27, 2025
```
=================================================================
==7427==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 1760 byte(s) in 1 object(s) allocated from:
    #0 0x55e143b2337d in calloc (/home/runner/work/curl/curl/bld/conftest+0xc637d) (BuildId: acf90599d654b070f297755bbc53b38a418f3c0d)
    #1 0x7f7795b3a4fb  (/lib/x86_64-linux-gnu/libc.so.6+0x13a4fb) (BuildId: 42c84c92e6f98126b3e2230ebfdead22c235b667)
    #2 0x7f7795b3b577 in getifaddrs (/lib/x86_64-linux-gnu/libc.so.6+0x13b577) (BuildId: 42c84c92e6f98126b3e2230ebfdead22c235b667)
    #3 0x55e143adc73b in getifaddrs (/home/runner/work/curl/curl/bld/conftest+0x7f73b) (BuildId: acf90599d654b070f297755bbc53b38a418f3c0d)
    #4 0x55e143b6180b in main /home/runner/work/curl/curl/bld/conftest.c:189:17
    #5 0x7f7795a2a1c9  (/lib/x86_64-linux-gnu/libc.so.6+0x2a1c9) (BuildId: 42c84c92e6f98126b3e2230ebfdead22c235b667)
    #6 0x7f7795a2a28a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28a) (BuildId: 42c84c92e6f98126b3e2230ebfdead22c235b667)
    #7 0x55e143a88344 in _start (/home/runner/work/curl/curl/bld/conftest+0x2b344) (BuildId: acf90599d654b070f297755bbc53b38a418f3c0d)

SUMMARY: AddressSanitizer: 1760 byte(s) leaked in 1 allocation(s).
``
https://github.com/curl/curl/actions/runs/13566872950/job/37923962163?pr=16507
vszakats added a commit that referenced this pull request Feb 27, 2025
```
=================================================================
==7294==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x56534822b193 in malloc (/home/runner/work/curl/curl/bld/conftest+0xc7193) (BuildId: 97134224fbe0749a43ecaaf61869e2bcb0f04094)
    #1 0x7fc1fe55b639 in getaddrinfo (/lib/x86_64-linux-gnu/libc.so.6+0x15b639) (BuildId: 42c84c92e6f98126b3e2230ebfdead22c235b667)
    #2 0x5653481c17fd in getaddrinfo (/home/runner/work/curl/curl/bld/conftest+0x5d7fd) (BuildId: 97134224fbe0749a43ecaaf61869e2bcb0f04094)
    #3 0x5653482698f4 in main /home/runner/work/curl/curl/bld/conftest.c:210:17
    #4 0x7fc1fe42a1c9  (/lib/x86_64-linux-gnu/libc.so.6+0x2a1c9) (BuildId: 42c84c92e6f98126b3e2230ebfdead22c235b667)
    #5 0x7fc1fe42a28a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28a) (BuildId: 42c84c92e6f98126b3e2230ebfdead22c235b667)
    #6 0x565348190344 in _start (/home/runner/work/curl/curl/bld/conftest+0x2c344) (BuildId: 97134224fbe0749a43ecaaf61869e2bcb0f04094)

SUMMARY: AddressSanitizer: 64 byte(s) leaked in 1 allocation(s).
```
https://github.com/curl/curl/actions/runs/13566872950/job/37923962163?pr=16507
vszakats added a commit that referenced this pull request Feb 27, 2025
```
=================================================================
==7427==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 1760 byte(s) in 1 object(s) allocated from:
    #0 0x55e143b2337d in calloc (/home/runner/work/curl/curl/bld/conftest+0xc637d) (BuildId: acf90599d654b070f297755bbc53b38a418f3c0d)
    #1 0x7f7795b3a4fb  (/lib/x86_64-linux-gnu/libc.so.6+0x13a4fb) (BuildId: 42c84c92e6f98126b3e2230ebfdead22c235b667)
    #2 0x7f7795b3b577 in getifaddrs (/lib/x86_64-linux-gnu/libc.so.6+0x13b577) (BuildId: 42c84c92e6f98126b3e2230ebfdead22c235b667)
    #3 0x55e143adc73b in getifaddrs (/home/runner/work/curl/curl/bld/conftest+0x7f73b) (BuildId: acf90599d654b070f297755bbc53b38a418f3c0d)
    #4 0x55e143b6180b in main /home/runner/work/curl/curl/bld/conftest.c:189:17
    #5 0x7f7795a2a1c9  (/lib/x86_64-linux-gnu/libc.so.6+0x2a1c9) (BuildId: 42c84c92e6f98126b3e2230ebfdead22c235b667)
    #6 0x7f7795a2a28a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28a) (BuildId: 42c84c92e6f98126b3e2230ebfdead22c235b667)
    #7 0x55e143a88344 in _start (/home/runner/work/curl/curl/bld/conftest+0x2b344) (BuildId: acf90599d654b070f297755bbc53b38a418f3c0d)

SUMMARY: AddressSanitizer: 1760 byte(s) leaked in 1 allocation(s).
``
https://github.com/curl/curl/actions/runs/13566872950/job/37923962163?pr=16507
vszakats added a commit that referenced this pull request Feb 27, 2025
```
=================================================================
==7294==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x56534822b193 in malloc (/home/runner/work/curl/curl/bld/conftest+0xc7193) (BuildId: 97134224fbe0749a43ecaaf61869e2bcb0f04094)
    #1 0x7fc1fe55b639 in getaddrinfo (/lib/x86_64-linux-gnu/libc.so.6+0x15b639) (BuildId: 42c84c92e6f98126b3e2230ebfdead22c235b667)
    #2 0x5653481c17fd in getaddrinfo (/home/runner/work/curl/curl/bld/conftest+0x5d7fd) (BuildId: 97134224fbe0749a43ecaaf61869e2bcb0f04094)
    #3 0x5653482698f4 in main /home/runner/work/curl/curl/bld/conftest.c:210:17
    #4 0x7fc1fe42a1c9  (/lib/x86_64-linux-gnu/libc.so.6+0x2a1c9) (BuildId: 42c84c92e6f98126b3e2230ebfdead22c235b667)
    #5 0x7fc1fe42a28a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28a) (BuildId: 42c84c92e6f98126b3e2230ebfdead22c235b667)
    #6 0x565348190344 in _start (/home/runner/work/curl/curl/bld/conftest+0x2c344) (BuildId: 97134224fbe0749a43ecaaf61869e2bcb0f04094)

SUMMARY: AddressSanitizer: 64 byte(s) leaked in 1 allocation(s).
```
https://github.com/curl/curl/actions/runs/13566872950/job/37923962163?pr=16507
vszakats added a commit that referenced this pull request Feb 28, 2025
```
=================================================================
==7427==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 1760 byte(s) in 1 object(s) allocated from:
    #0 0x55e143b2337d in calloc (/home/runner/work/curl/curl/bld/conftest+0xc637d) (BuildId: acf90599d654b070f297755bbc53b38a418f3c0d)
    #1 0x7f7795b3a4fb  (/lib/x86_64-linux-gnu/libc.so.6+0x13a4fb) (BuildId: 42c84c92e6f98126b3e2230ebfdead22c235b667)
    #2 0x7f7795b3b577 in getifaddrs (/lib/x86_64-linux-gnu/libc.so.6+0x13b577) (BuildId: 42c84c92e6f98126b3e2230ebfdead22c235b667)
    #3 0x55e143adc73b in getifaddrs (/home/runner/work/curl/curl/bld/conftest+0x7f73b) (BuildId: acf90599d654b070f297755bbc53b38a418f3c0d)
    #4 0x55e143b6180b in main /home/runner/work/curl/curl/bld/conftest.c:189:17
    #5 0x7f7795a2a1c9  (/lib/x86_64-linux-gnu/libc.so.6+0x2a1c9) (BuildId: 42c84c92e6f98126b3e2230ebfdead22c235b667)
    #6 0x7f7795a2a28a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28a) (BuildId: 42c84c92e6f98126b3e2230ebfdead22c235b667)
    #7 0x55e143a88344 in _start (/home/runner/work/curl/curl/bld/conftest+0x2b344) (BuildId: acf90599d654b070f297755bbc53b38a418f3c0d)

SUMMARY: AddressSanitizer: 1760 byte(s) leaked in 1 allocation(s).
``
https://github.com/curl/curl/actions/runs/13566872950/job/37923962163?pr=16507
vszakats added a commit that referenced this pull request Feb 28, 2025
```
=================================================================
==7294==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x56534822b193 in malloc (/home/runner/work/curl/curl/bld/conftest+0xc7193) (BuildId: 97134224fbe0749a43ecaaf61869e2bcb0f04094)
    #1 0x7fc1fe55b639 in getaddrinfo (/lib/x86_64-linux-gnu/libc.so.6+0x15b639) (BuildId: 42c84c92e6f98126b3e2230ebfdead22c235b667)
    #2 0x5653481c17fd in getaddrinfo (/home/runner/work/curl/curl/bld/conftest+0x5d7fd) (BuildId: 97134224fbe0749a43ecaaf61869e2bcb0f04094)
    #3 0x5653482698f4 in main /home/runner/work/curl/curl/bld/conftest.c:210:17
    #4 0x7fc1fe42a1c9  (/lib/x86_64-linux-gnu/libc.so.6+0x2a1c9) (BuildId: 42c84c92e6f98126b3e2230ebfdead22c235b667)
    #5 0x7fc1fe42a28a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28a) (BuildId: 42c84c92e6f98126b3e2230ebfdead22c235b667)
    #6 0x565348190344 in _start (/home/runner/work/curl/curl/bld/conftest+0x2c344) (BuildId: 97134224fbe0749a43ecaaf61869e2bcb0f04094)

SUMMARY: AddressSanitizer: 64 byte(s) leaked in 1 allocation(s).
```
https://github.com/curl/curl/actions/runs/13566872950/job/37923962163?pr=16507
vszakats added a commit that referenced this pull request Feb 28, 2025
```
=================================================================
==7427==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 1760 byte(s) in 1 object(s) allocated from:
    #0 0x55e143b2337d in calloc (/home/runner/work/curl/curl/bld/conftest+0xc637d) (BuildId: acf90599d654b070f297755bbc53b38a418f3c0d)
    #1 0x7f7795b3a4fb  (/lib/x86_64-linux-gnu/libc.so.6+0x13a4fb) (BuildId: 42c84c92e6f98126b3e2230ebfdead22c235b667)
    #2 0x7f7795b3b577 in getifaddrs (/lib/x86_64-linux-gnu/libc.so.6+0x13b577) (BuildId: 42c84c92e6f98126b3e2230ebfdead22c235b667)
    #3 0x55e143adc73b in getifaddrs (/home/runner/work/curl/curl/bld/conftest+0x7f73b) (BuildId: acf90599d654b070f297755bbc53b38a418f3c0d)
    #4 0x55e143b6180b in main /home/runner/work/curl/curl/bld/conftest.c:189:17
    #5 0x7f7795a2a1c9  (/lib/x86_64-linux-gnu/libc.so.6+0x2a1c9) (BuildId: 42c84c92e6f98126b3e2230ebfdead22c235b667)
    #6 0x7f7795a2a28a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28a) (BuildId: 42c84c92e6f98126b3e2230ebfdead22c235b667)
    #7 0x55e143a88344 in _start (/home/runner/work/curl/curl/bld/conftest+0x2b344) (BuildId: acf90599d654b070f297755bbc53b38a418f3c0d)

SUMMARY: AddressSanitizer: 1760 byte(s) leaked in 1 allocation(s).
``
https://github.com/curl/curl/actions/runs/13566872950/job/37923962163?pr=16507
vszakats added a commit that referenced this pull request Feb 28, 2025
```
=================================================================
==7294==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x56534822b193 in malloc (/home/runner/work/curl/curl/bld/conftest+0xc7193) (BuildId: 97134224fbe0749a43ecaaf61869e2bcb0f04094)
    #1 0x7fc1fe55b639 in getaddrinfo (/lib/x86_64-linux-gnu/libc.so.6+0x15b639) (BuildId: 42c84c92e6f98126b3e2230ebfdead22c235b667)
    #2 0x5653481c17fd in getaddrinfo (/home/runner/work/curl/curl/bld/conftest+0x5d7fd) (BuildId: 97134224fbe0749a43ecaaf61869e2bcb0f04094)
    #3 0x5653482698f4 in main /home/runner/work/curl/curl/bld/conftest.c:210:17
    #4 0x7fc1fe42a1c9  (/lib/x86_64-linux-gnu/libc.so.6+0x2a1c9) (BuildId: 42c84c92e6f98126b3e2230ebfdead22c235b667)
    #5 0x7fc1fe42a28a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28a) (BuildId: 42c84c92e6f98126b3e2230ebfdead22c235b667)
    #6 0x565348190344 in _start (/home/runner/work/curl/curl/bld/conftest+0x2c344) (BuildId: 97134224fbe0749a43ecaaf61869e2bcb0f04094)

SUMMARY: AddressSanitizer: 64 byte(s) leaked in 1 allocation(s).
```
https://github.com/curl/curl/actions/runs/13566872950/job/37923962163?pr=16507
vszakats added a commit that referenced this pull request Mar 28, 2025
Before this patch the signal handler called `logmsg()` which in turn
called `printf()` variants (internal implementations), and `FILE *`
functions, `localtime()`. Some of these called `malloc`/`free`, which
isn't supported in s signal handler. Replace them with `write` calls,
losing some logging functionality.

Also:
- De-dupe and move `STD*_FILENO` macros to `lib/curl_setup.h`. Revert
  the `src` definition to point to `stderr`, instead of `tool_stderr`.
  Follow-up to e5bb88b curl#11958

POSIX specs with list of functions allowed in a signal handler:
2004: https://pubs.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_04.html#tag_02_04_03
2017: https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_04_03
2024: https://pubs.opengroup.org/onlinepubs/9799919799/functions/V2_chap02.html#tag_16_04_03

Linux CI run with the thread sanitizer going crazy when
hitting the signal handler in test 1238 and 1242 (TFTP):
```
WARNING: ThreadSanitizer: signal-unsafe call inside of a signal (pid=12582)
    #0 malloc <null> (servers+0x5ed70)
    #1 _IO_file_doallocate <null> (libc.so.6+0x851b4)
    #2 formatf /home/runner/work/curl/curl/bld/tests/server/../../lib/../../lib/mprintf.c:886:9 (servers+0xdff77)
[...]
WARNING: ThreadSanitizer: signal-unsafe call inside of a signal (pid=12582)
    #0 free <null> (servers+0x5f453)
    #1 fclose <null> (libc.so.6+0x8532f)
    #2 logmsg /home/runner/work/curl/curl/bld/tests/server/../../../tests/server/util.c:134:5 (servers+0xe684d)
```
Ref: https://github.com/curl/curl/actions/runs/14118903372/job/39555309490?pr=16851

Closes curl#16852
vszakats added a commit that referenced this pull request Jun 11, 2025
```
==28724==ERROR: AddressSanitizer: stack-use-after-scope on address 0x7f028b500060 at pc 0x55edc7ea2e85 bp 0x7fff7d70a4d0 sp 0x7fff7d70a4c8
 READ of size 4 at 0x7f028b500060 thread T0
 /usr/bin/llvm-symbolizer-18: /home/runner/work/curl/curl/bld/lib/.libs/libcurl.so.4: no version information available (required by /usr/bin/llvm-symbolizer-18)
 /usr/bin/llvm-symbolizer-18: symbol lookup error: /home/runner/work/curl/curl/bld/lib/.libs/libcurl.so.4: undefined symbol: __asan_option_detect_stack_use_after_return
 ==28724==WARNING: Can't read from symbolizer at fd 6
 ==28724==WARNING: Can't write to symbolizer at fd 9
 /usr/bin/llvm-symbolizer-18: /home/runner/work/curl/curl/bld/lib/.libs/libcurl.so.4: no version information available (required by /usr/bin/llvm-symbolizer-18)
 /usr/bin/llvm-symbolizer-18: symbol lookup error: /home/runner/work/curl/curl/bld/lib/.libs/libcurl.so.4: undefined symbol: __asan_option_detect_stack_use_after_return
 ==28724==WARNING: Can't read from symbolizer at fd 6
 ==28724==WARNING: Can't read from symbolizer at fd 6
 ==28724==WARNING: Can't read from symbolizer at fd 6
 ==28724==WARNING: Can't read from symbolizer at fd 6
 ==28724==WARNING: Can't read from symbolizer at fd 6
 ==28724==WARNING: Can't read from symbolizer at fd 6
 ==28724==WARNING: Can't read from symbolizer at fd 6
 ==28724==WARNING: Can't read from symbolizer at fd 6
 ==28724==WARNING: Can't read from symbolizer at fd 6
 ==28724==WARNING: Can't read from symbolizer at fd 6
 ==28724==WARNING: Can't read from symbolizer at fd 6
 ==28724==WARNING: Can't read from symbolizer at fd 6
 ==28724==WARNING: Can't read from symbolizer at fd 6
 ==28724==WARNING: Can't read from symbolizer at fd 6
 ==28724==WARNING: Can't read from symbolizer at fd 6
 ==28724==WARNING: Can't read from symbolizer at fd 6
 ==28724==WARNING: Can't read from symbolizer at fd 6
 ==28724==WARNING: Can't read from symbolizer at fd 6
 ==28724==WARNING: Can't read from symbolizer at fd 6
 ==28724==WARNING: Can't read from symbolizer at fd 6
 ==28724==WARNING: Can't read from symbolizer at fd 6
     #0 0x55edc7ea2e84  (/home/runner/work/curl/curl/bld/tests/libtest/.libs/libtests+0x1b6e84) (BuildId: 7d9c526eeac6e37274bab929807a3ed93d8fe67c)
     #1 0x7f028f6111dd  (/home/runner/work/curl/curl/bld/lib/.libs/libcurl.so.4+0x8111dd) (BuildId: 8b44169afc81107024b77ec9a2942da0f6e28bfa)
     #2 0x7f028f38b8c4  (/home/runner/work/curl/curl/bld/lib/.libs/libcurl.so.4+0x58b8c4) (BuildId: 8b44169afc81107024b77ec9a2942da0f6e28bfa)
     #3 0x7f028f38d60a  (/home/runner/work/curl/curl/bld/lib/.libs/libcurl.so.4+0x58d60a) (BuildId: 8b44169afc81107024b77ec9a2942da0f6e28bfa)
     #4 0x7f028f3796a5  (/home/runner/work/curl/curl/bld/lib/.libs/libcurl.so.4+0x5796a5) (BuildId: 8b44169afc81107024b77ec9a2942da0f6e28bfa)
     #5 0x7f028f11c442  (/home/runner/work/curl/curl/bld/lib/.libs/libcurl.so.4+0x31c442) (BuildId: 8b44169afc81107024b77ec9a2942da0f6e28bfa)
     #6 0x7f028f11bd9c  (/home/runner/work/curl/curl/bld/lib/.libs/libcurl.so.4+0x31bd9c) (BuildId: 8b44169afc81107024b77ec9a2942da0f6e28bfa)
     #7 0x7f028f37891b  (/home/runner/work/curl/curl/bld/lib/.libs/libcurl.so.4+0x57891b) (BuildId: 8b44169afc81107024b77ec9a2942da0f6e28bfa)
     #8 0x7f028f2bb7f3  (/home/runner/work/curl/curl/bld/lib/.libs/libcurl.so.4+0x4bb7f3) (BuildId: 8b44169afc81107024b77ec9a2942da0f6e28bfa)
     #9 0x7f028f28b01d  (/home/runner/work/curl/curl/bld/lib/.libs/libcurl.so.4+0x48b01d) (BuildId: 8b44169afc81107024b77ec9a2942da0f6e28bfa)
     #10 0x7f028f5e3ce4  (/home/runner/work/curl/curl/bld/lib/.libs/libcurl.so.4+0x7e3ce4) (BuildId: 8b44169afc81107024b77ec9a2942da0f6e28bfa)
     #11 0x7f028f5de4c1  (/home/runner/work/curl/curl/bld/lib/.libs/libcurl.so.4+0x7de4c1) (BuildId: 8b44169afc81107024b77ec9a2942da0f6e28bfa)
     curl#12 0x7f028f340504  (/home/runner/work/curl/curl/bld/lib/.libs/libcurl.so.4+0x540504) (BuildId: 8b44169afc81107024b77ec9a2942da0f6e28bfa)
     curl#13 0x7f028f33dba1  (/home/runner/work/curl/curl/bld/lib/.libs/libcurl.so.4+0x53dba1) (BuildId: 8b44169afc81107024b77ec9a2942da0f6e28bfa)
     curl#14 0x7f028f4f02bd  (/home/runner/work/curl/curl/bld/lib/.libs/libcurl.so.4+0x6f02bd) (BuildId: 8b44169afc81107024b77ec9a2942da0f6e28bfa)
     curl#15 0x7f028f212a09  (/home/runner/work/curl/curl/bld/lib/.libs/libcurl.so.4+0x412a09) (BuildId: 8b44169afc81107024b77ec9a2942da0f6e28bfa)
     curl#16 0x7f028f211bae  (/home/runner/work/curl/curl/bld/lib/.libs/libcurl.so.4+0x411bae) (BuildId: 8b44169afc81107024b77ec9a2942da0f6e28bfa)
     curl#17 0x55edc7ea2c73  (/home/runner/work/curl/curl/bld/tests/libtest/.libs/libtests+0x1b6c73) (BuildId: 7d9c526eeac6e37274bab929807a3ed93d8fe67c)
     curl#18 0x55edc7f7b832  (/home/runner/work/curl/curl/bld/tests/libtest/.libs/libtests+0x28f832) (BuildId: 7d9c526eeac6e37274bab929807a3ed93d8fe67c)
     curl#19 0x7f028dc2a1c9  (/lib/x86_64-linux-gnu/libc.so.6+0x2a1c9) (BuildId: 42c84c92e6f98126b3e2230ebfdead22c235b667)
     curl#20 0x7f028dc2a28a  (/lib/x86_64-linux-gnu/libc.so.6+0x2a28a) (BuildId: 42c84c92e6f98126b3e2230ebfdead22c235b667)
     curl#21 0x55edc7da3a34  (/home/runner/work/curl/curl/bld/tests/libtest/.libs/libtests+0xb7a34) (BuildId: 7d9c526eeac6e37274bab929807a3ed93d8fe67c)
 Address 0x7f028b500060 is located in stack of thread T0 at offset 32 in frame
 ==28724==WARNING: Can't read from symbolizer at fd 6
     #0 0x55edc7ea2717  (/home/runner/work/curl/curl/bld/tests/libtest/.libs/libtests+0x1b6717) (BuildId: 7d9c526eeac6e37274bab929807a3ed93d8fe67c)
   This frame has 1 object(s):
     [32, 36) 'counter' (line 91) <== Memory access at offset 32 is inside this variable
 HINT: this may be a false positive if your program uses some custom stack unwind mechanism, swapcontext or vfork
       (longjmp and C++ exceptions *are* supported)
 ==28724==WARNING: Can't read from symbolizer at fd 6
 SUMMARY: AddressSanitizer: stack-use-after-scope (/home/runner/work/curl/curl/bld/tests/libtest/.libs/libtests+0x1b6e84) (BuildId: 7d9c526eeac6e37274bab929807a3ed93d8fe67c)
 Shadow bytes around the buggy address:
   0x7f028b4ffd80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
   0x7f028b4ffe00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
   0x7f028b4ffe80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
   0x7f028b4fff00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
   0x7f028b4fff80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 =>0x7f028b500000: f5 f5 f5 f5 f5 f5 f5 f5 f1 f1 f1 f1[f8]f3 f3 f3
   0x7f028b500080: f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5
   0x7f028b500100: f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5
   0x7f028b500180: f1 f1 f1 f1 04 f2 f8 f3 f5 f5 f5 f5 f5 f5 f5 f5
   0x7f028b500200: f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5
   0x7f028b500280: f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5
 Shadow byte legend (one shadow byte represents 8 application bytes):
   Addressable:           00
   Partially addressable: 01 02 03 04 05 06 07
   Heap left redzone:       fa
   Freed heap region:       fd
   Stack left redzone:      f1
   Stack mid redzone:       f2
   Stack right redzone:     f3
   Stack after return:      f5
   Stack use after scope:   f8
   Global redzone:          f9
   Global init order:       f6
   Poisoned by user:        f7
   Container overflow:      fc
   Array cookie:            ac
   Intra object redzone:    bb
   ASan internal:           fe
   Left alloca redzone:     ca
   Right alloca redzone:    cb
 ==28724==ABORTING
```
https://github.com/curl/curl/actions/runs/15590177615/job/43906987845?pr=17598#step:39:1276
vszakats added a commit that referenced this pull request Aug 13, 2025
Replace autotools with cmake to avoid libtool wrappers that are changing
`LD_LIBRARY_PATH` in a way incompatible with the thread sanitizer.

To fix the output when the sanitizier is finding something:
```
==51718==WARNING: Can't write to symbolizer at fd 7
 /usr/bin/llvm-symbolizer-18: /home/runner/work/curl/curl/bld/lib/.libs/libcurl.so.4: no version information available (required by /usr/bin/llvm-symbolizer-18)
 /usr/bin/llvm-symbolizer-18: symbol lookup error: /home/runner/openssl/lib/libcrypto.so.3: undefined symbol: __tsan_func_entry
```
Ref: https://github.com/curl/curl/actions/runs/16911402500/job/47913783729#step:39:4466

After:
```
 13:50:04.117885 == Info:ThreadSanitizer: thread T1  finished with ignores enabled, created at:
  closing connection #0
     #0 pthread_create <null> (libtests+0x6bc0f) (BuildId: 4fe889446291259934205ac03931c397aa0210d3)
     #1 Curl_thread_create /home/runner/work/curl/curl/lib/curl_threads.c:73:6 (libcurl.so.4+0x55a76) (BuildId: cb0f14ba2ad68c9cab0c980d9a5d7a53cc0782da)
     #2 async_thrdd_init /home/runner/work/curl/curl/lib/asyn-thrdd.c:500:26 (libcurl.so.4+0x1c153) (BuildId: cb0f14ba2ad68c9cab0c980d9a5d7a53cc0782da)
[...]
```
Ref: https://github.com/curl/curl/actions/runs/16939193922/job/48003405272?pr=18274#step:39:4018

Also:
- disable memory tracker which turned out to be incompatible with
  the thread sanitizer and detaching threads.
  Ref: curl#18263 and #curl IRC.
- the job is ~30 seconds faster after this patch.

Reported-by: Stefan Eissing
Bug: curl#18263 (comment)
Follow-up to a2bcec0 curl#14751
Closes curl#18274
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.