-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
featureNew feature or requestNew feature or request
Description
We need to ensure that the linker resolves all dynamically linked functions at the beginning of the execution, and then makes the GOT read-only. This technique is called RELRO and ensures that the GOT cannot be overwritten in vulnerable ELF binaries. 1
gcc -g -O0 -Wl,-z,relro,-z,now -o <binary_name> <source_code>
In Go equivalent:
-extldflags=-zrelro -extldflags=-znow
An example implementation to Vault: https://github.com/hashicorp/vault-csi-provider/pull/143/files by @developer-guy
- trimpath increases build reproducibility. Per default full file paths are added to the go binary so two users will very likely have different binaries build even though the code is the same.
- w No DWARF (reduces binary size)
- s No symbol table (even less binary size)
- znow and zrelro Hardening, adds runtime costs.
Footnotes
Metadata
Metadata
Assignees
Labels
featureNew feature or requestNew feature or request