driusan / dgit

A Pure Go Git Implementation
MIT License
112 stars 10 forks source link

dgit clone breaks on ARM64 (seems to relate to broken assumptions about memory safety/locking?) #276

Open LaPingvino opened 3 years ago

LaPingvino commented 3 years ago

https://github.com/driusan/dgit/blob/df0293e1c8bb4c484a2ca1790567a270d65016a6/git/indexpack.go#L637

$ dgit clone https://github.com/wikimedia/mediawiki/ mediawiki
Initialized empty Git repository in /home/ikojba/mediawiki/.git/
remote: Enumerating objects: 883570, done.
remote: Counting objects: 100% (3362/3362), done.
remote: Compressing objects: 100% (1486/1486), done.
Receiving objects:  0% (1/883570), 12 B | 2 B/sunexpected fault address 0x4000600014
fatal error: fault
[signal SIGBUS: bus error code=0x1 addr=0x4000600014 pc=0x2eb260]

goroutine 1 [running]:
runtime.throw(0x3d978c, 0x5)
        /usr/local/lib/go/src/runtime/panic.go:1117 +0x54 fp=0x4000191620 sp=0x40001915f0 pc=0x43d74
runtime.sigpanic()
        /usr/local/lib/go/src/runtime/signal_unix.go:731 +0x284 fp=0x4000191660 sp=0x4000191620 pc=0x5a794
github.com/driusan/dgit/git.(*PackfileIndexV2).updateFanout(...)
        /home/ikojba/go/pkg/mod/github.com/driusan/dgit@v0.0.0-20200902205355-df0293e1c8bb/git/indexpack.go:640
github.com/driusan/dgit/git.indexClosure.func2(0x45fb48, 0x4000098010, 0x1, 0xd7b72, 0x17a, 0x1, 0x15a, 0x0, 0x0, 0x0, ...)
        /home/ikojba/go/pkg/mod/github.com/driusan/dgit@v0.0.0-20200902205355-df0293e1c8bb/git/indexpack.go:827 +0x290 fp=0x4000191810 sp=0x4000191670 pc=0x2eb260
github.com/driusan/dgit/git.IndexPack.func1(0x45fb48, 0x4000098010, 0x1, 0xd7b72, 0x17a, 0x1, 0x15a, 0x0, 0x0, 0x0, ...)
        /home/ikojba/go/pkg/mod/github.com/driusan/dgit@v0.0.0-20200902205355-df0293e1c8bb/git/indexpack.go:674 +0xb0 fp=0x4000191960 sp=0x4000191810 pc=0x2ea440
github.com/driusan/dgit/git.iteratePack(0x400019c070, 0x45f828, 0x400015e020, 0x4000590010, 0x4000192250, 0x40001921f0, 0x4000590020, 0x0, 0x0, 0x0)
        /home/ikojba/go/pkg/mod/github.com/driusan/dgit@v0.0.0-20200902205355-df0293e1c8bb/git/packiterator.go:105 +0x460 fp=0x4000191c00 sp=0x4000191960 pc=0x2c2e60
github.com/driusan/dgit/git.IndexPack(0x400019c070, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /home/ikojba/go/pkg/mod/github.com/driusan/dgit@v0.0.0-20200902205355-df0293e1c8bb/git/indexpack.go:720 +0x1f0 fp=0x4000192bd0 sp=0x4000191c00 pc=0x2b3cb0
github.com/driusan/dgit/git.IndexAndCopyPack(...)
        /home/ikojba/go/pkg/mod/github.com/driusan/dgit@v0.0.0-20200902205355-df0293e1c8bb/git/indexpack.go:925
github.com/driusan/dgit/git.fetchPackDone(0x400019c070, 0x1, 0x0, 0x0, 0x0, 0x3dda6b, 0xf, 0x100000000000000, 0x46a0b8, 0x40001a8000, ...)
        /home/ikojba/go/pkg/mod/github.com/driusan/dgit@v0.0.0-20200902205355-df0293e1c8bb/git/fetchpack.go:322 +0x994 fp=0x4000193030 sp=0x4000192bd0 pc=0x29e184
github.com/driusan/dgit/git.FetchPack(0x400019c070, 0x1, 0x0, 0x0, 0x0, 0x3dda6b, 0xf, 0x100000000000000, 0x7fc8dae591, 0x27, ...)
        /home/ikojba/go/pkg/mod/github.com/driusan/dgit@v0.0.0-20200902205355-df0293e1c8bb/git/fetchpack.go:100 +0x298 fp=0x4000193230 sp=0x4000193030 pc=0x29d708
github.com/driusan/dgit/git.Clone(0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, ...)
        /home/ikojba/go/pkg/mod/github.com/driusan/dgit@v0.0.0-20200902205355-df0293e1c8bb/git/clone.go:61 +0x134 fp=0x4000193630 sp=0x4000193230 pc=0x293c24
github.com/driusan/dgit/cmd.Clone(0x0, 0x4000144020, 0x2, 0x2, 0x0, 0x45f5e8)
        /home/ikojba/go/pkg/mod/github.com/driusan/dgit@v0.0.0-20200902205355-df0293e1c8bb/cmd/clone.go:60 +0x614 fp=0x4000193940 sp=0x4000193630 pc=0x3016e4
main.main()
        /home/ikojba/go/pkg/mod/github.com/driusan/dgit@v0.0.0-20200902205355-df0293e1c8bb/main.go:215 +0x21f0 fp=0x4000193f70 sp=0x4000193940 pc=0x3227b0
runtime.main()
        /usr/local/lib/go/src/runtime/proc.go:225 +0x274 fp=0x4000193fd0 sp=0x4000193f70 pc=0x462c4
runtime.goexit()
        /usr/local/lib/go/src/runtime/asm_arm64.s:1130 +0x4 fp=0x4000193fd0 sp=0x4000193fd0 pc=0x76544

goroutine 7 [runnable]:
syscall.Syscall(0x3f, 0x3, 0x40003ab8a5, 0x1256, 0x1256, 0x40003ab8a5, 0x0)
        /usr/local/lib/go/src/syscall/asm_linux_arm64.s:9 +0x10
syscall.read(0x3, 0x40003ab8a5, 0x1256, 0x1256, 0x0, 0x460708, 0x6204f8)
        /usr/local/lib/go/src/syscall/zsyscall_linux_arm64.go:686 +0x4c
syscall.Read(...)
        /usr/local/lib/go/src/syscall/syscall_unix.go:187
internal/poll.ignoringEINTRIO(...)
        /usr/local/lib/go/src/internal/poll/fd_unix.go:581
internal/poll.(*FD).Read(0x4000200180, 0x40003ab8a5, 0x1256, 0x1256, 0x0, 0x0, 0x0)
        /usr/local/lib/go/src/internal/poll/fd_unix.go:162 +0x100
net.(*netFD).Read(0x4000200180, 0x40003ab8a5, 0x1256, 0x1256, 0x40003ab4e5, 0x40001cdb98, 0x400058b798)
        /usr/local/lib/go/src/net/fd_posix.go:55 +0x44
net.(*conn).Read(0x4000098000, 0x40003ab8a5, 0x1256, 0x1256, 0x0, 0x0, 0x0)
        /usr/local/lib/go/src/net/net.go:183 +0x74
crypto/tls.(*atLeastReader).Read(0x40002e2180, 0x40003ab8a5, 0x1256, 0x1256, 0x4000105000, 0x1ce720, 0x0)
        /usr/local/lib/go/src/crypto/tls/conn.go:776 +0x58
bytes.(*Buffer).ReadFrom(0x400009a278, 0x45f588, 0x40002e2180, 0x1cc330, 0x3787e0, 0x3c6720)
        /usr/local/lib/go/src/bytes/buffer.go:204 +0xa4
crypto/tls.(*Conn).readFromUntil(0x400009a000, 0x45f8e8, 0x4000098000, 0x570, 0x4000098000, 0x0)
        /usr/local/lib/go/src/crypto/tls/conn.go:798 +0xd0
crypto/tls.(*Conn).readRecordOrCCS(0x400009a000, 0x0, 0x0, 0x219bc0)
        /usr/local/lib/go/src/crypto/tls/conn.go:650 +0x5fc
crypto/tls.(*Conn).readRecord(...)
        /usr/local/lib/go/src/crypto/tls/conn.go:573
crypto/tls.(*Conn).Read(0x400009a000, 0x40002e4000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
        /usr/local/lib/go/src/crypto/tls/conn.go:1276 +0x12c
bufio.(*Reader).Read(0x40005837a0, 0x40002b6ab8, 0x9, 0x9, 0x400058bc08, 0x220370, 0x400058bc08)
        /usr/local/lib/go/src/bufio/bufio.go:227 +0x214
io.ReadAtLeast(0x45f408, 0x40005837a0, 0x40002b6ab8, 0x9, 0x9, 0x9, 0x0, 0x400014c200, 0x400016fd10)
        /usr/local/lib/go/src/io/io.go:328 +0x78
io.ReadFull(...)
        /usr/local/lib/go/src/io/io.go:347
net/http.http2readFrameHeader(0x40002b6ab8, 0x9, 0x9, 0x45f408, 0x40005837a0, 0x0, 0x0, 0x4000318200, 0x0)
        /usr/local/lib/go/src/net/http/h2_bundle.go:1477 +0x5c
net/http.(*http2Framer).ReadFrame(0x40002b6a80, 0x4000318240, 0x0, 0x0, 0x0)
        /usr/local/lib/go/src/net/http/h2_bundle.go:1735 +0x74
net/http.(*http2clientConnReadLoop).run(0x400058bfa8, 0x0, 0x0)
        /usr/local/lib/go/src/net/http/h2_bundle.go:8322 +0xac
net/http.(*http2ClientConn).readLoop(0x4000106900)
        /usr/local/lib/go/src/net/http/h2_bundle.go:8244 +0x60
created by net/http.(*http2Transport).newClientConn
        /usr/local/lib/go/src/net/http/h2_bundle.go:7208 +0x570
$