-
Notifications
You must be signed in to change notification settings - Fork 419
Remove pie from GOFLAGS #2237
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
Remove pie from GOFLAGS #2237
Conversation
Signed-off-by: Dan Luhring <[email protected]>
|
I am curious about this because this feels like a security feature that let's the loader randomize the binary layout in memory. I am also curious what this costs us in terms of downside to have on (I see a few comments about |
|
After consulting with my trusted companion, ChatGPT, I agree with @mattmoor that this is worth further thought.
|
|
lifting this out of slack for future context: the impetus for this change was I agree with luhring that we probably overcorrected making there seem to be ways to have |
|
We are likely to start building dynamic Go binaries for other reasons, namely using libcrypto for cryptography (so we can do a single build and support FIPS mode in the usual way). |
|
@mattmoor @joshrwolf @luhring @kaniini More recent golang toolchains have fixed -buildmode=pie to not trigger/require/pull-in cgo and do not trigger/require external linking. Thus enabling -buildmode=pie these days should retain binaries as is (static ones remain static, dynamic ones remain dynamic) without much cause of issues. On most platforms (see per-go version as to which platforms support internal PIE mode, and even default to it - mostly mobile phone targets). In terms of benefits - I cannot find evidence of what benefits this brings to statically linked binaries (i.e. pure-go ones, or those that disable CGO). It will pacify binary scanners that flag up these binaries as not having PIE. For the FIPS builds, this will bring benefits, as we do have CGO enabled there, they are dynamically linked with C code, and they do call out to libcrypto.so (c code). I don't know what the penalty/difference this makes to the static binaries, and if it is worth turning this on by default, even if it doesn't bring any obvious advantages to the statically linked go binaires. |
We don't think this setting has a worthwhile benefit to the Go binaries we're building. cc: @joshrwolf @kaniini