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

cmd/go: rare corruption of elf binary #63191

Closed
pwaller opened this issue Sep 24, 2023 · 3 comments
Closed

cmd/go: rare corruption of elf binary #63191

pwaller opened this issue Sep 24, 2023 · 3 comments
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@pwaller
Copy link
Contributor

pwaller commented Sep 24, 2023

What version of Go are you using (go version)?

$ go version
go version go1.20.8 linux/amd64

Does this issue reproduce with the latest release?

I have been unable to reproduce this at all. So it is obviously a rare failure of some component somewhere.

I believe this may have nothing to do with the Go toolchain but that an error report may be appreciated anyway. Please feel free to close this if that seems the appropriate course of action.

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOOS="linux"

go version: 1.20.8, linux/amd64. Linux 6.4.16; Small binary built on NixOS (NixOS/nixpkgs@d64aec9 using nixpkgs buildGoModule [0]).

What did you do?

Build a fairly simple Go binary which uses HTTP and run it.

What did you expect to see?

A well formed binary.

What did you see instead?

Upon running the program, junk binary data printed to terminal, segfault. Corrupted binary. Rebuild [via nixpkgs, so no caches involved] produced the expected result.

Details

Reproduction attempts so far failed across thousands of builds. I can't rule out filesystem or hardware corruption though was unable to detect those with memcheck and further testing either. Could also be a nixpkgs or other toolchain bug. A friend and I worked out the corruption function (bork, below). Which from the offsets doesn't feel likely to be filesystem corruption either.

def bork(g): return 
    g[:4880*512] + 
    g[4880*512+2672:6255*512] + 
    g[6249*512+400:7608*512] + 
    g[7608*512+336:8733*512+256] + 
    g[8732*512+432:]

bork(good binary bytes) == bad binary bytes

len(both binaries) == 5067832

[0] Build env repro below, supply your own sources, if you have nix installed, put source code in . and fix vendorHash when it complains. Note that NixOS also does other binary mangling, those things may also be implicated.

NIX_PATH=nixpkgs=flake:nixpkgs/d64aec9ffb49ef3aaa38924224c069945caad362 nix-build --expr '(import <nixpkgs> {}).buildGoModule { name = "hello-world"; src = ./.; vendorHash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="; }'
@seankhliao seankhliao added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Sep 24, 2023
@seankhliao
Copy link
Member

maybe related? #53804

@bcmills bcmills added compiler/runtime Issues related to the Go compiler and/or runtime. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. and removed WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Sep 25, 2023
@pwaller
Copy link
Contributor Author

pwaller commented Sep 25, 2023

maybe related? #53804

I think this issue is likely distinct, though that issue inspired me to file this one. The reasons I think it is likely distinct are because 1) my kernel version is newer than the one which is thought to fix it and 2) that one involved zero pages.

This bug does not have zero pages. All of the bytes in the corrupt binary are accounted for in the good binary. It is as if the binary has been scrambled a bit.

@seankhliao seankhliao added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. and removed WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Sep 25, 2023
@gopherbot
Copy link

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

@gopherbot gopherbot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

4 participants