From ed839450c8568e8f6176a491c28c2db0d5abcf0b Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 17 Dec 2021 11:34:29 +0100 Subject: [PATCH] Kernel: Enable SMAP protection earlier during syscall entry There's no reason to delay this for as long as we did. --- Kernel/Syscall.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Kernel/Syscall.cpp b/Kernel/Syscall.cpp index 1675902433..cd6199153a 100644 --- a/Kernel/Syscall.cpp +++ b/Kernel/Syscall.cpp @@ -164,6 +164,9 @@ ErrorOr handle(RegisterState& regs, FlatPtr function, FlatPtr arg1, Fla NEVER_INLINE void syscall_handler(TrapFrame* trap) { + // Make sure SMAP protection is enabled on syscall entry. + clac(); + auto& regs = *trap->regs; auto current_thread = Thread::current(); VERIFY(current_thread->previous_mode() == Thread::PreviousMode::UserMode); @@ -182,9 +185,6 @@ NEVER_INLINE void syscall_handler(TrapFrame* trap) current_thread->yield_if_stopped(); - // Make sure SMAP protection is enabled on syscall entry. - clac(); - // Apply a random offset in the range 0-255 to the stack pointer, // to make kernel stacks a bit less deterministic. u32 lsw;