aboutsummaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/x86_64/arch/boot/initialize_runtime.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/arch/x86_64/arch/boot/initialize_runtime.cpp b/arch/x86_64/arch/boot/initialize_runtime.cpp
index e548f4a1..ad2fa205 100644
--- a/arch/x86_64/arch/boot/initialize_runtime.cpp
+++ b/arch/x86_64/arch/boot/initialize_runtime.cpp
@@ -1,3 +1,5 @@
+#include <kapi/system.hpp>
+
#include <algorithm>
#include <functional>
#include <span>
@@ -12,6 +14,15 @@ namespace arch::boot
// NOLINTBEGIN(readability-identifier-naming)
extern global_initializer __init_array_start;
extern global_initializer __init_array_end;
+
+ [[gnu::used]]
+ constinit auto __stack_chk_guard = 0xcafe'face'1ee7'8ee7; // NOLINT(readability-magic-numbers)
+
+ [[noreturn]]
+ auto __stack_chk_fail() -> void
+ {
+ kapi::system::panic("Stack smashing detected!");
+ }
// NOLINTEND(readability-identifier-naming)
auto invoke_global_constructors() -> void