summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorPeter Bindels <dascandy@gmail.com>2021-07-16 23:30:01 +0200
committerGunnar Beutner <gunnar@beutner.name>2021-07-17 01:45:20 +0200
commita5a62f99c54aae004357bc12b8b12c6086d12903 (patch)
treed16d63238c7f9f4212e376976f6a9e494fd4d842 /Userland
parent205c8a12ed28809e18f8d9b44689fecb6fac15a8 (diff)
downloadserenity-a5a62f99c54aae004357bc12b8b12c6086d12903.zip
LibC: Use 64-bit stack smash value for 64-bit mode
Otherwise it'll use the first 32 bits that happen to come after, leading to very weird bugs. Fixes #8601
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibC/crt0.cpp4
-rw-r--r--Userland/Libraries/LibC/ssp.cpp4
2 files changed, 4 insertions, 4 deletions
diff --git a/Userland/Libraries/LibC/crt0.cpp b/Userland/Libraries/LibC/crt0.cpp
index f496dba46e..00c900e43c 100644
--- a/Userland/Libraries/LibC/crt0.cpp
+++ b/Userland/Libraries/LibC/crt0.cpp
@@ -14,7 +14,7 @@
#ifndef _DYNAMIC_LOADER
extern "C" {
-extern u32 __stack_chk_guard;
+extern size_t __stack_chk_guard;
int main(int, char**, char**);
@@ -31,7 +31,7 @@ NAKED void _start(int, char**, char**)
int _entry(int argc, char** argv, char** env)
{
- u32 original_stack_chk = __stack_chk_guard;
+ size_t original_stack_chk = __stack_chk_guard;
arc4random_buf(&__stack_chk_guard, sizeof(__stack_chk_guard));
if (__stack_chk_guard == 0)
diff --git a/Userland/Libraries/LibC/ssp.cpp b/Userland/Libraries/LibC/ssp.cpp
index dbc108bd6e..434cde286d 100644
--- a/Userland/Libraries/LibC/ssp.cpp
+++ b/Userland/Libraries/LibC/ssp.cpp
@@ -17,8 +17,8 @@
extern "C" {
-extern u32 __stack_chk_guard;
-u32 __stack_chk_guard = (u32)0xc6c7c8c9;
+extern size_t __stack_chk_guard;
+size_t __stack_chk_guard = (size_t)0xc6c7c8c9;
__attribute__((noreturn)) void __stack_chk_fail()
{