Crash when using libcurl with new hyper + rustls backend
- From
- Kevin Burke <kevin@meter.com>
- Date
- Feb 23, 2021, 21:12 UTC
- Message-ID
- <CAAJ6v9AruZ3HfqB1x6CKBM=JgFj8bNwjQFUO4rzv2s=yeXfcDw@mail.gmail.com>
Hi, Curl added a new TLS backend that is written in Rust recently. If you are using Mac, you can install it by running "brew install --HEAD meterup/safe/curl", or view the specific compilation flags I passed to curl, here: https://github.com/meterup/homebrew-safe/blob/main/Formula/curl.rb
If you are on Linux, you can use these instructions to build libcurl with rustls: https://github.com/abetterinternet/crustls/wiki/Building-curl-with-crustls-and-Hyper
When I compile Git using this curl, I get a segfault when running "git fetch https://go.googlesource.com/tools"
* thread #1, queue = 'com.apple.main-thread', stop reason =
EXC_BAD_ACCESS (code=1, address=0x8)
* frame #0: 0x00000001000e2b58 git-remote-https`strbuf_grow + 16
frame #1: 0x00000001000e3020 git-remote-https`strbuf_add + 27
frame #2: 0x00000001000076d5 git-remote-https`fwrite_buffer + 27
frame #3: 0x00000001002ebfba libcurl.4.dylib`Curl_hyper_stream + 594
frame #4: 0x000000010032fdf8 libcurl.4.dylib`Curl_readwrite + 203
frame #5: 0x0000000100319a80 libcurl.4.dylib`multi_runsingle + 2113
frame #6: 0x00000001003191c6 libcurl.4.dylib`curl_multi_perform + 113
frame #7: 0x00000001000094cb git-remote-https`step_active_slots + 25
frame #8: 0x0000000100009532 git-remote-https`run_active_slot + 67
frame #9: 0x00000001000097fd git-remote-https`run_one_slot + 41
frame #10: 0x000000010000bb06 git-remote-https`http_request + 1630
frame #11: 0x00000001000099b7 git-remote-https`http_request_reauth + 34
frame #12: 0x0000000100006131 git-remote-https`discover_refs + 625
frame #13: 0x00000001000053fc git-remote-https`cmd_main + 4484
frame #14: 0x000000010000ce55 git-remote-https`main + 130
frame #15: 0x00007fff699fbcc9 libdyld.dylib`start + 1
frame #16: 0x00007fff699fbcc9 libdyld.dylib`start + 1I had previously reported this issue to curl here, which includes a number of useful pieces of information including the contents of each register at the time of the crash. https://github.com/curl/curl/issues/6619
The latest comment on that issue suggests git may not be setting curl flags appropriately, which is why I am raising an issue here. I'm not great at C programming and have not been able to sort out what's going on myself, unfortunately.
Here's some more information about my git installation:
[System Info] git version: git version 2.30.1 cpu: x86_64 no commit associated with this build sizeof-long: 8 sizeof-size_t: 8 shell-path: /bin/sh uname: Darwin 19.6.0 Darwin Kernel Version 19.6.0: Tue Jan 12 22:13:05 PST 2021; root:xnu-6153.141.16~1/RELEASE_X86_64 x86_64 compiler info: clang: 12.0.0 (clang-1200.0.32.28) libc info: no libc information available $SHELL (typically, interactive shell): /usr/local/bin/zsh
Hope this helps, Kevin