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

atomic.AddUint64 in 32-bit cause panic #4111

Closed
zouyee opened this issue Sep 9, 2020 · 2 comments · Fixed by #4112
Closed

atomic.AddUint64 in 32-bit cause panic #4111

zouyee opened this issue Sep 9, 2020 · 2 comments · Fixed by #4112
Labels

Comments

@zouyee
Copy link
Member

zouyee commented Sep 9, 2020

What happened:
atomic.AddUint64 in 32-bit cause panic

[INFO] plugin/reload: Running configuration MD5 = 1ea4ac40c2a2283a62381a66c976f90b
CoreDNS-1.7.0
linux/386, go1.14.4,
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x80524bc]
goroutine 72 [running]:
runtime/internal/atomic.Xadd64(0xb8abd9c, 0x1, 0x0, 0x0, 0xc)
	/usr/local/go/src/runtime/internal/atomic/asm_386.s:105 +0xc
github.com/coredns/coredns/plugin/trace.(*trace).ServeDNS(0xb8abd60, 0x9965cc0, 0xba29380, 0x9970c20, 0xb89ffa0, 0xba2a410, 0x0, 0x0, 0x0)
	/root/coredns/plugin/trace/trace.go:85 +0x4a4
github.com/coredns/coredns/core/dnsserver.(*Server).ServeDNS(0xbc384c0, 0x9965cc0, 0xba29380, 0x9970c20, 0xb89ffa0, 0xba2a410)
	/root/coredns/core/dnsserver/server.go:285 +0x361
github.com/coredns/coredns/core/dnsserver.(*Server).ServePacket.func1(0x9971ee0, 0xb881e30, 0xba2a410)
	/root/coredns/core/dnsserver/server.go:126 +0x8a
github.com/miekg/dns.HandlerFunc.ServeDNS(0xb811008, 0x9971ee0, 0xb881e30, 0xba2a410)
	/dcos/gopath/pkg/mod/github.com/miekg/dns@v1.1.31/server.go:37 +0x34
github.com/miekg/dns.(*Server).serveDNS(0xb8ac6e0, 0xb90e200, 0x25, 0x200, 0xb881e30)
	/dcos/gopath/pkg/mod/github.com/miekg/dns@v1.1.31/server.go:609 +0x258
github.com/miekg/dns.(*Server).serveUDPPacket(0xb8ac6e0, 0xbc09a10, 0xb90e200, 0x25, 0x200, 0xb810d80, 0xb89fec0)
	/dcos/gopath/pkg/mod/github.com/miekg/dns@v1.1.31/server.go:549 +0x92
created by github.com/miekg/dns.(*Server).serveUDP
	/dcos/gopath/pkg/mod/github.com/miekg/dns@v1.1.31/server.go:479 +0x1f4

What you expected to happen:

How to reproduce it (as minimally and precisely as possible):
GOARCH=386 go run coredns.go

Anything else we need to know?:

Environment:

  • the version of CoreDNS: latest
  • Corefile:
.:53 {
        errors
	debug
	log
        health {
           lameduck 5s
        }
        ready
	trace localhost:9411 {
	   every 10000
	   service dnsproxy
	}
        cache 30
        loop
        reload
        loadbalance
    }
@zouyee zouyee added the bug label Sep 9, 2020
@zouyee
Copy link
Member Author

zouyee commented Sep 9, 2020

Similar questions: rs/zerolog#228
Reason: https://golang.org/pkg/sync/atomic/#pkg-note-BUG
Possible solution: rs/zerolog#229
or just changing count to an uint32 instead

miekg added a commit that referenced this issue Sep 9, 2020
A 64 bit entity needs to be the first in a struct to make it work on 32
bit systems.

Fixes: #4111

Signed-off-by: Miek Gieben <miek@miek.nl>
@miekg
Copy link
Member

miekg commented Sep 9, 2020 via email

miekg added a commit that referenced this issue Sep 9, 2020
* plugin/trace: fix struct allignment

A 64 bit entity needs to be the first in a struct to make it work on 32
bit systems.

Fixes: #4111

Signed-off-by: Miek Gieben <miek@miek.nl>

* plugin/erratic does makes the same mistake

Signed-off-by: Miek Gieben <miek@miek.nl>
nyodas pushed a commit to DataDog/coredns that referenced this issue Oct 26, 2020
* plugin/trace: fix struct allignment

A 64 bit entity needs to be the first in a struct to make it work on 32
bit systems.

Fixes: coredns#4111

Signed-off-by: Miek Gieben <miek@miek.nl>

* plugin/erratic does makes the same mistake

Signed-off-by: Miek Gieben <miek@miek.nl>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants