From f081990717a821fb304afe0c96a879976faf1d99 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 3 Jan 2020 12:48:28 +0100 Subject: [PATCH] Kernel: Use get_fast_random() for the random syscall stack offset --- Kernel/Syscall.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Kernel/Syscall.cpp b/Kernel/Syscall.cpp index 98cecb5343..e71281c446 100644 --- a/Kernel/Syscall.cpp +++ b/Kernel/Syscall.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include #include @@ -94,7 +95,7 @@ void syscall_handler(RegisterDump regs) { // Apply a random offset in the range 0-255 to the stack pointer, // to make kernel stacks a bit less deterministic. - auto* ptr = (char*)__builtin_alloca(read_tsc() & 0xff); + auto* ptr = (char*)__builtin_alloca(get_fast_random()); asm volatile("" : "=m"(*ptr));