mirror of
https://github.com/hickory-dns/hickory-dns.git
synced 2026-04-24 18:55:55 +03:00
[GH-ISSUE #1782] Stack overflow in trust-dns-recursor #767
Labels
No labels
blocked
breaking-change
bug
bug:critical
bug:tests
cleanup
compliance
compliance
compliance
crate:all
crate:client
crate:native-tls
crate:proto
crate:recursor
crate:resolver
crate:resolver
crate:rustls
crate:server
crate:util
dependencies
docs
duplicate
easy
easy
enhance
enhance
enhance
feature:dns-over-https
feature:dns-over-quic
feature:dns-over-tls
feature:dnsssec
feature:global_lb
feature:mdns
feature:tsig
features:edns
has workaround
ops
perf
platform:WASM
platform:android
platform:fuchsia
platform:linux
platform:macos
platform:windows
pull-request
question
test
tools
tools
trust
unclear
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hickory-dns#767
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @iustin24 on GitHub (Sep 27, 2022).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/1782
Describe the bug
The recursor binary in trust-dns-util does not work and returns a stack overflow error. I've also tried writing my own implementation using trust-dns-recursor and I'm getting the same stack overflow error.
To Reproduce
System:
@bluejekyll commented on GitHub (Sep 27, 2022):
Thanks for the report, I was able to reproduce easily. The recursor doesn't currently have any test coverage, something may have regressed in the lead up to the last release.
@bluejekyll commented on GitHub (Sep 30, 2022):
Ok, started looking at this. Something about quad9's response is trigger this issue. If you use this query, things work fine:
Stack overflow happens with
8.8.8.8:53as the name server as well. Based on the--debugoutput, it looks like we're not treating the forward to.netfrom these name servers properly.Looking at the responses from the name server, it appears that they expect us to have the glue for the root nameservers always registered, see:
So my guess is we're getting stuck looking for glue for
.net.and.com.because9.9.9.9and8.8.8.8are not root name severs. To me this implies that we should always register the roots, which currently is a separate file, but maybe we should consider compiling them in.@Arnavion commented on GitHub (Jun 7, 2023):
Are you talking about what IANA calls the root hints file or the root zone file? The former is the 26 A and AAAA records for
{a-m}.root-servers.net, but it wouldn't solve OP's problem, because it doesn't help with figuring out the IPs of the*.gtld-servers.netservers. The latter contains the A and AAAA records of all the gTLD nameservers as well (including{a-m}.gtld-servers.net), which would solve OP's problem, but is also much bigger (~11k A and AAAA records if I counted correctly) and is not static.Hard-coding the full root zone shouldn't be necessary to solve this problem, though it would certainly be nice if trust-dns-recursor had a
pub static WELL_KNOWN_ROOT_SERVERS: Vec<NameServerConfig> = ...;for the thirteenroot-servers.netservers, just so that a user can create aRecursorwith them. The real issue as I see it is that trust-dns-recursor implements QNAME minimization but doesn't fall back to a larger query if a smaller query leads to a loop. In OP's case it means trust-dns-recursor does a stack overflow instead of falling back to querying the9.9.9.9server forIN A a.gtld-servers.net.FYI, another example of a server that doesn't return the A/AAAA glue records for gTLD NS queries is Unbound. It filters the additional data out unless
val-clean-additionalis set tono. That is how I came across this issue.