Add API for Binary Hardening
@nickclark2016 is already working on this.
Since Dec 19, 2025.
Assessment
This issue has not been assessed yet.
Description
What problem will this solve?
There have been efforts in recent years to harden STL implementations. GCC 14 added -fhardened to libstdc++ and MSVC 17.x's MS STL has the macro _MSVC_STL_HARDENING. Clang currently does not have a flag implemented, but there is an issue open (see https://github.com/llvm/llvm-project/issues/122687) and it can be reasonably emulated today.
What might be a solution?
Add a hardened API. Then we could allow specifying various "hardened" aspects. Sample usage:
hardened {
"stl", -- Standard library hardening
"aslr", -- Address space layout randomization (fpic, pie, dynamic base)
"stack", -- Stack protection flags (-fstack-protector-strong, /GS)
"controlflow", -- Control Flow protection (-fcf-protection=full, /cetcompat /guard:cf)
}
Another Option:
hardenstl "On/Off"
hardenaslr "On/Off"
hardenstack "On/Off"
controlflow "On/Off"
Open Questions: libc++ has various STL hardening modes (none, fast, extensive, debug). MS STL has an additional "destructor pointer tombstone" option. Would we support these, and if so, how would we want to do this? I think Option 2 allows for us to extend this better, especially if compilers start to turn these on by default.
What other alternatives have you already considered?
Flags can be manually added via the buildoptions API.
Anything else we should know?
Flag Suggestions: https://best.openssf.org/Compiler-Hardening-Guides/Compiler-Options-Hardening-Guide-for-C-and-C++.html
libstdc++ Hardening: https://gcc.gnu.org/wiki/LibstdcxxDebugMode
libc++ Hardening: https://libcxx.llvm.org/Hardening.html
MS STL Hardening: https://github.com/microsoft/STL/wiki/STL-Hardening
- Dominant language
- C
- Stars
- 3.6k
- Forks
- 654
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 13
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from premake/premake-core
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
premake/premake-core#2753 ·
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 84/100
premake/premake-core#2741 · 6 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
premake/premake-core#2798 ·
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 70/100
premake/premake-core#2788 · 3 comments ·
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 55/100
premake/premake-core#2786 · 10 comments ·
All issues in premake/premake-core
Similar issues
-
[adam] AdamNet network read doesn't cap to MAX_ADAM_PACKET_LEN, overflows client receive buffers Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
FujiNetWIFI/fujinet-firmware#1649 · 2 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
HarbourMasters/Shipwright#7229 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
riscv-software-src/riscv-isa-sim#2435 · 1 comment ·
-
bug Self Built Image SNAPSHOT Supported Device target/ramips
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100