1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 23:17:45 +00:00

LibELF: Add stack guard hardening

Employ the same hardening that glibc and the Linux kernel use for
generating stack guards: zero the first byte of the guard such that
if C-style string functions read out of bounds on the stack, we do
not overwrite or potentially leak the stack guard.
This commit is contained in:
Keegan Saunders 2022-11-27 15:46:17 -05:00 committed by Andreas Kling
parent 89b23c473a
commit e575339564
2 changed files with 10 additions and 1 deletions

View file

@ -18,6 +18,7 @@
extern "C" {
extern uintptr_t __stack_chk_guard;
// Initialized in `initialize_libc` (we leave a placeholder value here before initialization).
__attribute__((used)) uintptr_t __stack_chk_guard = (uintptr_t)0xc6c7c8c9;
__attribute__((noreturn)) void __stack_chk_fail()