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/link: buildmode=pie makes application consumes much higher memory #44190
Comments
Could you show how this is measured?
This is related how the The numbers above looks reasonable and expected to me. And I don't think it has (direct) relation with memory consumption increase. |
@cherrymui Thanks for you reply. I use linux "free" command to check the free memory on qemu arm64 based image which has 9 runc-opencontainers containers. I see runc consumes about ~4MB more if it's built in PIE mode. Checking runc image size built with yocto aarch64-poky-linux-go, there is ~2.56 MB binary size increase (~26.4% increase): ########### default########### file runc ls -l runc 13706048 ########### pie########### file runc ls -l runc 16403528 |
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.) |
What version of Go are you using (
go version
)?aarch64-poky-linux-go version 1.14.7 arm64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?aarch64-poky-linux-go env
GO111MODULE=""
GOARCH="arm64"
GOBIN=""
GOCACHE="
/.cache/go-build"/.config/go/env"GOENV="
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="
/go"/usr/lib/aarch64-poky-linux/go"GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="
/usr/lib/aarch64-poky-linux/go/pkg/tool/linux_amd64"/build/tmp/work/x86_64-linux/go-cross-aarch64/1.14.7-r0/recipe-sysroot"GCCGO="gccgo"
AR="ar"
CC="aarch64-poky-linux-gcc -march=armv8-a -mtune=cortex-a57.cortex-a53 --sysroot=
CXX="aarch64-poky-linux-g++ -march=armv8-a -mtune=cortex-a57.cortex-a53 --sysroot=
/build/tmp/work/x86_64-linux/go-cross-aarch64/1.14.7-r0/recipe-sysroot"/go-build347086452=/tmp/go-build -gno-record-gcc-switches"CGO_ENABLED="0"
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=
What did you do?
Build runc (https://github.com/opencontainers/runc) with --buildmode=pie option to have ASLR support.
Run containers on ARM64v8 arch.
What did you expect to see?
runc with PIE flag consumes memory similar or slightly higher compared to runc built in default mode.
What did you see instead?
runc consumes much higher memory when it's built in PIE mode.
P.S. checking size of a simple example on Ubuntu 16.04 LTS/amd64
root@osama:/data/gotest# go build --buildmode=pie -o ex ex.go
root@osama:/data/gotest# size ex
text data bss dec hex filename
1068470 611516 207464 1887450 1cccda ex
root@osama:/data/gotest# go build --buildmode=default -o ex ex.go
root@osama:/data/gotest# size ex
text data bss dec hex filename
1268529 88724 207456 1564709 17e025 ex
root@osama:/data/gotest# go version
go version devel +8869086 Thu Feb 4 04:46:49 2021 +0000 linux/amd64
data section increases more than x6 with buildmode=pie
The text was updated successfully, but these errors were encountered: