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

Compiler: I compiled it using "-s -w" build flag. but information still present in the binary #51826

Closed
ghost opened this issue Mar 20, 2022 · 6 comments

Comments

@ghost
Copy link

ghost commented Mar 20, 2022

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

$ go version
go version go1.18 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/kusattapan/.cache/go-build"
GOENV="/home/kusattapan/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/kusattapan/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/kusattapan/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go-1.18"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go-1.18/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.18"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/kusattapan"
GOWORK=""
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-build411400481=/tmp/go-build -gno-record-gcc-switches"

What did you do?

What did you expect to see?

Only machine code, like c.
I don't like to include my information in the binary.

What did you see instead?

I passed build flag "-s -w" to compile it. However all my sensitive informations (All function names Variable names Package names my pc username C:\Users\xxx) are present in the binary.

@seankhliao
Copy link
Member

Without it you wouldn't have things like reflect or stacktraces
see also #50501

closing as working as intended

@ghost
Copy link
Author

ghost commented Mar 20, 2022

ok thank you.

@go101
Copy link

go101 commented Mar 20, 2022

reflect doesn't need and stacktraces doesn't require such info.

@kusattapan1 Have you tired -trimpath?

@ghost
Copy link
Author

ghost commented Mar 20, 2022

v2 beta

I didn't know there was such function!

reflect doesn't need and stacktraces doesn't require such info.

@kusattapan1 Have you tired -trimpath?

I didn't know there was such function! thank you. Apart from pc name function names and variable names are still present in my binary. Is there any way to remove it?

@go101
Copy link

go101 commented Mar 21, 2022

There is a project for this: https://github.com/burrowers/garble
I never tried it.

@ghost
Copy link
Author

ghost commented Mar 21, 2022

There is a project for this: https://github.com/burrowers/garble I never tried it.

It worked for me. thank you! wish native golang had such a feature...

@golang golang locked and limited conversation to collaborators Mar 21, 2023
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

3 participants