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

SIGSEGV crash when using client upstream #791

Closed
kpine opened this issue Dec 9, 2022 · 1 comment · Fixed by #793
Closed

SIGSEGV crash when using client upstream #791

kpine opened this issue Dec 9, 2022 · 1 comment · Fixed by #793
Labels
🐞 bug Something isn't working
Milestone

Comments

@kpine
Copy link

kpine commented Dec 9, 2022

I'm getting a crash when I have a client upstream dns provider configured, as soon as the client makes a dns request. When I disable the client entry, there's no crash. The issue exists in v0.19, v0.20 and development Docker images.

The upstream configuration is basically (values redacted):

upstream:
  default:
    - 8.8.8.8
    - 9.9.9.9
  1.2.3.4:
    - https://family.cloudflare-dns.com/dns-query

It does not matter if I change the upstream provider. However, after some experimentation, it does seem to be fixed if I add a second entry, as in:

upstream:
  default:
    - 8.8.8.8
    - 9.9.9.9
  1.2.3.4:
    - https://family.cloudflare-dns.com/dns-query
    - 1.1.1.3

I also have customDNS.mapping and condition.mapping configurations, if those are relevant. But simply commenting out the client upstream, or adding the second provider, stops the crashing.

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x88e200]
goroutine 476 [running]:
github.com/0xERR0R/blocky/resolver.weightedRandom({0x28676d8, 0x2, 0x2}, {0xbd1184, 0x266e150})
	/go/src/resolver/parallel_best_resolver.go:244 +0x360
github.com/0xERR0R/blocky/resolver.pickRandom({0x28676d8, 0x2, 0x2})
	/go/src/resolver/parallel_best_resolver.go:215 +0x70
github.com/0xERR0R/blocky/resolver.(*ParallelBestResolver).Resolve(0x271a550, 0x28065c0)
	/go/src/resolver/parallel_best_resolver.go:175 +0xf4
github.com/0xERR0R/blocky/resolver.(*SpecialUseDomainNamesResolver).Resolve(0x33129d0, 0x28065c0)
	/go/src/resolver/sudn_resolver.go:78 +0x310
github.com/0xERR0R/blocky/resolver.(*ConditionalUpstreamResolver).Resolve(0x3312720, 0x28065c0)
	/go/src/resolver/conditional_upstream_resolver.go:95 +0x254
github.com/0xERR0R/blocky/resolver.(*CachingResolver).Resolve(0x2715380, 0x28065c0)
	/go/src/resolver/caching_resolver.go:204 +0x630
github.com/0xERR0R/blocky/resolver.(*BlockingResolver).Resolve(0x2462680, 0x28065c0)
	/go/src/resolver/blocking_resolver.go:419 +0x16c
github.com/0xERR0R/blocky/resolver.(*HostsFileResolver).Resolve(0x266e450, 0x28065c0)
	/go/src/resolver/hosts_file_resolver.go:70 +0x2c8
github.com/0xERR0R/blocky/resolver.(*CustomDNSResolver).Resolve(0x26c2cf0, 0x28065c0)
	/go/src/resolver/custom_dns_resolver.go:157 +0x268
github.com/0xERR0R/blocky/resolver.(*MetricsResolver).Resolve(0x266e420, 0x28065c0)
	/go/src/resolver/metrics_resolver.go:28 +0x30
github.com/0xERR0R/blocky/resolver.(*QueryLoggingResolver).Resolve(0x266e2a0, 0x28065c0)
	/go/src/resolver/query_logging_resolver.go:109 +0x108
github.com/0xERR0R/blocky/resolver.(*EdeResolver).Resolve(0x3312760, 0x28065c0)
	/go/src/resolver/ede_resolver.go:21 +0x30
github.com/0xERR0R/blocky/resolver.(*ClientNamesResolver).Resolve(0x266e1e0, 0x28065c0)
	/go/src/resolver/client_names_resolver.go:79 +0x188
github.com/0xERR0R/blocky/resolver.(*FqdnOnlyResolver).Resolve(0x3312750, 0x28065c0)
	/go/src/resolver/fqdn_only_resolver.go:34 +0x120
github.com/0xERR0R/blocky/resolver.(*FilteringResolver).Resolve(0x3312740, 0x28065c0)
	/go/src/resolver/filtering_resolver.go:29 +0x1fc
github.com/0xERR0R/blocky/server.(*Server).OnRequest(0x2462800, {0xbd6d78, 0x2806500}, 0x26cb630)
	/go/src/server/server.go:617 +0xdc
github.com/miekg/dns.HandlerFunc.ServeDNS(0x327e1c8, {0xbd6d78, 0x2806500}, 0x26cb630)
	/go/pkg/mod/github.com/miekg/dns@v1.1.50/server.go:37 +0x34
github.com/miekg/dns.(*ServeMux).ServeDNS(0x2400080, {0xbd6d78, 0x2806500}, 0x26cb630)
	/go/pkg/mod/github.com/miekg/dns@v1.1.50/serve_mux.go:103 +0x90
github.com/miekg/dns.(*Server).serveDNS(0x247a000, {0x332a000, 0x24, 0xffff}, 0x2806500)
	/go/pkg/mod/github.com/miekg/dns@v1.1.50/server.go:659 +0x454
github.com/miekg/dns.(*Server).serveUDPPacket(0x247a000, 0x2850070, {0x332a000, 0x24, 0xffff}, {0xbd5d70, 0x271a008}, 0x29a7fe0, {0x0, 0x0})
	/go/pkg/mod/github.com/miekg/dns@v1.1.50/server.go:603 +0x1c8
created by github.com/miekg/dns.(*Server).serveUDP
	/go/pkg/mod/github.com/miekg/dns@v1.1.50/server.go:533 +0x48c
@0xERR0R 0xERR0R added the 🐞 bug Something isn't working label Dec 9, 2022
@0xERR0R 0xERR0R added this to the 0.21 milestone Dec 9, 2022
@0xERR0R
Copy link
Owner

0xERR0R commented Dec 9, 2022

The error is reproducible: it occurs only on specific upstream mapping when IP address was defined as upstream resolver group and the client has no client name (means client has the IP address as name as fallback).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants