summaryrefslogtreecommitdiff
path: root/Kernel/Arch
diff options
context:
space:
mode:
authorKeegan Saunders <keegan@undefinedbehaviour.org>2022-11-26 13:17:32 -0500
committerAndreas Kling <kling@serenityos.org>2022-11-29 11:04:21 +0100
commit89b23c473a57ddc37c316cca9b21d7a636e86d81 (patch)
tree73635c650a4b19949ca24742bf1c170864af9aba /Kernel/Arch
parent675e5bfdcebb41eb172027824ad46ab056c2730e (diff)
downloadserenity-89b23c473a57ddc37c316cca9b21d7a636e86d81.zip
LibC: Use uintptr_t for __stack_chk_guard
We used size_t, which is a type that is guarenteed to be large enough to hold an array index, but uintptr_t is designed to be used to hold pointer values, which is the case of stack guards.
Diffstat (limited to 'Kernel/Arch')
-rw-r--r--Kernel/Arch/aarch64/init.cpp4
-rw-r--r--Kernel/Arch/x86/init.cpp6
2 files changed, 5 insertions, 5 deletions
diff --git a/Kernel/Arch/aarch64/init.cpp b/Kernel/Arch/aarch64/init.cpp
index 4abc2826ad..de8743b511 100644
--- a/Kernel/Arch/aarch64/init.cpp
+++ b/Kernel/Arch/aarch64/init.cpp
@@ -65,8 +65,8 @@ extern ctor_func_t start_ctors[];
extern ctor_func_t end_ctors[];
// FIXME: Share this with the Intel Prekernel.
-extern size_t __stack_chk_guard;
-size_t __stack_chk_guard;
+extern uintptr_t __stack_chk_guard;
+uintptr_t __stack_chk_guard;
READONLY_AFTER_INIT bool g_in_early_boot;
diff --git a/Kernel/Arch/x86/init.cpp b/Kernel/Arch/x86/init.cpp
index 070d5da303..054955995a 100644
--- a/Kernel/Arch/x86/init.cpp
+++ b/Kernel/Arch/x86/init.cpp
@@ -68,8 +68,8 @@ extern ctor_func_t end_heap_ctors[];
extern ctor_func_t start_ctors[];
extern ctor_func_t end_ctors[];
-extern size_t __stack_chk_guard;
-READONLY_AFTER_INIT size_t __stack_chk_guard __attribute__((used));
+extern uintptr_t __stack_chk_guard;
+READONLY_AFTER_INIT uintptr_t __stack_chk_guard __attribute__((used));
extern "C" u8 start_of_safemem_text[];
extern "C" u8 end_of_safemem_text[];
@@ -234,7 +234,7 @@ extern "C" [[noreturn]] UNMAP_AFTER_INIT void init(BootInfo const& boot_info)
// Initialize TimeManagement before using randomness!
TimeManagement::initialize(0);
- __stack_chk_guard = get_fast_random<size_t>();
+ __stack_chk_guard = get_fast_random<uintptr_t>();
ProcFSComponentRegistry::initialize();
JailManagement::the();