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/6l: Go 1.4.2 version of 6l causes malloc assertion failure #12738

Closed
bha123 opened this issue Sep 24, 2015 · 9 comments
Closed

cmd/6l: Go 1.4.2 version of 6l causes malloc assertion failure #12738

bha123 opened this issue Sep 24, 2015 · 9 comments
Milestone

Comments

@bha123
Copy link

bha123 commented Sep 24, 2015

Hi all

We are installing golang 1.4.2 on ubuntu14.04 . After using the instructions https://golang.org/doc/install?download=go1.4.2.linux-amd64.tar.gz

when i am running simple helloworld program . It is giving the below error

root@ip-10-164-196-28:/home/vcap/goworkspace# go test 1.go
# command-line-arguments
6l: malloc.c:3096: sYSMALLOc: Assertion `(old_top == (((mbinptr) (((char *) &((av)->bins[((1) - 1) * 2])) - __builtin_offsetof (struct malloc_chunk, fd)))) && old_size == 0) || ((unsigned long) (old_size) >= (unsigned long)((((__builtin_offsetof (struct malloc_chunk, fd_nextsize))+((2 * (sizeof(size_t))) - 1)) & ~((2 * (sizeof(size_t))) - 1))) && ((old_top)->size & 0x1) && ((unsigned long)old_end & pagemask) == 0)' failed.

regards
Bharath

@davecheney
Copy link
Contributor

@bha123 can you please share a code sample that others can use to reproduce this issue.

@ianlancetaylor ianlancetaylor changed the title golang 1.4.2 failing in ubuntu14.04 runtime: golang 1.4.2 failing in ubuntu14.04 Sep 24, 2015
@ianlancetaylor ianlancetaylor added this to the Go1.6 milestone Sep 24, 2015
@ianlancetaylor
Copy link
Member

Please tell us the results of

type go
go env
ls $GOROOT

@ianlancetaylor
Copy link
Member

Also

go test -x 1.go

@ianlancetaylor
Copy link
Member

I just verified that the Go installation works for me on Ubuntu 14.04.

@bha123
Copy link
Author

bha123 commented Sep 29, 2015

Hi iamlancetaylor

The following are the results i got
vcap@ip-10-32-58-8:~$ type go
go is hashed (/usr/local/go/bin/go)
go env

vcap@ip-10-32-58-8:~$ sudo go env
GOARCH="amd64"
GOBIN=""
GOCHAR="6"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH=""
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"

vcap@ip-10-32-58-8:~$ sudo go test -x 1.go
WORK=/tmp/go-build928749057
mkdir -p $WORK/command-line-arguments/_obj/
mkdir -p $WORK/command-line-arguments/_obj/exe/
cd /home/vcap
/usr/local/go/pkg/tool/linux_amd64/6g -o $WORK/command-line-arguments.a -trimpath $WORK -p command-line-arguments -complete -D _/home/vcap -I $WORK -pack ./1.go
cd .
/usr/local/go/pkg/tool/linux_amd64/6l -o $WORK/command-line-arguments/_obj/exe/a.out -L $WORK -extld=gcc $WORK/command-line-arguments.a

command-line-arguments

6l: malloc.c:3096: sYSMALLOc: Assertion `(old_top == (((mbinptr) (((char *) &((av)->bins[((1) - 1) * 2])) - __builtin_offsetof (struct malloc_chunk, fd)))) && old_size == 0) || ((unsigned long) (old_size) >= (unsigned long)((((__builtin_offsetof (struct malloc_chunk, fd_nextsize))+((2 * (sizeof(size_t))) - 1)) & ~((2 * (sizeof(size_t))) - 1))) && ((old_top)->size & 0x1) && ((unsigned long)old_end & pagemask) == 0)' failed.

regards
Bharath

@ianlancetaylor
Copy link
Member

Why are you running "sudo go"? What happens if you omit the "sudo"?

What is the output of "printenv"?

What is the contents of the file 1.go?

@rsc
Copy link
Contributor

rsc commented Nov 5, 2015

@bha123, can you please answer Ian's questions?

Also if you run go test -work ... then the go command will leave the $WORK directory behind (will not remove it). After that, can you please run:

$ WORK=<line from output>
$ gdb --args /usr/local/go/pkg/tool/linux_amd64/6l -o $WORK/command-line-arguments/_obj/exe/a.out -L $WORK -extld=gcc $WORK/command-line-arguments.a
(gdb) r
... program crashes in malloc, hopefully ...
(gdb) where

It may be interesting to see what the stack trace is at the failure. Another possibility would be to run valgrind instead of gdb --args and see if valgrind detects any misuse of memory from within 6l.

Thanks.

@rsc
Copy link
Contributor

rsc commented Nov 5, 2015

(Normally we would deprioritize bugs in old Go releases, but if there is an actual memory corruption bug in 6l we need to fix it to keep Go 1.4 being a valid bootstrap toolchain.)

@rsc rsc changed the title runtime: golang 1.4.2 failing in ubuntu14.04 cmd/6l: Go 1.4.2 version of 6l causes malloc assertion failure Nov 5, 2015
@rsc
Copy link
Contributor

rsc commented Nov 26, 2015

Like Ian, I cannot reproduce this on Ubuntu 14.04. I even changed the go command to invoke 'valgrind -q 6l' instead of '6l' and was able to run all.bash successfully. Given the lack of further information, I don't think there's more we can do here.

@rsc rsc closed this as completed Nov 26, 2015
@golang golang locked and limited conversation to collaborators Nov 27, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants