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

Segfault on 32-bit ARM #7

Open
Koston-0xDEADBEEF opened this issue Nov 4, 2023 · 0 comments
Open

Segfault on 32-bit ARM #7

Koston-0xDEADBEEF opened this issue Nov 4, 2023 · 0 comments

Comments

@Koston-0xDEADBEEF
Copy link

On Linux/armv7l:

# ./neosd convert mslug.zip
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x11fb0]

goroutine 1 [running]:
runtime/internal/atomic.goXadd64(0x256dd0c, 0x400, 0x0, 0x2536400, 0x2536400)
        /usr/lib/go-1.15/src/runtime/internal/atomic/atomic_arm.go:103 +0x1c
github.com/bodgit/plumbing.(*WriteCounter).Write(0x256dd0c, 0x2536400, 0x400, 0x400, 0xc8df76, 0x0, 0x400)
        /root/terraonion/go/pkg/mod/github.com/bodgit/[email protected]/count.go:15 +0x30
github.com/bodgit/plumbing.(*teeReaderAt).ReadAt(0x251e730, 0x2536400, 0x400, 0x400, 0xc8df76, 0x0, 0x22b30, 0x269b4, 0x4)
        /root/terraonion/go/pkg/mod/github.com/bodgit/[email protected]/tee.go:13 +0xa4
archive/zip.readDirectoryEnd(0x31d340, 0x251e730, 0xc8e376, 0x0, 0xb6dac1e8, 0x20, 0xe9)
        /usr/lib/go-1.15/src/archive/zip/reader.go:476 +0x110
archive/zip.(*Reader).init(0x256dd20, 0x31d340, 0x251e730, 0xc8e376, 0x0, 0x282c68, 0x1)
        /usr/lib/go-1.15/src/archive/zip/reader.go:82 +0x34
archive/zip.NewReader(0x31d340, 0x251e730, 0xc8e376, 0x0, 0x0, 0x0, 0x0)
        /usr/lib/go-1.15/src/archive/zip/reader.go:75 +0x84
github.com/bodgit/rom.NewZipReader(0xbe9ede54, 0x9, 0x256dd00, 0x0, 0x0)
        /root/terraonion/go/pkg/mod/github.com/bodgit/[email protected]/reader.go:292 +0x1cc
github.com/bodgit/rom.NewReader(0xbe9ede54, 0x9, 0x259bc0c, 0x2562fa0, 0x261201, 0x7)
        /root/terraonion/go/pkg/mod/github.com/bodgit/[email protected]/reader.go:61 +0x10c
github.com/bodgit/terraonion/neo.(*File).readMameROM(0x25b2000, 0xbe9ede54, 0x9, 0x0, 0x0)
        /root/terraonion/neo/file.go:203 +0x1a8
github.com/bodgit/terraonion/neo.NewFile(0xbe9ede54, 0x9, 0x9, 0x24ba44, 0x438c30)
        /root/terraonion/neo/file.go:105 +0x5c
main.convert(0x256dcc0, 0x7, 0xc)
        /root/terraonion/cmd/neosd/main.go:124 +0x114
github.com/urfave/cli/v2.(*Command).Run(0x25265a0, 0x256da80, 0x0, 0x0)
        /root/terraonion/go/pkg/mod/github.com/urfave/cli/[email protected]/command.go:161 +0x3e8
github.com/urfave/cli/v2.(*App).RunContext(0x252e340, 0x31e780, 0x256f0a0, 0x25140e0, 0x3, 0x4, 0x0, 0x0)
        /root/terraonion/go/pkg/mod/github.com/urfave/cli/[email protected]/app.go:302 +0x608
github.com/urfave/cli/v2.(*App).Run(...)
        /root/terraonion/go/pkg/mod/github.com/urfave/cli/[email protected]/app.go:211
main.main()
        /root/terraonion/cmd/neosd/main.go:225 +0x634

This appears to be caused by a Go bug in 64bit atomic operations on certain 32-bit platforms: golang/go#23345

Quote from sync/atomic bugs section:

On ARM, 386, and 32-bit MIPS, it is the caller's responsibility to arrange for 64-bit alignment of 64-bit words accessed atomically via the primitive atomic functions (types Int64 and Uint64 are automatically aligned). The first word in an allocated struct, array, or slice; in a global variable; or in a local variable (because the subject of all atomic operations will escape to the heap) can be relied upon to be 64-bit aligned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant