Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hostip: fix crash in sync resolver builds that use DOH #6603

Closed
wants to merge 1 commit into from

Conversation

@jay
Copy link
Member

@jay jay commented Feb 13, 2021

  • Guard some Curl_async accesses with USE_CURL_ASYNC instead of
    !CURLRES_SYNCH.

This is another follow-up to 8335c64 which moved the async struct from
the connectdata struct into the Curl_easy struct. A previous follow-up
6cd167a fixed building for sync resolver by guarding some async struct
accesses with !CURLRES_SYNCH. The problem is since DOH (DNS-over-HTTPS)
is available as an asyncronous secondary resolver the async struct may
be used even when libcurl is built for the sync resolver. That means
that CURLRES_SYNCH and USE_CURL_ASYNC may be defined at the same time.

Closes #xxxx


IMO the situation is confusing and it's easy to forget the difference. It could happen again.

caught during doh testing in a --disable-threaded-resolver build

 connect.c:1360:49: runtime error: member access within null pointer of type 'const struct Curl_dns_entry'
     #0 0x7fa0710f297e in Curl_connecthost /home/owner/curl/lib/connect.c:1360
     #1 0x7fa071282ac1 in Curl_setup_conn /home/owner/curl/lib/url.c:3992
     #2 0x7fa0711685ea in Curl_once_resolved /home/owner/curl/lib/hostip.c:1118
     #3 0x7fa0711cf6f9 in multi_runsingle /home/owner/curl/lib/multi.c:1757
     #4 0x7fa0711d30ab in curl_multi_perform /home/owner/curl/lib/multi.c:2412
     #5 0x7fa071122b06 in easy_transfer /home/owner/curl/lib/easy.c:606
     #6 0x7fa07112321f in easy_perform /home/owner/curl/lib/easy.c:696
     #7 0x7fa0711232fc in curl_easy_perform /home/owner/curl/lib/easy.c:715
     #8 0x451028 in serial_transfers /home/owner/curl/src/tool_operate.c:2338
     #9 0x452122 in run_all_transfers /home/owner/curl/src/tool_operate.c:2512
     #10 0x45295b in operate /home/owner/curl/src/tool_operate.c:2628
     #11 0x4366f4 in main /home/owner/curl/src/tool_main.c:277
     #12 0x7fa06f9b383f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2083f)
     #13 0x4039e8 in _start (/home/owner/curl/src/.libs/lt-curl+0x4039e8)
- Guard some Curl_async accesses with USE_CURL_ASYNC instead of
  !CURLRES_SYNCH.

This is another follow-up to 8335c64 which moved the async struct from
the connectdata struct into the Curl_easy struct. A previous follow-up
6cd167a fixed building for sync resolver by guarding some async struct
accesses with !CURLRES_SYNCH. The problem is since DOH (DNS-over-HTTPS)
is available as an asyncronous secondary resolver the async struct may
be used even when libcurl is built for the sync resolver. That means
that CURLRES_SYNCH and USE_CURL_ASYNC may be defined at the same time.

Closes #xxxx
@bagder
bagder approved these changes Feb 13, 2021
@jay jay closed this in b68026f Feb 14, 2021
@jay jay deleted the jay:fix_sync_resolver_for_doh branch Feb 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants