ossf / wg-best-practices-os-developers

The Best Practices for OSS Developers working group is dedicated to raising awareness and education of secure code best practices for open source developers.
https://openssf.org
Apache License 2.0
715 stars 123 forks source link

Consider `-Wl,-z,separate-code` for C and C++ Compiler Hardening Guide #588

Open thomasnyman opened 3 weeks ago

thomasnyman commented 3 weeks ago

Splitting this off from Dominik Czarnota's extensive feedback in #330.

The -Wl,-z,separate-code option ensures that the ELF header is not mapped with executable rights. This is effectively a complement to RELRO but instead of applying read-only permissions to sensitive parts of the data segment, it applies read-only permissions to potentially dangerous areas of the code segment.

Resources:

thesamesam commented 2 weeks ago

Some notes: