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

plugin: R15 clobbered when loading outside variables #36509

Closed
timorl opened this issue Jan 11, 2020 · 2 comments
Closed

plugin: R15 clobbered when loading outside variables #36509

timorl opened this issue Jan 11, 2020 · 2 comments
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@timorl
Copy link

timorl commented Jan 11, 2020

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

$ go version
go version go1.13.5 linux/amd64

Does this issue reproduce with the latest release?

Yes.

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/timorl/.cache/go-build"
GOENV="/home/timorl/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="[REDACTED]"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="x86_64-pc-linux-gnu-gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build858965079=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Encountered a bug when using cloudflare/bn256 inside of a plugin. After reporting it here we have a minimal example here.

The minimal example loads 1 into R15, then reads an unrelated variable and returns the contents of R15.

What did you expect to see?

The number 1 being returned.

What did you see instead?

Random huge numbers.

Other

I strongly suspect this is essentially the same problem as #18820, but with a different library. From what I understand this probably won't be changed, but I could not find any official statement that no one should expect using R15 and loading variables to work together when dynamically linking, so it is technically still a bug, right?

@timorl timorl changed the title Pluins clobber R15 Plugins clobber R15 when loading outside variables Jan 11, 2020
@smasher164 smasher164 changed the title Plugins clobber R15 when loading outside variables plugin: R15 clobbered when loading outside variables Jan 11, 2020
@smasher164 smasher164 added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jan 11, 2020
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Jul 7, 2022
@seankhliao seankhliao added this to the Unplanned milestone Aug 27, 2022
@armfazh
Copy link

armfazh commented Feb 24, 2023

Related #58632

@randall77
Copy link
Contributor

This was fixed with CL 283474, which would have been released with Go 1.17. And by "fixed", I mean the assembler should reject the assembly when compiled as a plugin.

See #43661.

@golang golang locked and limited conversation to collaborators Feb 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

6 participants